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