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
13 % Customize the titlepage: remove the date, place the publisher name, and
14 % load a specific file for the verso page, containing some legal notices
20 \def\titlerecto{\begin{titlepage}%
24 {\LARGE \@title \par}%
28 \begin{tabular}[t]{c}%
32 {\large \DBKpublishername \par}
34 {\large \DBKpublisheraddress \par}%
40 \def\titlepagefile{titlepg.input.tex}
41 \IfFileExists{\titlepagefile}{\input{\titlepagefile}}{}
45 % Divide by 2 the index item indentation (10pt -> 5pt)
46 \renewcommand\@idxitem{\par\hangindent 20\p@}
47 \renewcommand\subitem{\@idxitem \hspace*{10\p@}}
48 \renewcommand\subsubitem{\@idxitem \hspace*{15\p@}}
50 % Put the index in the TOC
51 \let\stdindex=\theindex
52 \let\endstdindex=\endtheindex
53 \renewenvironment{theindex}{
55 \@ifundefined{chapter}{}{
56 % To not have the number, replace by:
57 % \addcontentsline{toc}{chapter}{\numberline{}\indexname}
58 \refstepcounter{chapter}
59 \ifnum \c@secnumdepth >\z@
60 \ifnum \value{part} >\z@
61 \addcontentsline{toc}{part}{\numberline{\thechapter}\hspace{-1em}\indexname}
63 \addcontentsline{toc}{chapter}{\numberline{\thechapter}\indexname}
66 \addcontentsline{toc}{chapter}{\indexname}
69 % Adapt the vertical sizes to the smaller font
70 \setlength{\baselineskip}{0.7\baselineskip}%
71 \setlength{\parskip}{0.2\baselineskip}%
78 \newenvironment{colophon}{
80 % FIXME change when page size changes, use {x}{x*1.2}
82 % Note, these numbers are not correct any more for the sizes mentioned:
83 % \fontsize{6.5}{7.8}\selectfont % fits in one 4.25x6.875" pocket size page
84 % \fontsize{7.5}{9}\selectfont % fits in one 5.06x7.71" size page
85 % \fontsize{9.1}{10.92}\selectfont % fits in one 5.5x8.5" digest size page
87 \fontsize{8.2}{9.84}\selectfont % fits in one 6x9'' size page
88 \setlength{\parskip}{0.5em} %
89 \setlength{\parindent}{0pt} %
93 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94 % Based on ideas from https://bugs.debian.org/684772
98 % Useless with unnumbered sections (e.g. use of \setcounter{secnumdepth}{0})
101 \newcommand\makeletterof[1]{%
102 \ifthenelse{\equal{#1}{1}}{EN}{%
103 \ifthenelse{\equal{#1}{2}}{TO}{%
104 \ifthenelse{\equal{#1}{3}}{TRE}{%
105 \ifthenelse{\equal{#1}{4}}{FIRE}{%
106 \ifthenelse{\equal{#1}{5}}{FEM}{%
107 \ifthenelse{\equal{#1}{6}}{SEKS}{%
108 \ifthenelse{\equal{#1}{7}}{SJU}{%
109 \ifthenelse{\equal{#1}{8}}{ÅTTE}{%
110 \ifthenelse{\equal{#1}{9}}{NI}{%
111 \ifthenelse{\equal{#1}{10}}{TI}{%
112 \ifthenelse{\equal{#1}{11}}{ELLEVE}{%
113 \ifthenelse{\equal{#1}{12}}{TOLV}{%
116 % Make TOC entries without label
117 \titlecontents{chapter} %
119 {\addvspace{0.3em plus 0pt}\bfseries} %
120 {\hspace{-1.3em}} % no number, remove room reserved for it
122 {\hfill \contentspage} % dots and page number
125 \dottedcontents{section} %
129 {0.75em} % space between dots
132 %% Redefines the headings to remove the chapter label
133 \titleformat{\chapter}[block]
134 {\filcenter\Large}{\filcenter}{20pt}{\Large}
136 \titleformat{\section}
137 {\filcenter\Large\bfseries}{\thesection}{1em}{}
139 \titleformat{\subsection}
140 {\filcenter\large\bfseries}{\thesubsection}{1em}{}
142 %% New header, behaving like a section but formatted differently
143 \titleclass{\enoteheader}{straight}[\chapter]
144 \newcounter{enoteheader}
145 \renewcommand{\theenoteheader}{\Alph{enoteheader}}
147 \titleformat{\enoteheader}
148 {\normalfont\large}{}{0pt}{}
149 \titlespacing*{\enoteheader}{0pt}{2.5ex plus 1ex minus .2ex}{1.3ex plus .2ex}
151 \dottedcontents{enoteheader} %
155 {0.75em} % space between dots
158 %% New header, behaving like a chapter but formatted differently
159 \titleclass{\lotheader}{top}[\part]
160 \newcounter{lotheader}
161 \renewcommand{\thelotheader}{\Alph{lotheader}}
163 \titleformat{\lotheader}[block]
164 {\filcenter\huge}{\filcenter}{20pt}{\Huge}
165 \titlespacing*{\lotheader}{0pt}{-30pt}{40pt}
167 % Use the new header in TOC
168 \let\stdtoc=\tableofcontents
169 \let\stdchapter=\chapter
170 \def\tableofcontents{\let\chapter\lotheader \stdtoc{} \let\chapter\stdchapter}
173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
176 % https://amyrhoda.wordpress.com/2012/06/04/latex-to-lulu-the-making-of-aosa-other-useful-packages-and-settings/
178 % The microtype package provides the ability to micromanage your
179 % typography. When invoked without any options it does some nice things
180 % like protruding punctuation over the edge of the right margin to make
181 % the margin appear smoother. Basically it makes your book look more
182 % professional with very little effort. It also has a ton of options if
183 % you want to micromanage even more.
184 \usepackage{microtype}
186 % By dafault, LaTeX will try and make all your pages the length that
187 % you set using the geometry setting. If a page has images, tables,
188 % headings or paragraph breaks which make it shorter than that page
189 % length, LaTeX will pad the page by adding whitespace between
190 % elements. We thought that looked sillier than having pages be
191 % different lengths, so we used the raggedbottom command.
194 % Hint for figure with empty title: remove the colon label separator
196 \captionsetup[figure]{labelsep=none}
198 % Fix the page number reset done by abstract by redefining it
200 % https://github.com/petterreinholdtsen/free-culture-lessig/pull/7
203 \let\stdsetcounter\setcounter
204 \let\stdabstract=\abstract
205 \let\endstdabstract=\endabstract
206 \renewenvironment{abstract}{%
207 \let\setcounter\nocount%
210 \setlength\parskip{\medskipamount}%
211 \setlength\parindent{0pt}%
214 \let\setcounter\stdsetcounter