errata
[phd-thesis.git] / preamble / layout.tex
1 % chktex-file 15
2 % chktex-file 9
3 % chktex-file 17
4 \usepackage{geometry}
5 \geometry{
6 inner=25mm,
7 outer=20mm,
8 marginparsep=3mm,
9 marginparwidth=13mm,
10 top=25mm,
11 bottom=20mm,
12 paperwidth=17cm,
13 paperheight=24cm,
14 }
15 \usepackage{pdflscape}
16
17 \usepackage{fancyhdr} % Custom headers and footers
18 \usepackage[fit]{truncate}
19 \pagestyle{fancy}
20 \fancyhead{}
21 \fancyfoot{}
22 \setlength{\unitlength}{18mm}
23 \newcommand{\blob}{{\color{gray}\rule[-.2\unitlength]{2\unitlength}{.5\unitlength}}}
24 \fancyhead[RE]{\truncate{.95\headwidth}{\rightmark}}
25 \fancyhead[LO]{\truncate{.95\headwidth}{\leftmark}}
26 \newcommand{\frontmatterfancy}[0]{
27 \fancyhead[RO]{\thepage}
28 \fancyhead[LE]{\thepage}
29 }
30 \newcommand{\mainmatterfancy}[0]{
31 \fancyhead[RO]{
32 \thepage%
33 \begin{picture}(0,0)
34 \put(1,-\value{chapter}){\blob}
35 \end{picture}
36 }
37 \fancyhead[LE]{
38 \begin{picture}(0,0)
39 \put(-3,-\value{chapter}){\blob}
40 \end{picture}%
41 \thepage%
42 }
43 }
44 \newcommand{\backmatterfancy}[0]{
45 \fancyhead[RO]{
46 \thepage%
47 \begin{picture}(0,0)
48 \put(1,-1){\blob}
49 \end{picture}
50 }
51 \fancyhead[LE]{
52 \begin{picture}(0,0)
53 \put(-3,-1){\blob}
54 \end{picture}%
55 \thepage%
56 }
57 }
58 \renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}
59 \renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
60 %\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\chaptername}\ \thechapter.\ #1}{}}
61 %\renewcommand{\headrulewidth}{0pt}
62 \renewcommand{\footrulewidth}{0pt}
63 \usepackage{etoolbox} % To patch the chapter command
64 % Have better page numbering in chapters
65 \patchcmd{\chapter}{plain}{headings}{}{}
66 \usepackage{epigraph} % Epigraph
67 \renewcommand\partname{Episode} % Rename parts to episodes (rhapsody uhu)
68 \addto\captionsbritish{\renewcommand{\partname}{Episode}}
69 \usepackage{titlesec}
70 \titleformat{\part}[block]
71 {\Huge}
72 {\partname~\thepart:}
73 {20pt}
74 {}
75
76 % This is required to make \nameref work (https://tex.stackexchange.com/questions/211035/problems-with-nameref-not-refering-to-the-correct-label-x-titlesec)
77 \makeatletter
78 \let\titlesec@part\part%
79 \renewcommand{\part}{\@ifstar\part@star\part@nostar}
80 \def\part@star#1{\NR@gettitle{#1}\titlesec@part*{#1}}
81 \def\part@nostar{\@ifnextchar[\part@nostar@opt\part@nostar@nopt}
82 \def\part@nostar@nopt#1{\NR@gettitle{#1}\titlesec@part{#1}}
83 \def\part@nostar@opt[#1]#2{\NR@gettitle{#1}\titlesec@part[#1]{#2}}
84 \makeatother
85
86 % Colored frames
87 \usepackage{framed}
88 \definecolor{lstbg}{gray}{.95}
89 \definecolor{shadecolor}{named}{lstbg}
90 \newenvironment{chapterabstract}{\begin{shaded}\begin{quotation}}{\end{quotation}\end{shaded}} %chktex 6
91
92 % Increase the depth for the table of contents
93 \renewcommand{\contentsname}{Table of Contents} % change the name of the TOC
94 \AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}} % to remove page numbering from the TOC
95
96 % Custom enumerations
97 \usepackage[inline,shortlabels]{enumitem}
98 \setlist{noitemsep}
99 \setlist[description]{leftmargin=\parindent}
100
101 % Custom floats
102 \usepackage{float}
103 \usepackage{newfloat}
104 \DeclareFloatingEnvironment[
105 fileext=loq,
106 listname={List of definitions},
107 name=Definition,
108 placement=tbp,
109 within=chapter,
110 chapterlistsgaps=on,
111 ]{equ}
112
113 % chapterappendices
114 \usepackage{appendix}