]> pere.pagekite.me Git - text-free-culture-lessig.git/blob - myclass.cls
Update translation maintenance status.
[text-free-culture-lessig.git] / myclass.cls
1 \NeedsTeXFormat{LaTeX2e}
2 \ProvidesPackage{myclass}[]
3
4 %% Just use the original class and pass the options
5 \LoadClassWithOptions{report}
6 % report, book, memoir, scrreprt or scrbook ?
7
8 % Show frames, make it easier to debug borders
9 %\usepackage{showframe}% http://ctan.org/pkg/showframe
10 \makeatletter
11
12 %
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
15 %
16 \def\maketitle{%
17 \titlerecto%
18 \titleverso}
19
20 \def\titlerecto{\begin{titlepage}%
21 \null\vfil
22 \vskip 160\p@
23 \begin{center}%
24 {\LARGE \@title \par}%
25 \vskip 3em%
26 {\Large
27 \lineskip .75em%
28 \begin{tabular}[t]{c}%
29 \@author
30 \end{tabular}\par}%
31 \vskip 20em%
32 {\large \DBKpublishername \par}
33 \vskip .75em%
34 {\large \DBKpublisheraddress \par}%
35 \end{center}\par
36 \vfil\null
37 \end{titlepage}}%
38
39 \def\titleverso{%
40 \def\titlepagefile{titlepg.input.tex}
41 \IfFileExists{\titlepagefile}{\input{\titlepagefile}}{}
42 }%
43
44
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@}}
49
50 % Put the index in the TOC
51 \let\stdindex=\theindex
52 \let\endstdindex=\endtheindex
53 \renewenvironment{theindex}{
54 \begin{stdindex}
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}
62 \else
63 \addcontentsline{toc}{chapter}{\numberline{\thechapter}\indexname}
64 \fi
65 \else
66 \addcontentsline{toc}{chapter}{\indexname}
67 \fi
68 }
69 % Adapt the vertical sizes to the smaller font
70 \setlength{\baselineskip}{0.7\baselineskip}%
71 \setlength{\parskip}{0.2\baselineskip}%
72 \indexfont
73 }{
74 \end{stdindex}
75 }
76 \makeatother
77
78 \newenvironment{colophon}{
79 \pagebreak %
80 % FIXME change when page size changes, use {x}{x*1.2}
81
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
86
87 \fontsize{8.2}{9.84}\selectfont % fits in one 6x9'' size page
88 \setlength{\parskip}{0.5em} %
89 \setlength{\parindent}{0pt} %
90 }{}
91
92
93 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94 % Based on ideas from https://bugs.debian.org/684772
95 \usepackage{titlesec}
96 \usepackage{titletoc}
97 %
98 % Useless with unnumbered sections (e.g. use of \setcounter{secnumdepth}{0})
99 %
100 %
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}{%
114 #1}}}}}}}}}}}}}
115
116 % Make TOC entries without label
117 \titlecontents{chapter} %
118 [1.5em] %
119 {\addvspace{0.3em plus 0pt}\bfseries} %
120 {\hspace{-1.3em}} % no number, remove room reserved for it
121 {\hspace{-1.3em}} %
122 {\hfill \contentspage} % dots and page number
123 [\addvspace {0pt}]
124
125 \dottedcontents{section} %
126 [0em] % was (3.8)
127 {\addvspace{0pt}} %
128 {2.3em} % tab
129 {0.75em} % space between dots
130 [\addvspace{0pt}]
131
132 %% Redefines the headings to remove the chapter label
133 \titleformat{\chapter}[block]
134 {\filcenter\Large}{\filcenter}{20pt}{\Large}
135
136 \titleformat{\section}
137 {\filcenter\Large\bfseries}{\thesection}{1em}{}
138
139 \titleformat{\subsection}
140 {\filcenter\large\bfseries}{\thesubsection}{1em}{}
141
142 %% New header, behaving like a section but formatted differently
143 \titleclass{\enoteheader}{straight}[\chapter]
144 \newcounter{enoteheader}
145 \renewcommand{\theenoteheader}{\Alph{enoteheader}}
146
147 \titleformat{\enoteheader}
148 {\normalfont\large}{}{0pt}{}
149 \titlespacing*{\enoteheader}{0pt}{2.5ex plus 1ex minus .2ex}{1.3ex plus .2ex}
150
151 \dottedcontents{enoteheader} %
152 [0em] % was (3.8)
153 {\addvspace{0pt}} %
154 {2.3em} % tab
155 {0.75em} % space between dots
156 [\addvspace{0pt}]
157
158 %% New header, behaving like a chapter but formatted differently
159 \titleclass{\lotheader}{top}[\part]
160 \newcounter{lotheader}
161 \renewcommand{\thelotheader}{\Alph{lotheader}}
162
163 \titleformat{\lotheader}[block]
164 {\filcenter\huge}{\filcenter}{20pt}{\Huge}
165 \titlespacing*{\lotheader}{0pt}{-30pt}{40pt}
166
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}
171
172
173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
174
175 % From
176 % https://amyrhoda.wordpress.com/2012/06/04/latex-to-lulu-the-making-of-aosa-other-useful-packages-and-settings/
177
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}
185
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.
192 \raggedbottom
193
194 % Hint for figure with empty title: remove the colon label separator
195 \usepackage{caption}
196 \captionsetup[figure]{labelsep=none}
197
198 % Fix the page number reset done by abstract by redefining it
199 % Patch from
200 % https://github.com/petterreinholdtsen/free-culture-lessig/pull/7
201
202 \def\nocount#1#2{}
203 \let\stdsetcounter\setcounter
204 \let\stdabstract=\abstract
205 \let\endstdabstract=\endabstract
206 \renewenvironment{abstract}{%
207 \let\setcounter\nocount%
208 \begin{stdabstract}%
209 \noindent%
210 \setlength\parskip{\medskipamount}%
211 \setlength\parindent{0pt}%
212 }{
213 \end{stdabstract}
214 \let\setcounter\stdsetcounter
215 }