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