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