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 % Divide by 2 the index item indentation (10pt -> 5pt)
10 \renewcommand\@idxitem{\par\hangindent 20\p@}
11 \renewcommand\subitem{\@idxitem \hspace*{10\p@}}
12 \renewcommand\subsubitem{\@idxitem \hspace*{15\p@}}
15 % Put the index in the TOC
17 \let\stdindex=\theindex
18 \let\endstdindex=\endtheindex
19 \renewenvironment{theindex}{
21 % Use a smaller font except for the letter heading which is bold
22 \newfontfamily\indexfont[Scale=0.7,
23 BoldFeatures={Scale=1}]{Crimson Text}
24 \@ifundefined{chapter}{}{
25 % To not have the number, replace by:
26 % \addcontentsline{toc}{chapter}{\numberline{}\indexname}
27 \refstepcounter{chapter}
28 \ifnum \c@secnumdepth >\z@
29 \ifnum \value{part} >\z@
30 \addcontentsline{toc}{part}{\numberline{\thechapter}\hspace{-1em}\indexname}
32 \addcontentsline{toc}{chapter}{\numberline{\thechapter}\indexname}
35 \addcontentsline{toc}{chapter}{\indexname}
38 % Adapt the vertical sizes to the smaller font
39 \setlength{\baselineskip}{0.7\baselineskip}%
40 \setlength{\parskip}{0.2\baselineskip}%
47 \newenvironment{colophon}{
49 \fontsize{7}{8.4}\selectfont %
50 \setlength{\parskip}{0.5em} %
51 \setlength{\parindent}{0pt} %
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 % Based on ideas from https://bugs.debian.org/684772
60 % Useless with unnumbered sections (e.g. use of \setcounter{secnumdepth}{0})
63 \newcommand\makeletterof[1]{%
64 \ifthenelse{\equal{#1}{1}}{EN}{%
65 \ifthenelse{\equal{#1}{2}}{TO}{%
66 \ifthenelse{\equal{#1}{3}}{TRE}{%
67 \ifthenelse{\equal{#1}{4}}{FIRE}{%
68 \ifthenelse{\equal{#1}{5}}{FEM}{%
69 \ifthenelse{\equal{#1}{6}}{SEKS}{%
70 \ifthenelse{\equal{#1}{7}}{SJU}{%
71 \ifthenelse{\equal{#1}{8}}{ÅTTE}{%
72 \ifthenelse{\equal{#1}{9}}{NI}{%
73 \ifthenelse{\equal{#1}{10}}{TI}{%
74 \ifthenelse{\equal{#1}{11}}{ELLEVE}{%
75 \ifthenelse{\equal{#1}{12}}{TOLV}{%
78 % Make TOC entries without label
79 \titlecontents{chapter} %
81 {\addvspace{0.3em plus 0pt}\bfseries} %
82 {\hspace{-1.3em}} % no number, remove room reserved for it
84 {\hfill \contentspage} % dots and page number
87 \dottedcontents{section} %
91 {0.75em} % space between dots
94 %% Redefines the headings to remove the chapter label
95 \titleformat{\chapter}[block]
96 {\filcenter\huge}{\filcenter}{20pt}{\Huge}
98 \titleformat{\section}
99 {\filcenter\Large\bfseries}{\thesection}{1em}{}
101 \titleformat{\subsection}
102 {\filcenter\large\bfseries}{\thesubsection}{1em}{}
104 %% New header, behaving like a chapter but formatted differently
105 \titleclass{\lotheader}{top}[\part]
106 \newcounter{lotheader}
107 \renewcommand{\thelotheader}{\Alph{lotheader}}
109 \titleformat{\lotheader}[block]
110 {\filcenter\huge}{\filcenter}{20pt}{\Huge}
111 \titlespacing*{\lotheader}{0pt}{-30pt}{40pt}
113 % Use the new header in TOC
114 \let\stdtoc=\tableofcontents
115 \let\stdchapter=\chapter
116 \def\tableofcontents{\let\chapter\lotheader \stdtoc{} \let\chapter\stdchapter}
119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122 % https://amyrhoda.wordpress.com/2012/06/04/latex-to-lulu-the-making-of-aosa-other-useful-packages-and-settings/
124 % The microtype package provides the ability to micromanage your
125 % typography. When invoked without any options it does some nice things
126 % like protruding punctuation over the edge of the right margin to make
127 % the margin appear smoother. Basically it makes your book look more
128 % professional with very little effort. It also has a ton of options if
129 % you want to micromanage even more.
130 \usepackage{microtype}
132 % By dafault, LaTeX will try and make all your pages the length that
133 % you set using the geometry setting. If a page has images, tables,
134 % headings or paragraph breaks which make it shorter than that page
135 % length, LaTeX will pad the page by adding whitespace between
136 % elements. We thought that looked sillier than having pages be
137 % different lengths, so we used the raggedbottom command.
140 % Hint for figure with empty title: remove the colon label separator
142 \captionsetup[figure]{labelsep=none}
144 % Fix the page number reset done by abstract by redefining it
146 % https://github.com/petterreinholdtsen/free-culture-lessig/pull/7
149 \let\stdsetcounter\setcounter
150 \let\stdabstract=\abstract
151 \let\endstdabstract=\endabstract
152 \renewenvironment{abstract}{%
153 \let\setcounter\nocount%
156 \setlength\parskip{\medskipamount}%
157 \setlength\parindent{0pt}%
160 \let\setcounter\stdsetcounter