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