X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=preamble.tex;h=9efb9df73b49d2ab715027d53234391390848cf9;hb=61922d4f61677acca7e9b71295c055bc7e9618a9;hp=5c88b9847fed075f41876298abc8d6296dad4798;hpb=3ba49ccc26b390e05b5d81855ef7316ae3cda333;p=phd-thesis.git diff --git a/preamble.tex b/preamble.tex index 5c88b98..9efb9df 100644 --- a/preamble.tex +++ b/preamble.tex @@ -1,4 +1,27 @@ -\usepackage[ +% Fonts +\usepackage[utf8]{inputenc} % Input encoding +\usepackage[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{relsize} % \smaller command +\usepackage{atveryend} % \smaller command +\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, outer=20mm, marginparsep=3mm, @@ -6,47 +29,158 @@ top=25mm, bottom=20mm, paperwidth=17cm, - paperheight=24cm]{geometry} % Papersize - -\usepackage[british]{babel} % Internationalization -\usepackage[titletoc]{appendix} % Appendices -\usepackage[pagebackref,hidelinks]{hyperref} % Hyperlinks -\usepackage{graphicx} % Graphics -\usepackage{booktabs} % Better looking tables -\usepackage{etoolbox} % Patch chapter command -\usepackage[nodayofweek]{datetime} % Use a fixed document date -\usepackage{listings} % Code -\usepackage[acronym,nonumberlist]{glossaries} % Glossaries and acronyms -\usepackage[algochapter]{algorithm2e} % Pseudocode -\usepackage{makeidx} % Index -\usepackage[inline,shortlabels]{enumitem} % Customized enumerations -\setlist{noitemsep} -\setlist[description]{leftmargin=\parindent} -\usepackage{epigraph} + paperheight=24cm, +} +\usepackage{float} +\usepackage{fancyhdr} % Custom headers and footers +%\pagestyle{headings} +\pagestyle{fancy} +\fancyhead{} +\fancyfoot{} +\setlength{\unitlength}{18mm} +\newcommand{\blob}{\rule[-.2\unitlength]{2\unitlength}{.5\unitlength}} +\fancyhead[RE]{\rightmark} +\fancyhead[LO]{\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{Movement} % Rename parts to movements (rhapsody uhu) +\addto\captionsbritish{\renewcommand{\partname}{Movement}} +\usepackage{titlesec} +\makeatletter +\titleformat{\part}[block] + {\Huge} + {\partname~\thepart:} + {20pt} + {} -\usepackage[ - height={1.5cm}, - width={12mm}, - distance={1.55cm}, - topthumbmargin={auto}, - bottomthumbmargin={auto}, - eventxtindent={.5cm}, - oddtxtexdent={.3cm}]{thumbs} +\newenvironment{chapterabstract} + {\begin{quote}} + {\end{quote}} -\usepackage{lipsum} +% 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 -\usepackage{fancyhdr} -\pagestyle{fancy} +% (file) structure +\usepackage[subpreambles=true]{standalone} % standalone figures +\usepackage{morewrites} % fix no more room for a new \write +\usepackage{appendix} % subappendices, appendices per chapter -% Have better page numbering in chapters -\patchcmd{\chapter}{plain}{headings}{}{} +% Bibliography +\usepackage{bibentry} % Cite bib entry completely +\nobibliography* +\bibliographystyle{alpha} + +% 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} + +% Graphics +\usepackage{graphicx} % Images +\graphicspath{{img/},{introduction/img}} +\usepackage{caption} % subfigures +\usepackage{subcaption} +\newcommand{\orcid}[1]{\href{https://orcid.org/#1}{\hspace{1mm}\includegraphics[width=1em]{orcid}\hspace{2mm} https://orcid.org/#1}} -% Images directory -\graphicspath{{img/}} +% Tables +\usepackage{booktabs} % Nicer tables +\usepackage{multirow} % Multirow cells +\usepackage{tabularx} % Automatically wrapping tables +\usepackage{longtable} % Tables spanning pages +% Code +% Pseudocode +\usepackage[algochapter]{algorithm2e} +% Fix the algorithm font +\renewcommand\AlCapFnt{\normalfont} +\usepackage{listings} +% 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=L, + keepspaces=true, + keywordstyle=\bf, + postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, + showspaces=false, + showstringspaces=false, + showtabs=false, + stringstyle=\it, + tabsize=4, + upquote=true, +} +\usepackage{lstlangclean} +\usepackage{lstlanghaskell} +\usepackage{lstlanghaskelllhstex} +\usepackage{lstlangarduino} +\newcommand{\cinline}[1]{\lstinline[language=c,postbreak=]|#1|} +\newcommand{\arduinoinline}[1]{\lstinline[language={[Arduino]C++},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|} % Fix list of listings title \renewcommand{\lstlistlistingname}{List of Listings} - % Fix list of listings chapter separator \makeatletter \let\my@chapter\@chapter% @@ -55,16 +189,37 @@ \my@chapter} \makeatother -% Setup pdf parameters -\hypersetup{% - pdftitle={}, - pdfauthor={}, - pdfsubject={}, - pdfcreator={}, - pdfproducer={}, - pdfkeywords={}, -} +\lstnewenvironment{lstClean}[1][] + {% + \lstset{language=Clean, #1} + \renewcommand*{\lstlistingname}{Listing (\gls{CLEAN})} + } + {} +\lstnewenvironment{lstArduino}[1][] + {% + \lstset{language={[Arduino]C++}, #1} + \renewcommand*{\lstlistingname}{Listing (\gls{ARDUINO})} + } + {} +\lstnewenvironment{lstHaskell}[1][] + {% + \lstset{language=Haskell,style=haskell,#1}% + \renewcommand*{\lstlistingname}{Listing (\gls{HASKELL})} + } + {} +\lstnewenvironment{lstHaskellLhstex}[1][] + {% + \lstset{language=Haskell,style=haskelllhstex,#1}% + \renewcommand*{\lstlistingname}{Listing (\gls{HASKELL})} + } + {} +% Glossaries and acronyms +\usepackage[acronym,nonumberlist]{glossaries} +\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{}% @@ -81,39 +236,52 @@ \def\Acrfullpl#1{}% \def\gls#1{}% \def\glspl#1{}% + \def\glsentrytext#1{}% \def\Gls#1{}% \def\Glspl#1{}% + \def\Glsentrytext#1{}% + \def\titlecap#1{}% } -% General listings settings -\lstset{% - breakatwhitespace=false, - breaklines=true, - captionpos=b, - keepspaces=true, - basicstyle=\ttfamily\fontseries{l}\footnotesize, - commentstyle=\slshape\fontseries{m}, - keywordstyle=\bfseries\fontseries{b}, - stringstyle=\ttfamily, - showspaces=false, - showstringspaces=false, - showtabs=false, - tabsize=4, - frame=L, -} +% Index +%\usepackage{makeidx} +%\makeindex% Enable the index -% Increase the depth for the table of contenst -\setcounter{secnumdepth}{3} - -% Fix the algorithm font -\renewcommand\AlCapFnt{\normalfont} - -\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 enumerations +\usepackage[inline,shortlabels]{enumitem} +\setlist{noitemsep} +\setlist[description]{leftmargin=\parindent} % Initialize the glossaries \makeglossaries% \input{glossaries} -% Enable the index -\makeindex% +\usepackage{subfiles} + +\ifSubfilesClassLoaded{}{ + \usepackage{xmpincl} + \includexmp{CC_Attribution-NoDerivatives_4.0_International} +} + +% 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{\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}}