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