X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;ds=sidebyside;f=preamble.tex;h=c4a3c62278597056189a97c32269763a04847e45;hb=3044eec5a52dcd464ecfe502a521d09689f48f06;hp=a8baf2bce3a0d256d9771d3a2dc2b040ab4d8f85;hpb=c6fa9017e897e847334aeee2cec0b9aadec6f7c5;p=phd-thesis.git diff --git a/preamble.tex b/preamble.tex index a8baf2b..c4a3c62 100644 --- a/preamble.tex +++ b/preamble.tex @@ -1,252 +1,57 @@ -% Input encoding -\usepackage[utf8]{inputenc} - -% Papersize -\usepackage{geometry} -\geometry{ - inner=25mm, - outer=20mm, - marginparsep=3mm, - marginparwidth=13mm, - top=25mm, - bottom=20mm, - paperwidth=17cm, - paperheight=24cm, -} - -% Font encoding -\usepackage[T1,T2A]{fontenc} - -% Less bad boxes -\usepackage{microtype} - -% No more room for a new \write -\usepackage{morewrites} +\usepackage[utf8]{inputenc} % Input encoding +\usepackage[X2,T1]{fontenc} % Font encoding +\usepackage{ifxetex} +\ifxetex% + \usepackage{amsmath} % extra math + \usepackage{fontspec} + \usepackage{polyglossia} + \setmainlanguage[variant=british]{english} + \setotherlanguage{dutch} + \setotherlanguage{russian} + \newfontfamily{\cyrillicfont}{Liberation Serif} +\else + \usepackage{lmodern} % Nicer font + \usepackage{microtype} % Better kerning + \usepackage{amsmath} % extra math + \usepackage{amssymb} % extra math symbols + + \usepackage[dutch,russian,british]{babel} +% \babelfont[russian]{rm}{Liberation Serif} +\fi + +% Typography, widows, orphans, fonts +\input{preamble/typography} % Internationalisation -\usepackage[british]{babel} -%\babelfont[russian]{rm}{Liberation Serif} +\input{preamble/internationalisation} -% Appendices -% TODO is this necessary? -\usepackage[titletoc]{appendix} +% Papersize and layout +\input{preamble/layout} -% Hyperlinks -%\usepackage[pagebackref]{hyperref} -\usepackage[pagebackref]{hyperref} -% Setup pdf parameters: TODO -\hypersetup{% - pdftitle={\mytitle}, - pdfauthor={\myauthor}, - pdfsubject={}, -% pdfcreator={}, -% pdfproducer={}, - pdfkeywords={task oriented programming, functional programming, domain specific languages, internet of things}, - hidelinks, -} +% Tables +\input{preamble/table} -% Graphics -\usepackage{graphicx} -% Images directory -\graphicspath{{img/}} +% Listings +\input{preamble/listings} -% Nice tables -\usepackage{booktabs} +% Graphics +\input{preamble/graphics} -% Automatically wrapping tables -\usepackage{tabularx} +% Crossreferences, urls and hyperlinks +\input{preamble/crossref} -% Use a fixed document date -\usepackage[nodayofweek]{datetime} +% Bibliography +\input{preamble/bibliography} -% Code -\usepackage{stmaryrd} % Short arrow -\usepackage{listings} -% General listings settings -\lstset{% - basewidth=0.43em, - basicstyle=\linespread{0.9}\tt\footnotesize, - breakatwhitespace=false, - breaklines=true, - captionpos=b, - columns=[c]fixed, - commentstyle=\sl, - escapeinside={(+}{+)}, % chktex 9 - frame=L, - keepspaces=true, - keywordstyle=\bf, - postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, - showspaces=false, - showstringspaces=false, - showtabs=false, - stringstyle=\it, - tabsize=4, - literate=% - {~}{$\sim$}1 - {\\}{{$\lambda\:$}}1 - {->}{{$\shortrightarrow$}}2 - {<-}{{$\shortleftarrow$}}2 - {=>}{{$\Rightarrow$}}2 - {<=}{{$\Leftarrow$}}2 - {'}{{`}}1 - {...}{{$\cdots$}}1 %chktex 11 - {a0}{{a\textsubscript{0}}}2 - {a1}{{a\textsubscript{1}}}2 - {a2}{{a\textsubscript{2}}}2 -% {an}{{a\textsubscript{n}}}2 - {c0}{{c\textsubscript{0}}}2 - {c1}{{c\textsubscript{1}}}2 - {c2}{{c\textsubscript{2}}}2 - {cn}{{c\textsubscript{n}}}2 - {f0}{{f\textsubscript{0}}}2 - {f1}{{f\textsubscript{1}}}2 - {f2}{{f\textsubscript{2}}}2 - {fn}{{f\textsubscript{n}}}2 - {t0}{{t\textsubscript{0}}}2 - {t1}{{t\textsubscript{1}}}2 - {t2}{{t\textsubscript{2}}}2 - {tn}{{t\textsubscript{n}}}2 - {v0}{{v\textsubscript{0}}}2 - {v1}{{v\textsubscript{1}}}2 - {v2}{{v\textsubscript{2}}}2 - {vn}{{v\textsubscript{n}}}2 - {C0}{{C\textsubscript{0}}}2 - {C1}{{C\textsubscript{1}}}2 - {C2}{{C\textsubscript{2}}}2 - {Cn}{{C\textsubscript{n}}}2 - {R0}{{R\textsubscript{0}}}2 - {R1}{{R\textsubscript{1}}}2 - {R2}{{R\textsubscript{2}}}2 - {Rn}{{R\textsubscript{n}}}2 -} -\lstdefinestyle{haskell}{% - language=Haskell, - deletekeywords={True,False,Bool,Int,Float,Double,zip,length,Show,show,Num,Eq,print,String}, -} -\lstdefinelanguage{Clean}{% - alsoletter={ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_`1234567890}, - alsoletter={~!@\#$\%^\&*-+=?<>:|\\.}, - morekeywords={generic,implementation,definition,dynamic,module,import,from,where,in,of,case,let,infix,infixr,infixl,class,instance,with,if,derive,code,In,qualified,otherwise}, - sensitive=true, - morecomment=[l]{//}, - morecomment=[n]{/*}{*/}, - morestring=[b]", % chktex 18 - morestring=[s]{['}{']}, % chktex 9 -} -\newcommand{\cleaninline}[1]{\lstinline[language=Clean,postbreak=]|#1|} -\newcommand{\haskellinline}[1]{\lstinline[language=Haskell,style=haskell,postbreak=]|#1|} -% Fix list of listings title -\renewcommand{\lstlistlistingname}{List of Listings} -% Fix list of listings chapter separator -\makeatletter -\let\my@chapter\@chapter% -\renewcommand*{\@chapter}{% - \addtocontents{lol}{\protect\addvspace{10pt}}% - \my@chapter} -\makeatother -\lstnewenvironment{lstClean}[1][] - {% - \lstset{language=Clean, #1} - \renewcommand*{\lstlistingname}{Listing (Clean)} - } - {} -\lstnewenvironment{lstHaskell}[1][] - {% - \lstset{language=Haskell,style=haskell,#1}% - \renewcommand*{\lstlistingname}{Listing (Haskell)} - } - {} +% Custom commands +\input{preamble/commands} % Glossaries and acronyms -\usepackage[acronym,nonumberlist]{glossaries} -% Fix gls in hyperlink errors -\pdfstringdefDisableCommands{% - \def\acrlong#1{}% - \def\acrlongpl#1{}% - \def\acrshort#1{}% - \def\acrshortpl#1{}% - \def\acrfull#1{}% - \def\acrfullpl#1{}% - \def\Acrlong#1{}% - \def\Acrlongpl#1{}% - \def\Acrshort#1{}% - \def\Acrshortpl#1{}% - \def\Acrfull#1{}% - \def\Acrfullpl#1{}% - \def\gls#1{}% - \def\glspl#1{}% - \def\glsentrytext#1{}% - \def\Gls#1{}% - \def\Glspl#1{}% - \def\Glsentrytext#1{}% - \def\titlecap#1{}% -} - -% Titlecase commands -\usepackage{titlecaps} -\Addlcwords{of} -% Titlecase glossary command -\newcommand{\glst}[1]{\titlecap{\glsentrylong{#1}}} -\newcommand{\Glst}[1]{\glst{#1}} - -% Pseudocode -\usepackage[algochapter]{algorithm2e} -% Fix the algorithm font -\renewcommand\AlCapFnt{\normalfont} - -% Index -\usepackage{makeidx} -% Enable the index -\makeindex% +\input{preamble/glossaries} -% Custom enumerations -\usepackage[inline,shortlabels]{enumitem} -\setlist{noitemsep} -\setlist[description]{leftmargin=\parindent} +% File structure, this must be last of the preamble +\usepackage{subfiles} -% Epigraph (lovecraft) -\usepackage{epigraph} - -% Thumb marks on the page -\usepackage[ - height={1.5cm}, - width={12mm}, - distance={1.55cm}, - topthumbmargin={auto}, - bottomthumbmargin={auto}, - eventxtindent={.5cm}, - oddtxtexdent={.3cm}]{thumbs} - -% Custom headers and footers -\usepackage{fancyhdr} -\pagestyle{fancy} - -% Tables spanning pages -\usepackage{longtable} - -% Easy references -\usepackage{cleveref} - -% Diagrams -\usepackage{tikz} -\usetikzlibrary{pie} - -% To patch the chapter command -\usepackage{etoolbox} -% Have better page numbering in chapters -\patchcmd{\chapter}{plain}{headings}{}{} - -% Increase the depth for the table of contents -\setcounter{secnumdepth}{3} -\renewcommand{\contentsname}{Table of Contents} % change the name of the TOC -\AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}} % to remove page numbering from the TOC - -% Initialize the glossaries -\makeglossaries% -\input{glossaries} - -% Custom commands -\newcommand{\GHCmod}[1]{\texttt{#1}} -\newcommand{\requiresGHCmod}[1]{\footnote{Requires \GHCmod{#1} to be enabled.}} -\newcommand{\etc}{{\fontfamily{cmr}\selectfont{\itshape\/\&c}}} +% Metadata (only works in main document) and should go after subfiles +%\input{preamble/metadata}