%!TEX program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[parskip=half,
               fontsize=9pt,
               % chapterprefix=true,
               numbers=noenddot,
               bibliography=totoc]{scrbook}

% Golden ratio proportions on crown quarto with marginpar inside
\usepackage[includemp,
            paperwidth=18.90cm,
            paperheight=24.58cm,
            top=2.170cm,
            bottom=3.510cm,
            inner=2.1835cm,
            outer=2.1835cm,
            marginparwidth=4cm, % Fixed for now
            marginparsep=0.4cm]{geometry}

% For full bleed printing on crown quarto with 1/8 inch trim margin
% \usepackage[includemp,
%             paperwidth=19.54cm,
%             paperheight=25.22cm,
%             % showframe,
%             layoutwidth=18.90cm,
%             layoutheight=24.58cm,
%             layouthoffset=0.32cm,
%             layoutvoffset=0.32cm,
%             top=2.170cm,
%             bottom=3.510cm,
%             inner=2.1835cm,
%             outer=2.1835cm,
%             marginparwidth=4cm, % Fixed for now
%             marginparsep=0.4cm]{geometry}

% For printing on A4
% \usepackage[includemp,
%             a4paper,
%             layoutwidth=18.90cm,
%             layoutheight=24.58cm,
%             layouthoffset=1.05cm,
%             layoutvoffset=2.56cm,
%             top=2.170cm,
%             bottom=3.510cm,
%             inner=1.668cm,
%             outer=2.699cm,
%             marginparwidth=4cm, % Fixed for now
%             marginparsep=0.4cm]{geometry}

\usepackage{tocloft}                % Customise table of contents
\usepackage{amsmath,amssymb}        % AMS symbols and environments
\usepackage{mathtools}              % More math symbols and environments
\usepackage{fontspec}               % Selecting fonts
\usepackage{unicode-math}           % Use unicode math font, not TeX
\usepackage[main=english,dutch,spanish]{babel}         % Correct hyphenation
\usepackage{subfig}                 % Subfigures
\usepackage{booktabs}               % Nicer tables
\usepackage{xcolor}                 % Colours in text
\usepackage{etoolbox}               % Easy programming to modify TeX stuff
\usepackage{ccicons}                % Creative Commons icons
\usepackage{pdfpages}               % Insert PDF pages
\definecolor{greenforlinks}{rgb}{0.09, 0.45, 0.27}
\PassOptionsToPackage{hyphens}{url}\usepackage[xetex,
            unicode,
            breaklinks=true,
            colorlinks=true,
            allcolors=greenforlinks,
            pagebackref,
            linktoc=all,
            pdftitle={Higher-dimensional modelling of geographic information},
            pdfauthor={Ken Arroyo Ohori}]{hyperref}  % Hyperlinks
\usepackage{bookmark}               % Add things in TOC
% \usepackage{showframe}              % Frames to easily set up page layout
\usepackage[hypcap=true]{caption}   % Correctly placed anchors for hyperlinks
\usepackage{floatrow}               % Set up captions of floats
\usepackage{marginfix}              % Make marginpars float freely
\usepackage{metalogo}               % XeTeX logo
\usepackage{scrlayer-scrpage}       % Customise head and foot regions
\usepackage[footnote]{snotez}       % Footnotes as sidenotes
% \usepackage{showlabels}             % Show labels
\usepackage{listings}               % Code
\usepackage[linesnumbered,
            ruled,
            vlined]{algorithm2e}    % Algorithms
\usepackage{multirow}               % Cells occupying multiple rows in tables
\usepackage{multicol}               % Multiple columns in dictionary
\setlength\columnseprule{.4pt}
\usepackage[square]{natbib}         % Bibliography management

% More floats
\extrafloats{100}

% Figures and tables
\floatsetup[figure]{margins=hangoutside,
                    facing=yes,
                    capposition=beside,
                    capbesideposition={center,outside},
                    floatwidth=\textwidth}
\floatsetup[widefigure]{margins=hangoutside,
                        facing=yes,
                        capposition=bottom}
\floatsetup[table]{margins=hangoutside,
                   facing=yes,
                   capposition=beside,
                   capbesideposition={center,outside},
                   floatwidth=\textwidth}
