phd-thesis/common-defs.tex

135 lines
3.9 KiB
TeX

\DeclareSIUnit{\baud}{Bd}
\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}
\DeclarePairedDelimiter{\paren}{(}{)}
\usepackage[
backend=biber,
style=numeric,
natbib=true,
url=false,
doi=true,
eprint=false,
refsection=chapter,
% Make the split online / other resource bibliographies behave
defernumbers=true,
]{biblatex}
\addbibresource{main.bib}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=doi,final]
\step[fieldset=isbn,null]
\step[fieldset=issn,null]
\step[fieldset=url,null]
}
\map{
\step[fieldsource=isbn,final]
\step[fieldset=issn,null]
\step[fieldset=url,null]
}
}
}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}}
\renewcommand{\thesubsubsection}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}
% Re-define heading formats to force single line spacing
\titleformat{\section}{\normalfont\large\bfseries\singlespacing}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\large\bfseries\singlespacing}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\normalfont\large\bfseries\singlespacing}{\thesubsubsection}{1em}{}
\dominitoc
\newcommand{\degree}{\ensuremath{^\circ}}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\definecolor{todoboxcolor}{RGB}{251 224 252}
\pagestyle{fancy}
\fancyhead[C]{}
\fancyhead[ER]{\footnotesize%
\ifdefined\thesispreviewmode %
(draft \texttt{\input{version.tex}\unskip}) %
\fi %
\leftmark}
\fancyhead[OL]{\footnotesize\rightmark}
\fancyhead[EL,OR]{\thepage}
\fancyfoot[LCR]{}
\fancypagestyle{plain}{%
\fancyhf{}%
\renewcommand{\headrulewidth}{0pt}%
\renewcommand{\footrulewidth}{0pt}%
}
\raggedbottom
\renewcommand{\chaptermark}[1]{\markboth{Chapter \thechapter: #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\addtolength{\headwidth}{\marginparsep}
\addtolength{\headwidth}{\marginparwidth}
\addtolength{\headwidth}{-1cm}
\newcommand{\todo}[1]{
\ifdefined\thesispreviewmode
\marginpar{
\setlength{\fboxsep}{2mm}
\shadowbox{
\parbox{3cm}{
\singlespacing
\raggedright
\textsf{
\small\textbf{To do}\\
\footnotesize#1
}
}
}
}
\fi
}
\newcommand{\todoplaceholder}[1]{\textbf{TODO}\todo{#1}}
% https://tex.stackexchange.com/questions/30720/footnote-without-a-marker
\newcommand\blfootnote[1]{%
\begingroup
\renewcommand\thefootnote{}\footnote{#1}%
\addtocounter{footnote}{-1}%
\endgroup
}
\newcommand{\figureattrib}[1]{%
\input{\figurepath/#1.latex_meta} %
\scriptsize
\ifdefined\thesispreviewmode\resourcestate\ \resourcescale\\\fi%
Resource: %
\texttt{\resourcerepo/\resourcepath} %
rev \texttt{\resourcerev} %
(\underline{\href{\resourceurl}{link}})%
}
\newcommand{\draftgraphics}{\ifdefined\thesispreviewmode\textcolor{red}{\bfseries Not final graphics. }\fi}
\newcommand{\camerareadygraphics}{\ifdefined\thesispreviewmode Camera-ready graphics. \fi}
\newcommand{\scaledgraphics}[1]{\ifdefined\thesispreviewmode scaled-#1\else#1\fi}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcommand{\partno}[1]{\textsf{\small#1}}
\newcommand{\price}[2]{#1 #2}
\newcommand{\imgsource}[4]{\scriptsize%
Image source: #1, #2 (\underline{\href{#4}{link}}). %
Licensed #3.}
\newcommand{\chapterbibliography}{
\clearpage % clearpage flushes all figures. force this here so we don't get figures floating in between references.
\newrefcontext[labelprefix={W}]
\printbibliography[type={online},title={Web sources},heading=subbibintoc]
\newrefcontext
\printbibliography[nottype={online},resetnumbers,heading=subbibintoc]
}
\hyphenation{a-me-na-ble}