9.3 KiB
Setup file
- Babel
- Figures
- Captions
- Glossary
- Lists
- Spacing
- Tables
- Units
- Mathematics
- Geometry
- Penalties
- Headers
- Section/Figure format
- Floating images configuration
- Etoolbox package
- Hyperref and Bookmarks
- Bibliography
- Table of Contents for each chapter
- Fonts
- Colors
- CS Quotes
- Setspace for controlling line spacing
- Parskip
- Possible Equation improvements
- Minted
- Scrhack
- Background cover page
Babel
\usepackage[french,english]{babel}
Figures
\usepackage{graphicx}
\graphicspath{{figs/}}
Captions
\usepackage{subcaption}
\captionsetup{subrefformat=parens}
Glossary
\usepackage[ %
acronym, % Separate acronyms and glossary
toc, % appear in ToC
automake, % auto-use the makeglossaries command (requires shell-escape)
nonumberlist, % don't back reference pages
nogroupskip, % don't group by letter
nopostdot % don't add a dot at the end of each element
]{glossaries}
\usepackage[stylemods=longextra]{glossaries-extra}
\setabbreviationstyle[acronym]{long-short}
\setglossarystyle{long-name-desc}
\makeindex
\makeglossaries
Lists
Do not modify itemize/enumerate environments by default
\usepackage[olditem,oldenum]{paralist}
Spacing
\RequirePackage{setspace}
\onehalfspacing
Tables
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{tabularx}
I reduce the size of tables so that longer tables can still fit into an A4 (reduce font and make sans serif).
\usepackage{floatrow}
\floatsetup[table]{font={footnotesize,sf},capposition=top}
Units
\usepackage[binary-units=true]{siunitx}
\sisetup{%
detect-all = true,
detect-family = true,
detect-mode = true,
detect-shape = true,
detect-weight = true,
detect-inline-weight = math,
}
\DeclareSIUnit\px{px}
\DeclareSIUnit\rms{rms}
Mathematics
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{dsfont}
Fix the spacing of \left
and \right
.
Use these with the proper bracket in order to ensure that they scale automatically.
\let\originalleft\left
\let\originalright\right
\renewcommand{\left}{\mathopen{}\mathclose\bgroup\originalleft}
\renewcommand{\right}{\aftergroup\egroup\originalright}
Geometry
Penalties
\clubpenalty = 10000
\widowpenalty = 10000
\displaywidowpenalty = 10000
Headers
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
Section/Figure format
\renewcommand{\partformat}{\huge\partname~\thepart\autodot}
\renewcommand{\raggedpart}{\flushleft}
\setkomafont{part}{\normalfont\huge\scshape}
\setkomafont{sectioning}{\normalfont\scshape}
\setkomafont{descriptionlabel}{\normalfont\bfseries}
\setkomafont{caption}{\small}
\setkomafont{captionlabel}{\usekomafont{caption}}
\setcounter{secnumdepth}{\subsubsectionnumdepth}
Improve chapter font colors and font size. The following commands make chapter numbers BrickRed.
\makeatletter
\renewcommand*{\chapterformat}{ \mbox{\chapappifchapterprefix{\nobreakspace}{\color{BrickRed}\fontsize{40}{45}\selectfont\thechapter}\autodot\enskip}}
% Section with color
% \renewcommand\@seccntformat[1]{\color{BrickRed} {\csname the#1\endcsname}\hspace{0.3em}}
\renewcommand\@seccntformat[1]{{\csname the#1\endcsname}\hspace{0.3em}}
\makeatother
Floating images configuration
By default, if a figure consumes 60% of the page it will get its own float-page.
To change that we have to adjust the value of the floatpagefraction
derivative.
\renewcommand{\floatpagefraction}{.8}%
See more information here.
Etoolbox package
\usepackage{etoolbox}
Hyperref and Bookmarks
\usepackage[ %
colorlinks=true, %
citecolor=BrickRed, %
linkcolor=BrickRed, %
urlcolor=BrickRed, %
unicode %
]{hyperref}
The bookmark package implements a new bookmark (outline) organisation for package hyperref. This lets us change the "tree-navigation" associated with the generated pdf and constrain the menu only to H:2.
\usepackage{bookmark}
\bookmarksetup{depth=2}
Bibliography
\usepackage{xpatch} % Recommanded for biblatex
\usepackage[ % use biblatex for bibliography
backend=biber, % use biber backend (bibtex replacement) or bibtex
style=ieee, % bib style
hyperref=true, % activate hyperref support
backref=true, % activate backrefs
isbn=false, % don't show isbn tags
url=false, % don't show url tags
doi=false, % don't show doi tags
urldate=long, % display type for dates
maxnames=3, %
minnames=1, %
maxbibnames=5, %
minbibnames=3, %
maxcitenames=2, %
mincitenames=1 %
]{biblatex}
\defbibenvironment{mypubs}
{\list
{}
{\setlength{\leftmargin}{\bibhang}%
\setlength{\itemindent}{-\leftmargin}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}}
{\endlist}
{\item}
Remove ISSN, DOI and URL to shorten the bibliography.
\AtEveryBibitem{%
\clearfield{urlyear}
\clearfield{urlmonth}
\clearfield{note}
\clearfield{issn} % Remove issn
\clearfield{doi} % Remove doi
\ifentrytype{online}{}{% Remove url except for @online
\clearfield{url}
}
}
And increase the spacing between the entries, as per default they are too small.
\setlength\bibitemsep{1.1\itemsep}
Also reduce the font-size
\renewcommand*{\bibfont}{\footnotesize}
Table of Contents for each chapter
Note that this is marked as deprecated for koma-script.
\usepackage{minitoc}
% Change section font
\renewcommand{\mtcSfont}{\small}
% Change indentation
\setlength{\mtcindent}{0pt}
% \usepackage[nottoc]{tocbibind}
Fonts
https://tug.org/FontCatalogue/quattrocento/
\usepackage[lf]{ebgaramond}
https://tug.org/FontCatalogue/crimsonproregular/
% \usepackage{crimson}
https://tug.org/FontCatalogue/sourcecodepro/
\usepackage[oldstyle, scale=0.7]{sourcecodepro}
Colors
\usepackage[usenames,dvipsnames]{xcolor}
CS Quotes
The csquotes package offers context sensitive quotation facilities, improving the typesetting of inline quotes.
\usepackage{csquotes}
To enclose quote environments with quotes from csquotes, see the following TeX SE thread.
\def\signed #1{{\leavevmode\unskip\nobreak\hfil\penalty50\hskip1em
\hbox{}\nobreak\hfill #1%
\parfillskip=0pt \finalhyphendemerits=0 \endgraf}}
\newsavebox\mybox
\newenvironment{aquote}[1]
{\savebox\mybox{#1}\begin{quote}\openautoquote\hspace*{-.7ex}}
{\unskip\closeautoquote\vspace*{1mm}\signed{\usebox\mybox}\end{quote}}
And then use quotes as:
# The options derivative adds text after the environment. We use it to add the author. #+ATTR_LATEX: :options {\cite{Frahm1994}} #+begin_aquote /Current (fMRI) applications often rely on "effects" or "statistically significant differences", rather than on a proper analysis of the relationship between neuronal activity, haemodynamic consequences, and MRI physics./ #+end_aquote
Note that org-ref links won't work here because the attr latex will be pasted as-is in the .tex file.
Setspace for controlling line spacing
\usepackage{setspace}
\setstretch{1.25}
Parskip
Fine tuning of spacing between paragraphs. See thread here.
\setparsizes{0em}{0.1\baselineskip plus .1\baselineskip}{1em plus 1fil}
Possible Equation improvements
Make the equation numbers follow the chapter, not the whole thesis.
\numberwithin{equation}{chapter}
Minted
The minted package is used for highlighting source code.
\usepackage{listings}
\usepackage{minted}
\setminted{autogobble=true,fontsize=\small,baselinestretch=0.8}
\setminted[python]{python3=true,tabsize=4}
\usemintedstyle{trac}
\lstset{abovecaptionskip=0}
\renewcommand{\listingscaption}{Code Snippet}
And reduce the distance between a minted listing and its caption.
\AtEndEnvironment{listing}{\vspace{-16pt}}
Scrhack
This package fixes some incompatibility errors between KOMAScript and other packages (namely minted). It has to be loaded at the end.
\usepackage{scrhack}
Background cover page
Add the cover image as background to the first page. Only do so when outputting a final version, because it significantly slows down the compilation times.
\usepackage[pages=some]{background}
\backgroundsetup{
scale=1,
color=black,
opacity=0.9,
angle=0,
contents={%
\includegraphics[width=\paperwidth,height=\paperheight]{/Users/user/Desktop/TectonicPlatesXVI.png}
}%
}