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 % Use a smaller font except for the letter heading which is bold
56 \newfontfamily\indexfont[Scale=0.7,
57 BoldFeatures={Scale=1}]{Crimson Text}
58 \@ifundefined{chapter}{}{
59 % To not have the number, replace by:
60 % \addcontentsline{toc}{chapter}{\numberline{}\indexname}
61 \refstepcounter{chapter}
62 \ifnum \c@secnumdepth >\z@
63 \ifnum \value{part} >\z@
64 \addcontentsline{toc}{part}{\numberline{\thechapter}\hspace{-1em}\indexname}
66 \addcontentsline{toc}{chapter}{\numberline{\thechapter}\indexname}
69 \addcontentsline{toc}{chapter}{\indexname}
72 % Adapt the vertical sizes to the smaller font
73 \setlength{\baselineskip}{0.7\baselineskip}%
74 \setlength{\parskip}{0.2\baselineskip}%
81 \newenvironment{colophon}{
83 % FIXME change when page size changes, use {x}{x*1.2}
85 % Note, these numbers are not correct any more for the sizes mentioned:
86 % \fontsize{6.5}{7.8}\selectfont % fits in one 4.25x6.875" pocket size page
87 % \fontsize{7.5}{9}\selectfont % fits in one 5.06x7.71" size page
88 % \fontsize{9.1}{10.92}\selectfont % fits in one 5.5x8.5" digest size page
90 \fontsize{8.2}{9.84}\selectfont % fits in one 6x9'' size page
91 \setlength{\parskip}{0.5em} %
92 \setlength{\parindent}{0pt} %
96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97 % Based on ideas from https://bugs.debian.org/684772
101 % Useless with unnumbered sections (e.g. use of \setcounter{secnumdepth}{0})
104 \newcommand\makeletterof[1]{%
105 \ifthenelse{\equal{#1}{1}}{EN}{%
106 \ifthenelse{\equal{#1}{2}}{TO}{%
107 \ifthenelse{\equal{#1}{3}}{TRE}{%
108 \ifthenelse{\equal{#1}{4}}{FIRE}{%
109 \ifthenelse{\equal{#1}{5}}{FEM}{%
110 \ifthenelse{\equal{#1}{6}}{SEKS}{%
111 \ifthenelse{\equal{#1}{7}}{SJU}{%
112 \ifthenelse{\equal{#1}{8}}{ÅTTE}{%
113 \ifthenelse{\equal{#1}{9}}{NI}{%
114 \ifthenelse{\equal{#1}{10}}{TI}{%
115 \ifthenelse{\equal{#1}{11}}{ELLEVE}{%
116 \ifthenelse{\equal{#1}{12}}{TOLV}{%
119 % Make TOC entries without label
120 \titlecontents{chapter} %
122 {\addvspace{0.3em plus 0pt}\bfseries} %
123 {\hspace{-1.3em}} % no number, remove room reserved for it
125 {\hfill \contentspage} % dots and page number
128 \dottedcontents{section} %
132 {0.75em} % space between dots
135 %% Redefines the headings to remove the chapter label
136 \titleformat{\chapter}[block]
137 {\filcenter\Large}{\filcenter}{20pt}{\Large}
139 \titleformat{\section}
140 {\filcenter\Large\bfseries}{\thesection}{1em}{}
142 \titleformat{\subsection}
143 {\filcenter\large\bfseries}{\thesubsection}{1em}{}
145 %% New header, behaving like a section but formatted differently
146 \titleclass{\enoteheader}{straight}[\chapter]
147 \newcounter{enoteheader}
148 \renewcommand{\theenoteheader}{\Alph{enoteheader}}
150 \titleformat{\enoteheader}
151 {\normalfont\large}{}{0pt}{}
152 \titlespacing*{\enoteheader}{0pt}{2.5ex plus 1ex minus .2ex}{1.3ex plus .2ex}
154 \dottedcontents{enoteheader} %
158 {0.75em} % space between dots
161 %% New header, behaving like a chapter but formatted differently
162 \titleclass{\lotheader}{top}[\part]
163 \newcounter{lotheader}
164 \renewcommand{\thelotheader}{\Alph{lotheader}}
166 \titleformat{\lotheader}[block]
167 {\filcenter\huge}{\filcenter}{20pt}{\Huge}
168 \titlespacing*{\lotheader}{0pt}{-30pt}{40pt}
170 % Use the new header in TOC
171 \let\stdtoc=\tableofcontents
172 \let\stdchapter=\chapter
173 \def\tableofcontents{\let\chapter\lotheader \stdtoc{} \let\chapter\stdchapter}
176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
179 % https://amyrhoda.wordpress.com/2012/06/04/latex-to-lulu-the-making-of-aosa-other-useful-packages-and-settings/
181 % The microtype package provides the ability to micromanage your
182 % typography. When invoked without any options it does some nice things
183 % like protruding punctuation over the edge of the right margin to make
184 % the margin appear smoother. Basically it makes your book look more
185 % professional with very little effort. It also has a ton of options if
186 % you want to micromanage even more.
187 \usepackage{microtype}
189 % By dafault, LaTeX will try and make all your pages the length that
190 % you set using the geometry setting. If a page has images, tables,
191 % headings or paragraph breaks which make it shorter than that page
192 % length, LaTeX will pad the page by adding whitespace between
193 % elements. We thought that looked sillier than having pages be
194 % different lengths, so we used the raggedbottom command.
197 % Hint for figure with empty title: remove the colon label separator
199 \captionsetup[figure]{labelsep=none}
201 % Fix the page number reset done by abstract by redefining it
203 % https://github.com/petterreinholdtsen/free-culture-lessig/pull/7
206 \let\stdsetcounter\setcounter
207 \let\stdabstract=\abstract
208 \let\endstdabstract=\endabstract
209 \renewenvironment{abstract}{%
210 \let\setcounter\nocount%
213 \setlength\parskip{\medskipamount}%
214 \setlength\parindent{0pt}%
217 \let\setcounter\stdsetcounter