1 \NeedsTeXFormat{LaTeX2e}
2 \ProvidesPackage{myclass}[]
4 %% Just use the original class and pass the options
5 \LoadClassWithOptions{report}
6 % report, book, memoir, scrreprt or scrbook ?
8 % Show frames, make it easier to debug borders
9 %\usepackage{showframe}% http://ctan.org/pkg/showframe
11 % Divide by 2 the index item indentation (10pt -> 5pt)
13 \renewcommand\@idxitem{\par\hangindent 20\p@}
14 \renewcommand\subitem{\@idxitem \hspace*{10\p@}}
15 \renewcommand\subsubitem{\@idxitem \hspace*{15\p@}}
18 % Put the index in the TOC
20 \let\stdindex=\theindex
21 \let\endstdindex=\endtheindex
22 \renewenvironment{theindex}{
24 % Use a smaller font except for the letter heading which is bold
25 \newfontfamily\indexfont[Scale=0.7,
26 BoldFeatures={Scale=1}]{Crimson Text}
27 \@ifundefined{chapter}{}{
28 % To not have the number, replace by:
29 % \addcontentsline{toc}{chapter}{\numberline{}\indexname}
30 \refstepcounter{chapter}
31 \ifnum \c@secnumdepth >\z@
32 \ifnum \value{part} >\z@
33 \addcontentsline{toc}{part}{\numberline{\thechapter}\hspace{-1em}\indexname}
35 \addcontentsline{toc}{chapter}{\numberline{\thechapter}\indexname}
38 \addcontentsline{toc}{chapter}{\indexname}
41 % Adapt the vertical sizes to the smaller font
42 \setlength{\baselineskip}{0.7\baselineskip}%
43 \setlength{\parskip}{0.2\baselineskip}%
50 \newenvironment{colophon}{
52 \fontsize{6.5}{7.8}\selectfont % fits in one pocket size page
53 % \fontsize{7.5}{9}\selectfont % fits in one 5.06x7.71" size page
54 % \fontsize{9.1}{10.92}\selectfont % fits in one 5.5x8.5" size page
55 \setlength{\parskip}{0.5em} %
56 \setlength{\parindent}{0pt} %
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 % Based on ideas from https://bugs.debian.org/684772
65 % Useless with unnumbered sections (e.g. use of \setcounter{secnumdepth}{0})
68 \newcommand\makeletterof[1]{%
69 \ifthenelse{\equal{#1}{1}}{EN}{%
70 \ifthenelse{\equal{#1}{2}}{TO}{%
71 \ifthenelse{\equal{#1}{3}}{TRE}{%
72 \ifthenelse{\equal{#1}{4}}{FIRE}{%
73 \ifthenelse{\equal{#1}{5}}{FEM}{%
74 \ifthenelse{\equal{#1}{6}}{SEKS}{%
75 \ifthenelse{\equal{#1}{7}}{SJU}{%
76 \ifthenelse{\equal{#1}{8}}{ÅTTE}{%
77 \ifthenelse{\equal{#1}{9}}{NI}{%
78 \ifthenelse{\equal{#1}{10}}{TI}{%
79 \ifthenelse{\equal{#1}{11}}{ELLEVE}{%
80 \ifthenelse{\equal{#1}{12}}{TOLV}{%
83 % Make TOC entries without label
84 \titlecontents{chapter} %
86 {\addvspace{0.3em plus 0pt}\bfseries} %
87 {\hspace{-1.3em}} % no number, remove room reserved for it
89 {\hfill \contentspage} % dots and page number
92 \dottedcontents{section} %
96 {0.75em} % space between dots
99 %% Redefines the headings to remove the chapter label
100 \titleformat{\chapter}[block]
101 {\filcenter\Large}{\filcenter}{20pt}{\Large}
103 \titleformat{\section}
104 {\filcenter\Large\bfseries}{\thesection}{1em}{}
106 \titleformat{\subsection}
107 {\filcenter\large\bfseries}{\thesubsection}{1em}{}
109 %% New header, behaving like a chapter but formatted differently
110 \titleclass{\lotheader}{top}[\part]
111 \newcounter{lotheader}
112 \renewcommand{\thelotheader}{\Alph{lotheader}}
114 \titleformat{\lotheader}[block]
115 {\filcenter\huge}{\filcenter}{20pt}{\Huge}
116 \titlespacing*{\lotheader}{0pt}{-30pt}{40pt}
118 % Use the new header in TOC
119 \let\stdtoc=\tableofcontents
120 \let\stdchapter=\chapter
121 \def\tableofcontents{\let\chapter\lotheader \stdtoc{} \let\chapter\stdchapter}
124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
127 % https://amyrhoda.wordpress.com/2012/06/04/latex-to-lulu-the-making-of-aosa-other-useful-packages-and-settings/
129 % The microtype package provides the ability to micromanage your
130 % typography. When invoked without any options it does some nice things
131 % like protruding punctuation over the edge of the right margin to make
132 % the margin appear smoother. Basically it makes your book look more
133 % professional with very little effort. It also has a ton of options if
134 % you want to micromanage even more.
135 \usepackage{microtype}
137 % By dafault, LaTeX will try and make all your pages the length that
138 % you set using the geometry setting. If a page has images, tables,
139 % headings or paragraph breaks which make it shorter than that page
140 % length, LaTeX will pad the page by adding whitespace between
141 % elements. We thought that looked sillier than having pages be
142 % different lengths, so we used the raggedbottom command.
145 % Hint for figure with empty title: remove the colon label separator
147 \captionsetup[figure]{labelsep=none}
149 % Fix the page number reset done by abstract by redefining it
151 % https://github.com/petterreinholdtsen/free-culture-lessig/pull/7
154 \let\stdsetcounter\setcounter
155 \let\stdabstract=\abstract
156 \let\endstdabstract=\endabstract
157 \renewenvironment{abstract}{%
158 \let\setcounter\nocount%
161 \setlength\parskip{\medskipamount}%
162 \setlength\parindent{0pt}%
165 \let\setcounter\stdsetcounter