]> pere.pagekite.me Git - text-free-culture-lessig.git/blob - myclass.cls
Reduce colophon font size a bit to fit the norwegian version on one page.
[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 % Divide by 2 the index item indentation (10pt -> 5pt)
9 \makeatletter
10 \renewcommand\@idxitem{\par\hangindent 20\p@}
11 \renewcommand\subitem{\@idxitem \hspace*{10\p@}}
12 \renewcommand\subsubitem{\@idxitem \hspace*{15\p@}}
13 \makeatother
14
15 % Put the index in the TOC
16 \makeatletter
17 \let\stdindex=\theindex
18 \let\endstdindex=\endtheindex
19 \renewenvironment{theindex}{
20 \begin{stdindex}
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}
31 \else
32 \addcontentsline{toc}{chapter}{\numberline{\thechapter}\indexname}
33 \fi
34 \else
35 \addcontentsline{toc}{chapter}{\indexname}
36 \fi
37 }
38 % Adapt the vertical sizes to the smaller font
39 \setlength{\baselineskip}{0.7\baselineskip}%
40 \setlength{\parskip}{0.2\baselineskip}%
41 \indexfont
42 }{
43 \end{stdindex}
44 }
45 \makeatother
46
47 \newenvironment{colophon}{
48 \pagebreak %
49 \fontsize{6}{7.2}\selectfont %
50 \setlength{\parskip}{0.5em} %
51 \setlength{\parindent}{0pt} %
52 }{}
53
54
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 % Based on ideas from https://bugs.debian.org/684772
57 \usepackage{titlesec}
58 \usepackage{titletoc}
59 %
60 % Useless with unnumbered sections (e.g. use of \setcounter{secnumdepth}{0})
61 %
62 %
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}{%
76 #1}}}}}}}}}}}}}
77
78 % Make TOC entries without label
79 \titlecontents{chapter} %
80 [1.5em] %
81 {\addvspace{1em plus 0pt}\bfseries} %
82 {\hspace{-1.3em}} % no number, remove room reserved for it
83 {\hspace{-1.3em}} %
84 {\hfill \contentspage} % dots and page number
85 [\addvspace {0pt}]
86
87 \dottedcontents{section} %
88 [0em] % was (3.8)
89 {\addvspace{0pt}} %
90 {2.3em} % tab
91 {0.75em} % space between dots
92 [\addvspace{0pt}]
93
94
95 %% Redefines the headings to remove the chapter label
96 \titleformat{\chapter}[block]
97 {\filcenter\huge}{\filcenter}{20pt}{\Huge}
98
99 \titleformat{\section}
100 {\filcenter\Large\bfseries}{\thesection}{1em}{}
101
102 \titleformat{\subsection}
103 {\filcenter\large\bfseries}{\thesubsection}{1em}{}
104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
105
106 % From
107 % https://amyrhoda.wordpress.com/2012/06/04/latex-to-lulu-the-making-of-aosa-other-useful-packages-and-settings/
108
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}
116
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.
123 \raggedbottom
124
125 % Hint for figure with empty title: remove the colon label separator
126 \usepackage{caption}
127 \captionsetup[figure]{labelsep=none}
128
129 % Fix the page number reset done by abstract by redefining it
130 % Patch from
131 % https://github.com/petterreinholdtsen/free-culture-lessig/pull/7
132
133 \def\nocount#1#2{}
134 \let\stdsetcounter\setcounter
135 \let\stdabstract=\abstract
136 \let\endstdabstract=\endabstract
137 \renewenvironment{abstract}{%
138 \let\setcounter\nocount%
139 \begin{stdabstract}%
140 \noindent%
141 \setlength\parskip{\medskipamount}%
142 \setlength\parindent{0pt}%
143 }{
144 \end{stdabstract}
145 \let\setcounter\stdsetcounter
146 }