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 % Fix the page number reset done by abstract by redefining it
10 \let\stdsetcounter\setcounter
11 \let\stdabstract=\abstract
12 \let\endstdabstract=\endabstract
13 \renewenvironment{abstract}{%
14 \let\setcounter\nocount%
17 \setlength\parskip{\medskipamount}%
18 \setlength\parindent{0pt}%
21 \let\setcounter\stdsetcounter
24 % Divide by 2 the index item indentation (10pt -> 5pt)
26 \renewcommand\@idxitem{\par\hangindent 20\p@}
27 \renewcommand\subitem{\@idxitem \hspace*{10\p@}}
28 \renewcommand\subsubitem{\@idxitem \hspace*{15\p@}}
31 % Put the index in the TOC
33 \let\stdindex=\theindex
34 \let\endstdindex=\endtheindex
35 \renewenvironment{theindex}{
37 % Use a smaller font except for the letter heading which is bold
38 \newfontfamily\indexfont[Scale=0.7,
39 BoldFeatures={Scale=1}]{Crimson Text}
40 \@ifundefined{chapter}{}{
41 % To not have the number, replace by:
42 % \addcontentsline{toc}{chapter}{\numberline{}\indexname}
43 \refstepcounter{chapter}
44 \ifnum \c@secnumdepth >\z@
45 \ifnum \value{part} >\z@
46 \addcontentsline{toc}{part}{\numberline{\thechapter}\hspace{-1em}\indexname}
48 \addcontentsline{toc}{chapter}{\numberline{\thechapter}\indexname}
51 \addcontentsline{toc}{chapter}{\indexname}
54 % Adapt the vertical sizes to the smaller font
55 \setlength{\baselineskip}{0.7\baselineskip}%
56 \setlength{\parskip}{0.2\baselineskip}%
63 \newenvironment{colophon}{
65 \fontsize{7}{8.4}\selectfont %
66 \setlength{\parskip}{0.5em} %
67 \setlength{\parindent}{0pt} %
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72 % Based on ideas from https://bugs.debian.org/684772
76 % Useless with unnumbered sections (e.g. use of \setcounter{secnumdepth}{0})
79 \newcommand\makeletterof[1]{%
80 \ifthenelse{\equal{#1}{1}}{EN}{%
81 \ifthenelse{\equal{#1}{2}}{TO}{%
82 \ifthenelse{\equal{#1}{3}}{TRE}{%
83 \ifthenelse{\equal{#1}{4}}{FIRE}{%
84 \ifthenelse{\equal{#1}{5}}{FEM}{%
85 \ifthenelse{\equal{#1}{6}}{SEKS}{%
86 \ifthenelse{\equal{#1}{7}}{SJU}{%
87 \ifthenelse{\equal{#1}{8}}{ÅTTE}{%
88 \ifthenelse{\equal{#1}{9}}{NI}{%
89 \ifthenelse{\equal{#1}{10}}{TI}{%
90 \ifthenelse{\equal{#1}{11}}{ELLEVE}{%
91 \ifthenelse{\equal{#1}{12}}{TOLV}{%
94 % Make TOC entries without label
95 \titlecontents{chapter} %
97 {\addvspace{1em plus 0pt}\bfseries} %
98 {\hspace{-1.3em}} % no number, remove room reserved for it
100 {\hfill \contentspage} % dots and page number
103 \dottedcontents{section} %
107 {0.75em} % space between dots
111 %% Redefines the headings to remove the chapter label
112 \titleformat{\chapter}[block]
113 {\filcenter\huge}{\filcenter}{20pt}{\Huge}
115 \titleformat{\section}
116 {\filcenter\Large\bfseries}{\thesection}{1em}{}
118 \titleformat{\subsection}
119 {\filcenter\large\bfseries}{\thesubsection}{1em}{}
120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123 % https://amyrhoda.wordpress.com/2012/06/04/latex-to-lulu-the-making-of-aosa-other-useful-packages-and-settings/
125 % The microtype package provides the ability to micromanage your
126 % typography. When invoked without any options it does some nice things
127 % like protruding punctuation over the edge of the right margin to make
128 % the margin appear smoother. Basically it makes your book look more
129 % professional with very little effort. It also has a ton of options if
130 % you want to micromanage even more.
131 \usepackage{microtype}
133 % By dafault, LaTeX will try and make all your pages the length that
134 % you set using the geometry setting. If a page has images, tables,
135 % headings or paragraph breaks which make it shorter than that page
136 % length, LaTeX will pad the page by adding whitespace between
137 % elements. We thought that looked sillier than having pages be
138 % different lengths, so we used the raggedbottom command.
141 % Hint for figure with empty title: remove the colon label separator
143 \captionsetup[figure]{labelsep=none}
145 % Fix the page number reset done by abstract by redefining it
147 % https://github.com/petterreinholdtsen/free-culture-lessig/pull/7
150 \let\stdsetcounter\setcounter
151 \let\stdabstract=\abstract
152 \let\endstdabstract=\endabstract
153 \renewenvironment{abstract}{%
154 \let\setcounter\nocount%
157 \setlength\parskip{\medskipamount}%
158 \setlength\parindent{0pt}%
161 \let\setcounter\stdsetcounter