]> pere.pagekite.me Git - text-free-culture-lessig.git/blob - myclass.cls
Customize the maketitle to skip the date.
[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 % Customize the titlepage: remove the date
13 \let\stdmaketitle=\maketitle
14 \def\maketitle{\let\@date\empty\stdmaketitle}
15
16 % Divide by 2 the index item indentation (10pt -> 5pt)
17 \renewcommand\@idxitem{\par\hangindent 20\p@}
18 \renewcommand\subitem{\@idxitem \hspace*{10\p@}}
19 \renewcommand\subsubitem{\@idxitem \hspace*{15\p@}}
20
21 % Put the index in the TOC
22 \let\stdindex=\theindex
23 \let\endstdindex=\endtheindex
24 \renewenvironment{theindex}{
25 \begin{stdindex}
26 % Use a smaller font except for the letter heading which is bold
27 \newfontfamily\indexfont[Scale=0.7,
28 BoldFeatures={Scale=1}]{Crimson Text}
29 \@ifundefined{chapter}{}{
30 % To not have the number, replace by:
31 % \addcontentsline{toc}{chapter}{\numberline{}\indexname}
32 \refstepcounter{chapter}
33 \ifnum \c@secnumdepth >\z@
34 \ifnum \value{part} >\z@
35 \addcontentsline{toc}{part}{\numberline{\thechapter}\hspace{-1em}\indexname}
36 \else
37 \addcontentsline{toc}{chapter}{\numberline{\thechapter}\indexname}
38 \fi
39 \else
40 \addcontentsline{toc}{chapter}{\indexname}
41 \fi
42 }
43 % Adapt the vertical sizes to the smaller font
44 \setlength{\baselineskip}{0.7\baselineskip}%
45 \setlength{\parskip}{0.2\baselineskip}%
46 \indexfont
47 }{
48 \end{stdindex}
49 }
50 \makeatother
51
52 \newenvironment{colophon}{
53 \pagebreak %
54 % FIXME change when page size changes
55 % \fontsize{6.5}{7.8}\selectfont % fits in one 4.25x6.875" pocket size page
56 % \fontsize{7.5}{9}\selectfont % fits in one 5.06x7.71" size page
57 % \fontsize{9.1}{10.92}\selectfont % fits in one 5.5x8.5" digest size page
58 \fontsize{9.9}{11.88}\selectfont % fits in one 6x9'' size page
59 \setlength{\parskip}{0.5em} %
60 \setlength{\parindent}{0pt} %
61 }{}
62
63
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 % Based on ideas from https://bugs.debian.org/684772
66 \usepackage{titlesec}
67 \usepackage{titletoc}
68 %
69 % Useless with unnumbered sections (e.g. use of \setcounter{secnumdepth}{0})
70 %
71 %
72 \newcommand\makeletterof[1]{%
73 \ifthenelse{\equal{#1}{1}}{EN}{%
74 \ifthenelse{\equal{#1}{2}}{TO}{%
75 \ifthenelse{\equal{#1}{3}}{TRE}{%
76 \ifthenelse{\equal{#1}{4}}{FIRE}{%
77 \ifthenelse{\equal{#1}{5}}{FEM}{%
78 \ifthenelse{\equal{#1}{6}}{SEKS}{%
79 \ifthenelse{\equal{#1}{7}}{SJU}{%
80 \ifthenelse{\equal{#1}{8}}{ÅTTE}{%
81 \ifthenelse{\equal{#1}{9}}{NI}{%
82 \ifthenelse{\equal{#1}{10}}{TI}{%
83 \ifthenelse{\equal{#1}{11}}{ELLEVE}{%
84 \ifthenelse{\equal{#1}{12}}{TOLV}{%
85 #1}}}}}}}}}}}}}
86
87 % Make TOC entries without label
88 \titlecontents{chapter} %
89 [1.5em] %
90 {\addvspace{0.3em plus 0pt}\bfseries} %
91 {\hspace{-1.3em}} % no number, remove room reserved for it
92 {\hspace{-1.3em}} %
93 {\hfill \contentspage} % dots and page number
94 [\addvspace {0pt}]
95
96 \dottedcontents{section} %
97 [0em] % was (3.8)
98 {\addvspace{0pt}} %
99 {2.3em} % tab
100 {0.75em} % space between dots
101 [\addvspace{0pt}]
102
103 %% Redefines the headings to remove the chapter label
104 \titleformat{\chapter}[block]
105 {\filcenter\Large}{\filcenter}{20pt}{\Large}
106
107 \titleformat{\section}
108 {\filcenter\Large\bfseries}{\thesection}{1em}{}
109
110 \titleformat{\subsection}
111 {\filcenter\large\bfseries}{\thesubsection}{1em}{}
112
113 %% New header, behaving like a section but formatted differently
114 \titleclass{\enoteheader}{straight}[\chapter]
115 \newcounter{enoteheader}
116 \renewcommand{\theenoteheader}{\Alph{enoteheader}}
117
118 \titleformat{\enoteheader}
119 {\normalfont\large}{}{0pt}{}
120 \titlespacing*{\enoteheader}{0pt}{2.5ex plus 1ex minus .2ex}{1.3ex plus .2ex}
121
122 \dottedcontents{enoteheader} %
123 [0em] % was (3.8)
124 {\addvspace{0pt}} %
125 {2.3em} % tab
126 {0.75em} % space between dots
127 [\addvspace{0pt}]
128
129 %% New header, behaving like a chapter but formatted differently
130 \titleclass{\lotheader}{top}[\part]
131 \newcounter{lotheader}
132 \renewcommand{\thelotheader}{\Alph{lotheader}}
133
134 \titleformat{\lotheader}[block]
135 {\filcenter\huge}{\filcenter}{20pt}{\Huge}
136 \titlespacing*{\lotheader}{0pt}{-30pt}{40pt}
137
138 % Use the new header in TOC
139 \let\stdtoc=\tableofcontents
140 \let\stdchapter=\chapter
141 \def\tableofcontents{\let\chapter\lotheader \stdtoc{} \let\chapter\stdchapter}
142
143
144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
145
146 % From
147 % https://amyrhoda.wordpress.com/2012/06/04/latex-to-lulu-the-making-of-aosa-other-useful-packages-and-settings/
148
149 % The microtype package provides the ability to micromanage your
150 % typography. When invoked without any options it does some nice things
151 % like protruding punctuation over the edge of the right margin to make
152 % the margin appear smoother. Basically it makes your book look more
153 % professional with very little effort. It also has a ton of options if
154 % you want to micromanage even more.
155 \usepackage{microtype}
156
157 % By dafault, LaTeX will try and make all your pages the length that
158 % you set using the geometry setting. If a page has images, tables,
159 % headings or paragraph breaks which make it shorter than that page
160 % length, LaTeX will pad the page by adding whitespace between
161 % elements. We thought that looked sillier than having pages be
162 % different lengths, so we used the raggedbottom command.
163 \raggedbottom
164
165 % Hint for figure with empty title: remove the colon label separator
166 \usepackage{caption}
167 \captionsetup[figure]{labelsep=none}
168
169 % Fix the page number reset done by abstract by redefining it
170 % Patch from
171 % https://github.com/petterreinholdtsen/free-culture-lessig/pull/7
172
173 \def\nocount#1#2{}
174 \let\stdsetcounter\setcounter
175 \let\stdabstract=\abstract
176 \let\endstdabstract=\endabstract
177 \renewenvironment{abstract}{%
178 \let\setcounter\nocount%
179 \begin{stdabstract}%
180 \noindent%
181 \setlength\parskip{\medskipamount}%
182 \setlength\parindent{0pt}%
183 }{
184 \end{stdabstract}
185 \let\setcounter\stdsetcounter
186 }