X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=preamble.tex;h=20ba25a98d872843f62f783fed0f2e756d9d47af;hb=40c364b9de5d27b8afedcfd83d76499acc9e31af;hp=49722c2ba04731cb57f3572add99f2861104700f;hpb=a944020914b1ddbe8286962e3ea50ee1d3fd7a45;p=phd-thesis.git diff --git a/preamble.tex b/preamble.tex index 49722c2..20ba25a 100644 --- a/preamble.tex +++ b/preamble.tex @@ -1,4 +1,33 @@ -% Papersize +% chktex-file 17 +% chktex-file 15 +% Fonts +\usepackage[utf8]{inputenc} % Input encoding +\usepackage[T2A,T1]{fontenc} % Font encoding +\usepackage{lmodern} % Nicer font +\usepackage{microtype} % Better kerning +\usepackage{tipa} % IPA symbols +\usepackage{stmaryrd} % short arrows +\usepackage{textcomp} % upquote +\usepackage{titlecaps} % titlecase commands +\usepackage{amsmath} % extra math +\usepackage{amssymb} % extra math symbols +\usepackage{wasysym} % circle symbols +\usepackage{relsize} % \smaller command +\usepackage{siunitx} % typeset units +\usepackage{xcolor} % colors +\usepackage{fnpct} % footnotekerning +\usepackage[all]{nowidow} % Kill widows and orphans +\DeclareSIUnit\noop{\relax} +\DeclareSIUnit\celcius{{}^{\circ}\kern-\scriptspace\mathsf{C}} +\everymath{\it\/} +\DeclareMathSymbol{\shortminus}{\mathbin}{AMSa}{"39} %chktex 18 + +% Internationalisation +\usepackage[dutch,russian,british]{babel} +\input{hyphenation} +%\babelfont[russian]{rm}{Liberation Serif} + +% Papersize and layout \usepackage{geometry} \geometry{ inner=25mm, @@ -10,63 +39,189 @@ paperwidth=17cm, paperheight=24cm, } +\usepackage{pdflscape} +\usepackage{float} +\usepackage{newfloat} +\DeclareFloatingEnvironment[ + fileext=loq, + listname={List of definitions}, + name=Definition, + placement=tbp, + within=chapter, + chapterlistsgaps=on, + ]{equ} +\usepackage{fancyhdr} % Custom headers and footers +\usepackage[fit]{truncate} +%\pagestyle{headings} +\pagestyle{fancy} +\fancyhead{} +\fancyfoot{} +\setlength{\unitlength}{18mm} +\newcommand{\blob}{{\color{gray}\rule[-.2\unitlength]{2\unitlength}{.5\unitlength}}} +\fancyhead[RE]{\truncate{.95\headwidth}{\rightmark}} +\fancyhead[LO]{\truncate{.95\headwidth}{\leftmark}} +\newcommand{\frontmatterfancy}[0]{ + \fancyhead[RO]{\thepage} + \fancyhead[LE]{\thepage} +} +\newcommand{\mainmatterfancy}[0]{ + \fancyhead[RO]{ + \thepage% + \begin{picture}(0,0) + \put(1,-\value{chapter}){\blob} + \end{picture} + } + \fancyhead[LE]{ + \begin{picture}(0,0) + \put(-3,-\value{chapter}){\blob} + \end{picture}% + \thepage% + } +} +\newcommand{\backmatterfancy}[0]{ + \fancyhead[RO]{ + \thepage% + \begin{picture}(0,0) + \put(1,-1){\blob} + \end{picture} + } + \fancyhead[LE]{ + \begin{picture}(0,0) + \put(-3,-1){\blob} + \end{picture}% + \thepage% + } +} +\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}} +\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}} +%\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\chaptername}\ \thechapter.\ #1}{}} +%\renewcommand{\headrulewidth}{0pt} +\renewcommand{\footrulewidth}{0pt} +\usepackage{etoolbox} % To patch the chapter command +% Have better page numbering in chapters +\patchcmd{\chapter}{plain}{headings}{}{} +\usepackage{epigraph} % Epigraph +\renewcommand\partname{Episode} % Rename parts to episodes (rhapsody uhu) +\addto\captionsbritish{\renewcommand{\partname}{Episode}} +\usepackage{titlesec} +\titleformat{\part}[block] + {\Huge} + {\partname~\thepart:} + {20pt} + {} +% This is required to make \nameref work (https://tex.stackexchange.com/questions/211035/problems-with-nameref-not-refering-to-the-correct-label-x-titlesec) +\makeatletter +\let\titlesec@part\part% +\renewcommand{\part}{\@ifstar\part@star\part@nostar} +\def\part@star#1{\NR@gettitle{#1}\titlesec@part*{#1}} +\def\part@nostar{\@ifnextchar[\part@nostar@opt\part@nostar@nopt} % chktex 9 +\def\part@nostar@nopt#1{\NR@gettitle{#1}\titlesec@part{#1}} +\def\part@nostar@opt[#1]#2{\NR@gettitle{#1}\titlesec@part[#1]{#2}} +\makeatother -% Font encoding -\usepackage[T1]{fontenc} - -% Internationalisation -\usepackage[british]{babel} - -% Appendices -% TODO is this necessary? -\usepackage[titletoc]{appendix} +\usepackage{framed} +\definecolor{lstbg}{gray}{.95} +\definecolor{shadecolor}{named}{lstbg} +\newenvironment{chapterabstract}{\begin{shaded}\begin{quotation}}{\end{quotation}\end{shaded}} %chktex 6 -% Hyperlinks -\usepackage{hyperref} -% Setup pdf parameters: TODO -\hypersetup{% - pdftitle={}, - pdfauthor={M. Lubbers}, - pdfsubject={}, -% pdfcreator={}, -% pdfproducer={}, - pdfkeywords={}, - pagebackref, - hidelinks, -} +% 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 -% Graphics -\usepackage{graphicx} -% Images directory -\graphicspath{{img/}} +% (file) structure +\usepackage[subpreambles=true]{standalone} % standalone figures +%\usepackage{morewrites} % fix no more room for a new \write +\usepackage{appendix} % subappendices, appendices per chapter -% Nice tables -\usepackage{booktabs} +% Bibliography +\usepackage[square]{natbib} % Cite bib entry completely +\setlength{\bibsep}{0.0pt} +%\def\bibfont{\small} +%\bibliographystyle{alpha} +\bibliographystyle{abbrvnat} +%\apptocmd{\thebibliography}{\raggedright}{}{} +\usepackage{bibentry} % Cite bib entry completely +\nobibliography* +\newcommand{\citeentry}[1]{\begin{NoHyper}\bibentry{#1}\end{NoHyper}. \citep{#1}} +\newcommand{\refurl}[2]{\url{#1}, accessed on: #2} -% Automatically wrapping tables -\usepackage{tabularx} +\makeatletter +\newcommand{\citepage}[1]{p.~#1} +\newcommand{\citepages}[1]{pp.~#1} +\newcommand{\citechapter}[1]{\cref@chapter@name~#1} +\newcommand{\citechapters}[1]{\cref@chapter@name@plural~#1} +\newcommand{\citesection}[1]{\cref@section@name~#1} +\newcommand{\citesections}[1]{\cref@section@name@plural~#1} +%\newcommand{\citesection}[1]{\S.~#1} +%\newcommand{\citesections}[1]{\S\S.~#1} +\newcommand{\citeparagraph}[1]{\P.~#1} +\newcommand{\citeparagraphs}[1]{\P\P.~#1} +\newcommand{\citelisting}[1]{\cref@listing@name~#1} +\makeatother -% Use a fixed document date -\usepackage[nodayofweek]{datetime} +% Tables +\usepackage{booktabs} % Nicer tables +\usepackage{multirow} % Multirow cells +\usepackage{tabularx} % Automatically wrapping tables +\usepackage{longtable} % Tables spanning pages +\usepackage{threeparttable} % Tables with footnotes % Code +% Pseudocode +\usepackage[algochapter,linesnumbered,lined,boxed]{algorithm2e} +% Fix the algorithm font +\renewcommand\AlCapFnt{\normalfont} \usepackage{listings} +\newcounter{tmp} +% https://tex.stackexchange.com/questions/149056/how-can-i-define-additional-literate-replacements-without-deleting-existing-ones +\makeatletter +\def\addToLiterate#1{\edef\lst@literate{\unexpanded\expandafter{\lst@literate}\unexpanded{#1}}} +\lst@Key{moreliterate}{}{\addToLiterate{#1}} +\makeatother % General listings settings \lstset{% + basewidth=0.5em, + basicstyle=\tt\small, breakatwhitespace=false, breaklines=true, captionpos=b, + columns=[c]fixed, + commentstyle=\sl, + escapeinside={[+}{+]}, % chktex 9 + frame=, + backgroundcolor=\color{lstbg}, keepspaces=true, - basicstyle=\ttfamily\fontseries{l}\footnotesize, - commentstyle=\slshape\fontseries{m}, - keywordstyle=\bfseries\fontseries{b}, - stringstyle=\ttfamily, + keywordstyle=\bf, + postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, showspaces=false, showstringspaces=false, showtabs=false, + stringstyle=\it, tabsize=4, - frame=L, + upquote=true, + numberstyle=\tiny, } +\usepackage{lstlangclean} +\usepackage{lstlanghaskell} +\usepackage{lstlangarduino} +\lstloadlanguages{% + {[Arduino]C++},% + {c},% + {Python},% + {Clean},% + {[Regular]Haskell}, + {[Lhs2Tex]Haskell}} +\newcommand{\cinline}[1]{\lstinline[language=c,postbreak=]|#1|} +\newcommand{\arduinoinline}[1]{\lstinline[language={[Arduino]C++},postbreak=]|#1|} +\newcommand{\pythoninline}[1]{\lstinline[language=Python,postbreak=]|#1|} +\newcommand{\cleaninline}[1]{\lstinline[language=Clean,postbreak=]|#1|} +\newcommand{\cleaninputlisting}[2][]{\renewcommand*{\lstlistingname}{Listing (\gls{CLEAN})}\lstinputlisting[escapeinside={/*}{*/},language=Clean,#1]{\subfix{#2}}} +\newcommand{\haskellinline}[1]{\lstinline[language={[Regular]Haskell},postbreak=]|#1|} +\newcommand{\haskellinputlisting}[2][]{\renewcommand*{\lstlistingname}{Listing (\gls{HASKELL})}\lstinputlisting[language={[Regular]Haskell},#1]{\subfix{#2}}} +\newcommand{\haskelllhstexinline}[1]{\lstinline[language={[Lhs2Tex]Haskell},postbreak=]|#1|} +%For storing listings in footnotes +\newsavebox{\LstBox} % Fix list of listings title \renewcommand{\lstlistlistingname}{List of Listings} % Fix list of listings chapter separator @@ -77,78 +232,150 @@ \my@chapter} \makeatother +\lstnewenvironment{lstPython}[1][] + {% + \lstset{language=Python, #1} + \renewcommand*{\lstlistingname}{Listing (\gls{PYTHON})} + } + {} +\lstnewenvironment{lstClean}[1][] + {% + \lstset{language=Clean, #1} + \renewcommand*{\lstlistingname}{Listing (\gls{CLEAN})} + } + {} +\lstnewenvironment{lstArduino}[1][] + {% + \lstset{language={[Arduino]C++}, #1} + \renewcommand*{\lstlistingname}{Listing (\gls{CPP})} + } + {} +\lstnewenvironment{lstHaskell}[1][] + {% + \lstset{language={[Regular]Haskell},#1}% + \renewcommand*{\lstlistingname}{Listing (\gls{HASKELL})} + } + {} +\lstnewenvironment{lstHaskellLhstex}[1][] + {% + \lstset{language={[Lhs2Tex]Haskell},#1}% + \renewcommand*{\lstlistingname}{Listing (\gls{HASKELL})} + } + {} + +% Graphics +\usepackage{graphicx} % Images +\graphicspath{{img/},{intro/img},{top/img},{tvt/img}} +\usepackage{caption} % subfigures/captionof +\usepackage{subcaption} +\usepackage{rotating} +\newcommand{\orcid}[1]{\href{https://orcid.org/#1}{\hspace{1mm}\includegraphics[width=1em]{orcid}\hspace{2mm} https://orcid.org/#1}} +\usepackage{tikz} + +% Index +%\usepackage{makeidx} +%\makeindex% Enable the index + +% Custom enumerations +\usepackage[inline,shortlabels]{enumitem} +\setlist{noitemsep} +\setlist[description]{leftmargin=\parindent} + +% Hyperlinks and metadata +\usepackage[hyphens]{url} +\usepackage[pdflang={en-GB},pagebackref,breaklinks]{hyperref} % hyperlinks +\usepackage{xr} % hyperlinks +\renewcommand*{\backref}[1]{} +\renewcommand*{\backrefalt}[4]{[{% + \ifcase #1 not cited.\or p.~#2.\else pp. #2.\fi%chktex 1 +}]} +\hypersetup{% + pdftitle={\mytitle}, + pdfauthor={\myauthor}, + pdfkeywords={task-oriented programming, functional programming, domain specific languages, internet of things}, + hidelinks, +} +\usepackage[nodayofweek]{datetime} % Use a fixed document date +\urlstyle{same} +\usepackage{bookmark} +\usepackage[noabbrev]{cleveref} % Easy references +\usepackage{crossreftools} % Easy references +\crefname{equ}{equation}{equations} +\crefname{part}{episode}{episodes} +\crefname{lstlisting}{listing}{listings} +\crefname{equ}{definition}{definition} +\usepackage{nameref} % to reference names of chapters +\newcommand{\fullref}[1]{\crtcref{#1}: \nameref{#1}} +\newcommand{\Fullref}[1]{\crtCref{#1}: \nameref{#1}} +\creflabelformat{equation}{#2\textup{#1}#3} + % Glossaries and acronyms -\usepackage[acronym,nonumberlist]{glossaries} -% Fix gls in hyperlink errors +\usepackage[nolangwarn,abbreviations,nonumberlist,prefix]{glossaries-extra} +\setabbreviationstyle{long-short} +\setabbreviationstyle[noexpand]{short-nolong} +\Addlcwords{of} +\usepackage{glossary-mcols} \pdfstringdefDisableCommands{% - \def\acrlong#1{}% - \def\acrlongpl#1{}% - \def\acrshort#1{}% - \def\acrshortpl#1{}% + \def\glsxtrlong#1{}% + \def\glsxtrlongpl#1{}% + \def\glsxtrshort#1{}% + \def\glsxtrshortpl#1{}% \def\acrfull#1{}% \def\acrfullpl#1{}% - \def\Acrlong#1{}% - \def\Acrlongpl#1{}% - \def\Acrshort#1{}% - \def\Acrshortpl#1{}% + \def\Glsxtrlong#1{}% + \def\Glsxtrlongpl#1{}% + \def\Glsxtrshort#1{}% + \def\Glsxtrshortpl#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{}% + \def\MakeUppercase#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% - -% Custom enumerations -\usepackage[inline,shortlabels]{enumitem} -\setlist{noitemsep} -\setlist[description]{leftmargin=\parindent} +% Initialize the glossaries +\makeglossaries% +\input{glossaries} -% 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} +\usepackage{subfiles} -% To patch the chapter command -\usepackage{etoolbox} -% Have better page numbering in chapters -\patchcmd{\chapter}{plain}{headings}{}{} +\ifSubfilesClassLoaded{}{ + \usepackage{xmpincl} + \includexmp{CC_Attribution-NoDerivatives_4.0_International} +} -% 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 +% Custom commands +\newcommand{\GHCmod}[1]{\texttt{#1}} +\newcommand{\aramsingh}{Ramsingh, A.\ (University of Glasgow)} +\newcommand{\dcolon}[0]{\mathbin{::}} +\newcommand{\doifmt}[1]{\href{https://doi.org/#1}{#1}} +\newcommand{\etc}{{\fontfamily{cmr}\selectfont{\itshape\/\&\kern-0.2em c}}} +\newcommand{\jsinger}{Singer, dr.\ J.\ (University of Glasgow)} +\newcommand{\mlubbers}{Lubbers, M.\ (Radboud University)} +\newcommand{\pkoopman}{Koopman, dr.\ P.\ (Radboud University)} +\newcommand{\ptrinder}{Trinder, prof.~dr.\ P.\ (University of Glasgow)} +\newcommand{\rdmentry}[5]{#1 (#2): #3. #4.\ \doifmt{#5}} +\newcommand{\rewriterate}[2]{\langle{}#1, #2\rangle{}} +\newcommand{\requiresGHCmod}[2][]{\footnote{Requires \GHCmod{#2} to be enabled. #1}} +\newcommand{\rplasmeijer}{Plasmeijer, prof.\ dr.\ ir.\ R.\ (Radboud University)} +\newcommand{\erasmusplus}{ERASMUS\raisebox{.25ex}{+}} +\newcommand{\imtask}{\gls{ITASK}\slash\gls{MTASK}} +\newcommand{\Imtask}{\Gls{ITASK}\slash\gls{MTASK}} +\newcommand{\citask}{\gls{CLEAN}\slash\gls{ITASK}} +\newcommand{\Citask}{\Gls{CLEAN}\slash\gls{ITASK}} +\newcommand{\cimtask}{\gls{CLEAN}\slash\gls{ITASK}\slash\gls{MTASK}} +\newcommand{\Cimtask}{\Gls{CLEAN}\slash\gls{ITASK}\slash\gls{MTASK}} +\newcommand{\ccpp}{\gls{C}\slash\gls{CPP}} +\newcommand{\Ccpp}{\Gls{C}\slash\gls{CPP}} +\newcommand{\stacksize}[1]{\parallel#1\parallel} -% Initialize the glossaries -\makeglossaries% -\input{glossaries} +\makeatletter +\newenvironment{compilationscheme} + {\allowdisplaybreaks\startalign} + {\endalign} +\makeatother