\floatsetup[widetable]{margins=hangoutside,
                       facing=yes,
                       capposition=bottom}

% Sidenotes
\setsidenotes{text-mark-format=\textsuperscript{\normalfont#1},
              note-mark-format=#1:,
              note-mark-sep=\enskip}

% Listings code
\definecolor{listingkeywords}{rgb}{0.00, 0.5, 0.0}
\definecolor{listingidentifiers}{rgb}{0, 0, 0}
\definecolor{listingcomments}{rgb}{0.25, 0.5, 0.5}
\definecolor{listingstrings}{rgb}{0.73, 0.13, 0.13}
\definecolor{listingnumbers}{rgb}{0.25, 0.25, 0.25}
\lstset{
  basicstyle=\scriptsize\ttfamily,
  keywordstyle=\color{listingkeywords}\bfseries,
  identifierstyle=\color{listingidentifiers},
  commentstyle=\color{listingcomments}\itshape,
  stringstyle=\color{listingstrings},
  numberstyle=\scriptsize\color{listingnumbers}\ttfamily,
  frame=single,
  tabsize=4,
  language=[ISO]C++
}

% Draw safety margins for variation in cropping, etc.
% \usepackage{background}
% \backgroundsetup{
% color=black,
% scale=1,
% opacity=1,
% angle=0,
% contents={
  % \tikz\draw[line width=1pt,black] (-8.18cm,-11.02cm) rectangle (8.18cm,11.02cm); % 1/2 inch safety margin
  % \tikz\draw[line width=1pt,black] (-8.81cm,-11.65cm) rectangle (8.81cm,11.65cm); % 1/4 inch safety margin
%   \tikz\draw[line width=1pt,black] (-9.45cm,-12.29cm) rectangle (9.45cm,12.29cm); % Crown quarto page
% }}

% Figure captions with no indentation
\setcapindent{0pt}

% List of figures title as "Figures"
\renewcaptionname{english}{\listfigurename}{Figures}
\renewcaptionname{english}{\listtablename}{Tables}

% Add half-title to PDF bookmarks
\makeatletter
\pretocmd{\maketitle}{%
  \if@openright\cleardoublepage\else\clearpage\fi
  \pdfbookmark[0]{Preliminaries}{title}% TODO: Change link to cover in online PDF version
  \pdfbookmark[1]{Half title}{title}% 
}{}{}%
\makeatother
% Add table of contents to PDF bookmarks
\makeatletter
\pretocmd{\tableofcontents}{%
  \if@openright\cleardoublepage\else\clearpage\fi
  \pdfbookmark[1]{Table of contents}{toc}%
}{}{}%
\makeatother
% Add list of figures to PDF bookmarks
\makeatletter
\pretocmd{\listoffigures}{%
  \if@openright\cleardoublepage\else\clearpage\fi
  \pdfbookmark[1]{List of figures}{lof}%
}{}{}%
\makeatother

% Font setup
\setmainfont[Ligatures=TeX,ItalicFont=Feijoa-MediumItalic,StylisticSet=6]{Feijoa}
\setmonofont[BoldFont=GTPressuraMono-Bold,ItalicFont=GTPressuraMono-LightItalic]{GTPressuraMono-Light}
\setmathfont{Asana-Math.otf}
\newfontfamily\fanciestfont[Ligatures={TeX,Discretionary}]{Feijoa-Display}
\newfontfamily\fancyfont[Ligatures=TeX]{Feijoa-Display}
\newfontfamily\chapternumberfont[Ligatures=TeX,Numbers=Lining]{Feijoa-Display}
\addtokomafont{disposition}{\fancyfont}
\addtokomafont{title}{\fanciestfont}
\addtokomafont{chapter}{\fanciestfont}
\addtokomafont{chapterentry}{\normalfont\scshape}
\addtokomafont{descriptionlabel}{\normalfont\bfseries}
\addtokomafont{caption}{\footnotesize}

% Levels in table of contents
\setcounter{tocdepth}{1}

% Table of contents styles
\newlength{\alignviiilength}
\setlength{\alignviiilength}{7.5mm}
\newlength{\alignxlength}
\setlength{\alignxlength}{8.5mm}
% \renewcommand{\cftdotsep}{\cftnodots}
% \renewcommand{\cftpnumalign}{l}

\setlength{\cftpartnumwidth}{\alignviiilength}
\renewcommand{\cftpartfont}{\fancyfont\LARGE\hypersetup{allcolors=black}}
\renewcommand{\cftpartpagefont}{\fancyfont\LARGE}

\setlength{\cftchapnumwidth}{\alignviiilength}
\renewcommand{\cftchapfont}{\fancyfont\large\hypersetup{allcolors=black}}
% \renewcommand{\cftchapleader}{\hspace{1em}}
\renewcommand{\cftchappagefont}{\fancyfont\large}
% \renewcommand{\cftchapafterpnum}{\cftparfillskip}

\setlength{\cftsecnumwidth}{\alignviiilength}
\renewcommand{\cftsecfont}{\hypersetup{allcolors=black}}
\setlength{\cftsecindent}{\alignviiilength}
\renewcommand{\cftsecleader}{\hspace{1em}}
% \renewcommand{\cftsecpagefont}{\normalfont\color{greenforlinks}}
\renewcommand{\cftsecafterpnum}{\cftparfillskip}

\setlength{\cftfigindent}{0mm}
\renewcommand{\cftfigfont}{\hypersetup{allcolors=black}}
\setlength{\cftfignumwidth}{\alignxlength}
\renewcommand{\cftfigleader}{\hspace{1em}}
\renewcommand{\cftfigafterpnum}{\cftparfillskip}

\setlength{\cfttabindent}{0mm}
\setlength{\cfttabnumwidth}{\alignxlength}
\renewcommand{\cfttabfont}{\hypersetup{allcolors=black}}
\renewcommand{\cfttableader}{\hspace{1em}}
\renewcommand{\cfttabafterpnum}{\cftparfillskip}

% Page styles for tables of contents, figures and tables
\renewpagestyle{scrheadings}{
  {\makebox[2em][r]{\thepage}\quad\rule{1pt}{100pt}\quad{}Contents}%
  {\hfill\rightmark\quad\rule{1pt}{100pt}\quad\makebox[2em][l]{\thepage}}%
  {}
}{
  {}%
  {}%
  {}
}
\renewpagestyle{plain.scrheadings}{
  {}%
  {}%
  {}
}{
  {\thepage}%
  {\hfill\thepage}%
  {}
}

% Part title style [todo]
\addtokomafont{part}{\Huge} 
\renewcommand*{\partformat}{\vspace{-6cm}\partname~\thepart\autodot\thispagestyle{empty}}

% Chapter title style
\makeatletter
\setlength{\fboxsep}{0cm}
\renewcommand*{\@@makechapterhead}[1]{%
  \vspace*{3\baselineskip plus \parskip}
  \makebox{%
    \makebox[\linewidth]{\parbox[c][2cm]{\linewidth}{\if@mainmatter\raggedleft\fi\size@chapter{#1}}}%
    \if@mainmatter%
      \makebox[\marginparsep]{\parbox[c][2cm]{\marginparsep}{\centering\rule{1pt}{2cm}}}%
      \makebox[4cm]{\parbox[c][2cm]{4cm}{\scalebox{5}{\chapternumberfont\thechapter\autodot}}}%
    \fi
  }%
  \vspace*{1.5\baselineskip plus .1\baselineskip minus .167\baselineskip}
}
\makeatother

% Formatting of back references
\renewcommand*{\backref}[1]{}
\renewcommand*{\backrefalt}[4]{{%
\ifcase#1 Not cited.%
\or{}Cited on page~#2.%
\else Cited on pages~#2.%
\fi%
}}

% Bullets
\renewcommand{\labelitemi}{►}

% Custom commands
\newcommand{\ie}{i.e.}
\newcommand{\eg}{e.g.}
\newcommand{\cf}{cf.}
\newcommand{\refpa}[1]{\hyperref[#1]{Part}~\ref{#1}}
\newcommand{\refch}[1]{\hyperref[#1]{Chapter}~\ref{#1}}
\newcommand{\refchs}[1]{Chapters~\ref{#1}}
\newcommand{\refse}[1]{\hyperref[#1]{\S}\ref{#1}}
% \newcommand{\refses}[1]{\S\ref{#1}}
\newcommand{\refap}[1]{\hyperref[#1]{Appendix}~\ref{#1}}
\newcommand{\reffig}[1]{\hyperref[#1]{Figure}~\ref{#1}}
\newcommand{\reffiges}[1]{\hyperref[#1]{Figura}~\ref{#1}}
\newcommand{\reffignl}[1]{\hyperref[#1]{Figuur}~\ref{#1}}
\newcommand{\reffigs}[1]{Figures~\ref{#1}}
\newcommand{\reffigp}[1]{\hyperref[#1]{Figure}~\ref{#1} on \hyperref[#1]{page}~\pageref{#1}}
\newcommand{\reftab}[1]{\hyperref[#1]{Table}~\ref{#1}}
\newcommand{\refalgo}[1]{\hyperref[#1]{Algorithm}~\ref{#1}}

% Papers
\newcommand{\paperostravaedgematching}{\item \textbf{Edge-matching polygons with a constrained triangulation}. Hugo Ledoux and Ken Arroyo Ohori. \emph{Proceedings of GIS Ostrava 2011}, Ostrava, Czech Republic, January 2011, pp. 377--390.}
\newcommand{\paperagileprepair}{\item[\href{http://dx.doi.org/10.5194/isprsarchives-xxxviii-4-c26-7-2012}{►}] \href{http://dx.doi.org/10.5194/isprsarchives-xxxviii-4-c26-7-2012}{\textbf{Automatically repairing invalid polygons with a constrained triangulation}}. Hugo Ledoux, Ken Arroyo Ohori and Martijn Meijers. In J\'er\^ome Gensel, Didier Josselin and Danny Vandenbroucke (eds.), \emph{Multidisciplinary Research on Geographical Information in Europe and Beyond. Proceedings of the 15th AGILE International Conference on Geographic Information Science}, Avignon, France, April 2012, pp. 13--18.}
\newcommand{\papertdgeoinfond}{\item[\href{http://dx.doi.org/10.5194/isprsarchives-xxxviii-4-c26-7-2012}{►}] \href{http://dx.doi.org/10.5194/isprsarchives-xxxviii-4-c26-7-2012}{\textbf{Integrating scale and space in 3D city models}}. Jantien Stoter, Hugo Ledoux, Martijn Meijers and Ken Arroyo Ohori. In Jacynthe Pouliot, Sylvie Daniel, Fr\'ed\'eric Hubert and Alborz Zamyadi (eds.), \emph{Proceedings of the 7th International 3D GeoInfo Conference, International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences} XXXVIII--4/C26, ISPRS, Québec City, Canada, May 2012, pp. 7--10.}
\newcommand{\paperosgisrepair}{\item \textbf{Automatically repairing polygons and planar partitions with \emph{prepair} and \emph{pprepair}}. Ken Arroyo Ohori, Hugo Ledoux and Martijn Meijers. \emph{Proceedings of the 4th Open Source GIS UK Conference}, Nottingham, United Kingdom, September 2012.}
\newcommand{\paperpfgpprepair}{\item[\href{http://dx.doi.org/10.1127/1432-8364/2012/0143}{►}] \href{http://dx.doi.org/10.1127/1432-8364/2012/0143}{\textbf{Validation and automatic repair of planar partitions using a constrained triangulation}}. Ken Arroyo Ohori, Hugo Ledoux and Martijn Meijers. \emph{Photogrammetrie, Fernerkundung, Geoinformation} 5, October 2012, pp. 613--630.}
\newcommand{\paperagileslicing}{\item \textbf{Manipulating higher dimensional spatial information}. Ken Arroyo Ohori, Filip Biljecki, Jantien Stoter and Hugo Ledoux. In Danny Vandenbroucke, B\'en\'edicte Bucher and Joep Crompvoets (eds.), \emph{Geographic Information Science at the Heart of Europe. Proceedings of the 16th AGILE International Conference on Geographic Information Science}, Leuven, Belgium, May 2013.}
\newcommand{\papergeoadvancesnd}{\item[\href{http://dx.doi.org/10.1007/978-3-642-36379-5_2}{►}] \href{http://dx.doi.org/10.1007/978-3-642-36379-5_2}{\textbf{Representing the dual of objects in a four-dimensional GIS}}.\@ Ken Arroyo Ohori, Pawel Boguslawski and Hugo Ledoux. In A. Abdul Rahman, P. Boguslawski, C. Gold and M. N. Said (eds.), \emph{Developments in Multidimensional Spatial Data Models}, Lecture Notes in Geoinformation and Cartography, Springer Berlin Heidelberg, Johor Bahru, Malaysia, May 2013, pp. 17--31.}
\newcommand{\papericcsand}{\item[\href{http://dx.doi.org/10.1007/978-3-642-39637-3_41}{►}] \href{http://dx.doi.org/10.1007/978-3-642-39637-3_41}{\textbf{Modelling higher dimensional data for GIS using generalised maps}}. Ken Arroyo Ohori, Hugo Ledoux and Jantien Stoter. In B. Murgante, S. Misra, M. Carlini, C. Torre, H. Q. Nguyen, D. Taniar, B. Apduhan and O. Gervasi (eds.), \emph{Computational Science and Its Applications --- ICCSA 2013. 13th International Conference, Ho Chi Minh City, Vietnam, June 24–27, 2013, Proceedings, Part I}, Lecture Notes in Computer Science 7971, Springer Berlin Heidelberg, June 2013, pp. 526--539.}
\newcommand{\paperacmsigspatialextrusion}{\item[\href{http://dx.doi.org/10.1145/2525314.2525447}{►}] \href{http://dx.doi.org/10.1145/2525314.2525447}{\textbf{Using extrusion to generate higher-dimensional GIS datasets}}. Ken Arroyo Ohori and Hugo Ledoux. In Craig Knoblock, Peer Kr\"oger, John Krumm, Markus Schneider and Peter Widmayer (eds.), \emph{SIGSPATIAL'13: Proceedings of the 21st ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems}, ACM, Orlando, Florida, United States, November 2013, pp. 398--401.}
\newcommand{\papericaaincrementalconstruction}{\item[\href{http://dx.doi.org/10.1007/978-3-319-04126-1_4}{►}] \href{http://dx.doi.org/10.1007/978-3-319-04126-1_4}{\textbf{Constructing an $n$-dimensional cell complex from a soup of $(n-1)$-dimensional faces}}. Ken Arroyo Ohori, Guillaume Damiand and Hugo Ledoux. In Prosenjit Gupta and Christos Zaroliagis (eds.), \emph{Applied Algorithms. First International Conference, ICAA 2014, Kolkata, India, January 13--15, 2014. Proceedings}, Lecture Notes in Computer Science 8321, Springer International Publishing Switzerland, Kolkata, India, January 2014, pp. 37--48.}
\newcommand{\papercgeoprepair}{\item[\href{http://dx.doi.org/10.1016/j.cageo.2014.01.009}{►}] \href{http://dx.doi.org/10.1016/j.cageo.2014.01.009}{\textbf{A triangulation-based approach to automatically repair GIS polygons}}. Hugo Ledoux, Ken Arroyo Ohori and Martijn Meijers. \emph{Computers \& Geosciences} 66, May 2014, pp. 121--131.}
\newcommand{\paperijgisndstructures}{\item[\href{http://dx.doi.org/10.1080/13658816.2014.999683}{►}] \href{http://dx.doi.org/10.1080/13658816.2014.999683}{\textbf{An evaluation and classification of $n$D topological data structures for the representation of objects in a higher-dimensional GIS}}.\@ Ken Arroyo Ohori, Hugo Ledoux and Jantien Stoter. \emph{International Journal of Geographical Information Science} 29(5), May 2015, pp. 825--849.}
\newcommand{\paperijgisextrusion}{\item[\href{http://dx.doi.org/10.1080/13658816.2015.1010535}{►}] \href{http://dx.doi.org/10.1080/13658816.2015.1010535}{\textbf{A dimension-independent extrusion algorithm using generalised maps}}. Ken Arroyo Ohori, Hugo Ledoux and Jantien Stoter. \emph{International Journal of Geographical Information Science} 29(7), July 2015, pp. 1166--1186.}
\newcommand{\paperijgind}{\item[\href{http://dx.doi.org/10.3390/ijgi4031055}{►}] \href{http://dx.doi.org/10.3390/ijgi4031055}{\textbf{Modelling a 3D city model and its levels of detail as a true 4D model}}. Ken Arroyo Ohori, Hugo Ledoux, Filip Biljecki and Jantien Stoter. \emph{ISPRS International Journal of Geo-Information}, 4(3), September 2015, pp. 1055--1075.} 
\newcommand{\paperisprsnd}{\item[\href{http://dx.doi.org/10.5194/isprsannals-II-2-W2-1-2015}{►}] \href{http://dx.doi.org/10.5194/isprsannals-II-2-W2-1-2015}{\textbf{Storing a 3D city model, its levels of detail and the correspondences between objects as a 4D combinatorial map}}. Ken Arroyo Ohori, Hugo Ledoux and Jantien Stoter. In Alias Abdul Rahman, Umit Isikdag and Francesc Ant\'on Castro (eds.), Joint International Geoinformation Conference 2015, 28--30 October 2015, Kuala Lumpur, Malaysia, ISPRS Annals of the Photogrammetry, Remote Sensing and Spatial Information Sciences II--2/W2, ISPRS, Kuala Lumpur, Malaysia, October 2015, pp. 1--8.}
\newcommand{\paperudmvobj}{\item[\href{http://dx.doi.org/10.2312/udmv.20151345}{►}] \href{http://dx.doi.org/10.2312/udmv.20151345}{\textbf{Automatic semantic-preserving conversion between OBJ and CityGML}}. Filip Biljecki and Ken Arroyo Ohori. In F. Biljecki and V. Tourre (eds.), \emph{Eurographics Workshop on Urban Data Modelling and Visualisation}, Eurographics Association, Delft, The Netherlands, November 2015, pp. 25--30.}
\newcommand{\paperijgisroeland}{\item[\href{http://dx.doi.org/10.1080/13658816.2015.1072201}{►}] \href{http://dx.doi.org/10.1080/13658816.2015.1072201}{\textbf{Automatically enhancing CityGML LOD2 models with a corresponding indoor geometry}}. Roeland Boeters, Ken Arroyo Ohori, Filip Biljecki and Sisi Zlatanova. \emph{International Journal of Geographical Information Science} 29(12), December 2015, pp. 2248--2268.}
\newcommand{\papermethodsxvoxelisation}{\item[\href{http://dx.doi.org/10.1016/j.mex.2016.01.001}{►}] \href{http://dx.doi.org/10.1016/j.mex.2016.01.001}{\textbf{Voxelization algorithms for geospatial applications: Computational methods for voxelating spatial datasets of 3D city models containing 3D surface, curve and point data models}}. Pirouz Nourian, Romulo Gon\c{c}alves, Sisi Zlatanova, Ken Arroyo Ohori and Anh Vu Vo. \emph{MethodsX} 3, January 2016, pp. 69--86.}

% \nofiles%
\begin{document}

% Front cover
\includepdf{cover-front.pdf}

% Sloppy spacing works better for small paper sizes: better than text outside margin, esp. because of marginpars
\sloppy

\frontmatter

\newgeometry{top=2.170cm,
            bottom=3.510cm,
            inner=2.1835cm,
            outer=2.1835cm,
            ignoremp}
\input{pre}

% No colour links in tables of contents and list of figures
\cleardoublepage%
\tableofcontents
% \cleardoublepage%
\listoffigures
% \cleardoublepage%
% \listoftables
\restoregeometry%

\mainmatter%

% Lengths used for page head
\newlength{\overflowingheadlen}
\setlength{\overflowingheadlen}{\linewidth}
\addtolength{\overflowingheadlen}{\marginparsep}
\addtolength{\overflowingheadlen}{\marginparwidth}

% Page style for preface
\renewpagestyle{scrheadings}{
  {\hspace{-\marginparwidth}\hspace{-\marginparsep}\makebox[\overflowingheadlen][l]{\makebox[2em][r]{\thepage}\quad\rule{1pt}{100pt}\quad{}Preface}}%
  {\makebox[\overflowingheadlen][r]{\rightmark\quad\rule{1pt}{100pt}\quad\makebox[2em][l]{\thepage}}}%
  {}
}{
  {}%
  {}%
  {}
}
\renewpagestyle{plain.scrheadings}{
  {}%
  {}%
  {}
}{
  {\thepage}%
  {\makebox[\overflowingheadlen][r]{\thepage}}%
  {}
}

\input{preface}

% Page style for chapters
\renewpagestyle{scrheadings}{
  {\hspace{-\marginparwidth}\hspace{-\marginparsep}\makebox[\overflowingheadlen][l]{\makebox[2em][r]{\thepage}\quad\rule{1pt}{100pt}\quad{}\leftmark}}%
  {\makebox[\overflowingheadlen][r]{\rightmark\quad\rule{1pt}{100pt}\quad\makebox[2em][l]{\thepage}}}%
  {}
}{
  {}%
  {}%
  {}
}
\renewpagestyle{plain.scrheadings}{
  {}%
  {}%
  {}
}{
  {\thepage}%
  {\makebox[\overflowingheadlen][r]{\thepage}}%
  {}
}

\input{introduction}

\setpartpreamble{
  \vspace{3cm}
  \begin{center}
  \includegraphics[width=0.8\linewidth]{figs/gmaps-3d-simplices}
  \end{center}
}
\newgeometry{top=2.170cm,
            bottom=3.510cm,
            inner=2.1835cm,
            outer=2.1835cm,
            ignoremp}
\part{Representing geographic information}
\label{pa:representation}
\restoregeometry%
% The underlying 3D simplicial complex in the representation of a cube as a 3D generalised map.

\input{math}

\input{modelling-background}

\input{nd-modelling}

\setpartpreamble{
  \vspace{5cm}
  \includegraphics[width=\linewidth]{figs/extrusion-steps}
}
\newgeometry{top=2.170cm,
            bottom=3.510cm,
            inner=2.1835cm,
            outer=2.1835cm,
            ignoremp}
\part{Constructing and manipulating objects}
\label{pa:operations}
\restoregeometry%

\input{operations-background}

\input{extrusion}

\input{incremental-construction}

\input{linking-lods}

\input{slicing}

\bookmarksetup{startatroot}
\addtocontents{toc}{\medskip\bigskip}

\input{cleaning}

\input{conclusions}

\appendix%

\addtocontents{toc}{\medskip\bigskip}

\input{implementation}

\cleardoublepage%
\renewpagestyle{scrheadings}{
  {\makebox[2em][r]{\thepage}\quad\rule{1pt}{100pt}\quad\leftmark}%
  {\hfill\rightmark\quad\rule{1pt}{100pt}\quad\makebox[2em][l]{\thepage}}%
  {}
}{
  {}%
  {}%
  {}
}
\renewpagestyle{plain.scrheadings}{
  {}%
  {}%
  {}
}{
  {\thepage}%
  {\hfill\thepage}%
  {}
}
\newgeometry{top=2.170cm,
            bottom=3.510cm,
            inner=2.1835cm,
            outer=2.1835cm,
            ignoremp}

\input{dictionary}

\addtocontents{toc}{\medskip\bigskip}

\backmatter%

% Bibliograhy
\bibliographystyle{plainnat}
{\small\bibliography{docs}}

\restoregeometry%

% Page style for back matter
\renewpagestyle{scrheadings}{
  {\hspace{-\marginparwidth}\hspace{-\marginparsep}\makebox[\overflowingheadlen][l]{\makebox[2em][r]{\thepage}\quad\rule{1pt}{100pt}\quad\leftmark}}%
  {\makebox[\overflowingheadlen][r]{\rightmark\quad\rule{1pt}{100pt}\quad\makebox[2em][l]{\thepage}}}%
  {}
}{
  {}%
  {}%
  {}
}
\renewpagestyle{plain.scrheadings}{
  {}%
  {}%
  {}
}{
  {\thepage}%
  {\makebox[\overflowingheadlen][r]{\thepage}}%
  {}
}

\cleardoublepage%
\label{thesis:back}
\pdfbookmark[-1]{Back matter}{thesis:back}

\input{summary}

\input{cv}

% Back cover
\clearpage
\thispagestyle{empty}
\null%
\clearpage
\includepdf{cover-back.pdf}

\end{document}