X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=preamble.tex;h=984b7fa24b0c15aeb0e8fe04f53060b6d208c53d;hb=0c4686b70dcb071a6537cdb52beb6bf4183334a1;hp=9efb9df73b49d2ab715027d53234391390848cf9;hpb=61922d4f61677acca7e9b71295c055bc7e9618a9;p=phd-thesis.git diff --git a/preamble.tex b/preamble.tex index 9efb9df..984b7fa 100644 --- a/preamble.tex +++ b/preamble.tex @@ -1,6 +1,8 @@ +% chktex-file 17 +% chktex-file 15 % Fonts \usepackage[utf8]{inputenc} % Input encoding -\usepackage[T1]{fontenc} % Font encoding +\usepackage[T2A,T1]{fontenc} % Font encoding \usepackage{lmodern} % Nicer font \usepackage{microtype} % Better kerning \usepackage{tipa} % IPA symbols @@ -10,9 +12,13 @@ \usepackage{amsmath} % extra math \usepackage{amssymb} % extra math symbols \usepackage{relsize} % \smaller command -\usepackage{atveryend} % \smaller command +\usepackage{siunitx} % typeset units +\usepackage{xcolor} % colors +\DeclareSIUnit\noop{\relax} +\DeclareSIUnit\celcius{{}^{\circ}\kern-\scriptspace\mathsf{C}} \everymath{\it\/} \DeclareMathSymbol{\shortminus}{\mathbin}{AMSa}{"39} %chktex 18 +\newcommand{\dcolon}[0]{\mathbin{::}} % Internationalisation \usepackage[dutch,russian,british]{babel} @@ -31,6 +37,7 @@ paperwidth=17cm, paperheight=24cm, } +\usepackage{pdflscape} \usepackage{float} \usepackage{fancyhdr} % Custom headers and footers %\pagestyle{headings} @@ -38,7 +45,7 @@ \fancyhead{} \fancyfoot{} \setlength{\unitlength}{18mm} -\newcommand{\blob}{\rule[-.2\unitlength]{2\unitlength}{.5\unitlength}} +\newcommand{\blob}{{\color{gray}\rule[-.2\unitlength]{2\unitlength}{.5\unitlength}}} \fancyhead[RE]{\rightmark} \fancyhead[LO]{\leftmark} \newcommand{\frontmatterfancy}[0]{ @@ -85,16 +92,21 @@ \renewcommand\partname{Movement} % Rename parts to movements (rhapsody uhu) \addto\captionsbritish{\renewcommand{\partname}{Movement}} \usepackage{titlesec} -\makeatletter \titleformat{\part}[block] {\Huge} {\partname~\thepart:} {20pt} {} - -\newenvironment{chapterabstract} - {\begin{quote}} - {\end{quote}} +% 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 +\newenvironment{chapterabstract}{\begin{quotation}}{\end{quotation}} % Increase the depth for the table of contents \setcounter{secnumdepth}{3} @@ -103,45 +115,48 @@ % (file) structure \usepackage[subpreambles=true]{standalone} % standalone figures -\usepackage{morewrites} % fix no more room for a new \write +%\usepackage{morewrites} % fix no more room for a new \write \usepackage{appendix} % subappendices, appendices per chapter % Bibliography +\usepackage{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* -\bibliographystyle{alpha} +\newcommand{\citeentry}[1]{\begin{NoHyper}\bibentry{#1}\end{NoHyper}. \citep{#1}} -% Hyperlinks and metadata -\usepackage[pagebackref]{hyperref} % 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{cleveref} % Easy references -\crefname{part}{movement}{movements} -\crefname{lstlisting}{listing}{listing} +\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} +\makeatother % Graphics \usepackage{graphicx} % Images -\graphicspath{{img/},{introduction/img}} +\graphicspath{{img/},{intro/img},{top/img},{tvt/img}} \usepackage{caption} % subfigures \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} % 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 @@ -149,6 +164,11 @@ % Fix the algorithm font \renewcommand\AlCapFnt{\normalfont} \usepackage{listings} +% 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, @@ -158,7 +178,7 @@ captionpos=b, columns=[c]fixed, commentstyle=\sl, -% escapeinside={(+}{+)}, % chktex 9 + escapeinside={[+}{+]}, % chktex 9 frame=L, keepspaces=true, keywordstyle=\bf, @@ -169,16 +189,26 @@ stringstyle=\it, tabsize=4, upquote=true, + numberstyle=\tiny, } \usepackage{lstlangclean} \usepackage{lstlanghaskell} -\usepackage{lstlanghaskelllhstex} \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{\haskellinline}[1]{\lstinline[language=Haskell,style=haskell,postbreak=]|#1|} -\newcommand{\haskelllhstexinline}[1]{\lstinline[language=Haskell,style=haskelllhstex,postbreak=]|#1|} +\newcommand{\haskellinline}[1]{\lstinline[language={[Regular]Haskell},postbreak=]|#1|} +\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 @@ -189,6 +219,12 @@ \my@chapter} \makeatother +\lstnewenvironment{lstPython}[1][] + {% + \lstset{language=Python, #1} + \renewcommand*{\lstlistingname}{Listing (\gls{PYTHON})} + } + {} \lstnewenvironment{lstClean}[1][] {% \lstset{language=Clean, #1} @@ -203,35 +239,57 @@ {} \lstnewenvironment{lstHaskell}[1][] {% - \lstset{language=Haskell,style=haskell,#1}% + \lstset{language={[Regular]Haskell},#1}% \renewcommand*{\lstlistingname}{Listing (\gls{HASKELL})} } {} \lstnewenvironment{lstHaskellLhstex}[1][] {% - \lstset{language=Haskell,style=haskelllhstex,#1}% + \lstset{language={[Lhs2Tex]Haskell},#1}% \renewcommand*{\lstlistingname}{Listing (\gls{HASKELL})} } {} +% Hyperlinks and metadata +\usepackage[pdflang={en-GB},pagebackref]{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 +\crefname{part}{movement}{movements} +\crefname{lstlisting}{listing}{listings} +\usepackage{nameref} % to reference names of chapters +\newcommand{\fullref}[1]{\Cref{#1}: \nameref{#1}} + % Glossaries and acronyms -\usepackage[acronym,nonumberlist]{glossaries} +\usepackage[nolangwarn,acronym,nonumberlist]{glossaries-extra} \Addlcwords{of} % Titlecase glossary commands \newcommand{\glst}[1]{\titlecap{\glsentrylong{#1}}} \newcommand{\Glst}[1]{\glst{#1}} % Fix gls in hyperlink errors \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{}% @@ -242,6 +300,7 @@ \def\Glsentrytext#1{}% \def\titlecap#1{}% } +\usepackage{glossary-mcols} % Index %\usepackage{makeidx} @@ -265,23 +324,15 @@ % Custom commands \newcommand{\GHCmod}[1]{\texttt{#1}} -\newcommand{\requiresGHCmod}[1]{\footnote{Requires \GHCmod{#1} to be enabled.}} -\newcommand{\etc}{{\fontfamily{cmr}\selectfont{\itshape\/\&c}}} +\newcommand{\requiresGHCmod}[2][]{\footnote{Requires \GHCmod{#2} to be enabled. #1}} +%\newcommand{\etc}{{\fontfamily{cmr}\selectfont{\itshape\/\&c}}} +\newcommand{\etc}{{\fontfamily{cmr}\selectfont{\itshape\/\&\kern-0.2em c}}} \newcommand{\rdmentry}[6]{#1: #2 (#3): #4. #5.\ \href{https://doi.org/#6}{#6}} \newcommand{\mlubbers}{Lubbers, M.\ (Radboud University)} \newcommand{\pkoopman}{Koopman, dr.\ P.\ (Radboud University)} \newcommand{\rplasmeijer}{Plasmeijer, prof.\ dr.\ ir.\ R.\ (Radboud University)} -\newcommand{\mychapter}[2]{ - \chapter{#2}% - \label{#1}% -} -\newcommand{\myappendix}[2]{ - \chapter{#2}% - \label{#1}% -} -\newcommand{\mybackmatter}[2]{ - \chapter{#2}% - \label{#1}% +\newcommand{\mypart}[3]{ + \part[#2: #3]{#2\\[2ex]\smaller{}#3}% + \label{#1} } -\newcommand{\mypart}[3]{\part[#2: #3]{#2\\[2ex]\smaller{}#3}\label{#1}}