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{6}{7.2}\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{1em 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
95 %% Redefines the headings to remove the chapter label
96 \titleformat{\chapter}[block]
97 {\filcenter\huge}{\filcenter}{20pt}{\Huge}
99 \titleformat{\section}
100 {\filcenter\Large\bfseries}{\thesection}{1em}{}
102 \titleformat{\subsection}
103 {\filcenter\large\bfseries}{\thesubsection}{1em}{}
104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
107 % https://amyrhoda.wordpress.com/2012/06/04/latex-to-lulu-the-making-of-aosa-other-useful-packages-and-settings/
109 % The microtype package provides the ability to micromanage your
110 % typography. When invoked without any options it does some nice things
111 % like protruding punctuation over the edge of the right margin to make
112 % the margin appear smoother. Basically it makes your book look more
113 % professional with very little effort. It also has a ton of options if
114 % you want to micromanage even more.
115 \usepackage{microtype}
117 % By dafault, LaTeX will try and make all your pages the length that
118 % you set using the geometry setting. If a page has images, tables,
119 % headings or paragraph breaks which make it shorter than that page
120 % length, LaTeX will pad the page by adding whitespace between
121 % elements. We thought that looked sillier than having pages be
122 % different lengths, so we used the raggedbottom command.
125 % Hint for figure with empty title: remove the colon label separator
127 \captionsetup[figure]{labelsep=none}
129 % Fix the page number reset done by abstract by redefining it
131 % https://github.com/petterreinholdtsen/free-culture-lessig/pull/7
134 \let\stdsetcounter\setcounter
135 \let\stdabstract=\abstract
136 \let\endstdabstract=\endabstract
137 \renewenvironment{abstract}{%
138 \let\setcounter\nocount%
141 \setlength\parskip{\medskipamount}%
142 \setlength\parindent{0pt}%
145 \let\setcounter\stdsetcounter