1 \NeedsTeXFormat{LaTeX2e}
2 \ProvidesPackage{myclass}[]
4 %% Just use the original class and pass the options
5 \LoadClassWithOptions{report}
6 % report, book, memoir, scrreprt or scrbook ?
8 % Show frames, make it easier to debug borders
9 %\usepackage{showframe}% http://ctan.org/pkg/showframe
11 % Divide by 2 the index item indentation (10pt -> 5pt)
13 \renewcommand\@idxitem{\par\hangindent 20\p@}
14 \renewcommand\subitem{\@idxitem \hspace*{10\p@}}
15 \renewcommand\subsubitem{\@idxitem \hspace*{15\p@}}
18 % Put the index in the TOC
20 \let\stdindex=\theindex
21 \let\endstdindex=\endtheindex
22 \renewenvironment{theindex}{
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}
35 \addcontentsline{toc}{chapter}{\numberline{\thechapter}\indexname}
38 \addcontentsline{toc}{chapter}{\indexname}
41 % Adapt the vertical sizes to the smaller font
42 \setlength{\baselineskip}{0.7\baselineskip}%
43 \setlength{\parskip}{0.2\baselineskip}%
50 \newenvironment{colophon}{
52 % FIXME change when page size changes
53 % \fontsize{6.5}{7.8}\selectfont % fits in one 4.25x6.875" pocket size page
54 % \fontsize{7.5}{9}\selectfont % fits in one 5.06x7.71" size page
55 % \fontsize{9.1}{10.92}\selectfont % fits in one 5.5x8.5" digest size page
56 \fontsize{9.9}{11.88}\selectfont % fits in one 6x9'' size page
57 \setlength{\parskip}{0.5em} %
58 \setlength{\parindent}{0pt} %
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 % Based on ideas from https://bugs.debian.org/684772
67 % Useless with unnumbered sections (e.g. use of \setcounter{secnumdepth}{0})
70 \newcommand\makeletterof[1]{%
71 \ifthenelse{\equal{#1}{1}}{EN}{%
72 \ifthenelse{\equal{#1}{2}}{TO}{%
73 \ifthenelse{\equal{#1}{3}}{TRE}{%
74 \ifthenelse{\equal{#1}{4}}{FIRE}{%
75 \ifthenelse{\equal{#1}{5}}{FEM}{%
76 \ifthenelse{\equal{#1}{6}}{SEKS}{%
77 \ifthenelse{\equal{#1}{7}}{SJU}{%
78 \ifthenelse{\equal{#1}{8}}{ÅTTE}{%
79 \ifthenelse{\equal{#1}{9}}{NI}{%
80 \ifthenelse{\equal{#1}{10}}{TI}{%
81 \ifthenelse{\equal{#1}{11}}{ELLEVE}{%
82 \ifthenelse{\equal{#1}{12}}{TOLV}{%
85 % Make TOC entries without label
86 \titlecontents{chapter} %
88 {\addvspace{0.3em plus 0pt}\bfseries} %
89 {\hspace{-1.3em}} % no number, remove room reserved for it
91 {\hfill \contentspage} % dots and page number
94 \dottedcontents{section} %
98 {0.75em} % space between dots
101 %% Redefines the headings to remove the chapter label
102 \titleformat{\chapter}[block]
103 {\filcenter\Large}{\filcenter}{20pt}{\Large}
105 \titleformat{\section}
106 {\filcenter\Large\bfseries}{\thesection}{1em}{}
108 \titleformat{\subsection}
109 {\filcenter\large\bfseries}{\thesubsection}{1em}{}
111 %% New header, behaving like a chapter but formatted differently
112 \titleclass{\lotheader}{top}[\part]
113 \newcounter{lotheader}
114 \renewcommand{\thelotheader}{\Alph{lotheader}}
116 \titleformat{\lotheader}[block]
117 {\filcenter\huge}{\filcenter}{20pt}{\Huge}
118 \titlespacing*{\lotheader}{0pt}{-30pt}{40pt}
120 % Use the new header in TOC
121 \let\stdtoc=\tableofcontents
122 \let\stdchapter=\chapter
123 \def\tableofcontents{\let\chapter\lotheader \stdtoc{} \let\chapter\stdchapter}
126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
129 % https://amyrhoda.wordpress.com/2012/06/04/latex-to-lulu-the-making-of-aosa-other-useful-packages-and-settings/
131 % The microtype package provides the ability to micromanage your
132 % typography. When invoked without any options it does some nice things
133 % like protruding punctuation over the edge of the right margin to make
134 % the margin appear smoother. Basically it makes your book look more
135 % professional with very little effort. It also has a ton of options if
136 % you want to micromanage even more.
137 \usepackage{microtype}
139 % By dafault, LaTeX will try and make all your pages the length that
140 % you set using the geometry setting. If a page has images, tables,
141 % headings or paragraph breaks which make it shorter than that page
142 % length, LaTeX will pad the page by adding whitespace between
143 % elements. We thought that looked sillier than having pages be
144 % different lengths, so we used the raggedbottom command.
147 % Hint for figure with empty title: remove the colon label separator
149 \captionsetup[figure]{labelsep=none}
151 % Fix the page number reset done by abstract by redefining it
153 % https://github.com/petterreinholdtsen/free-culture-lessig/pull/7
156 \let\stdsetcounter\setcounter
157 \let\stdabstract=\abstract
158 \let\endstdabstract=\endabstract
159 \renewenvironment{abstract}{%
160 \let\setcounter\nocount%
163 \setlength\parskip{\medskipamount}%
164 \setlength\parindent{0pt}%
167 \let\setcounter\stdsetcounter