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