masters-thesis/template/includes.tex

269 lines
7.2 KiB
TeX
Raw Normal View History

% Add further definitions and additional packages here
\usetikzlibrary{positioning, arrows, shapes, shadows, calc, fit}
\usepackage{subcaption}
\usepackage{csquotes}
% Avoid warning about deprecated packages
\usepackage{scrhack}
% Math packages
\usepackage{amssymb}
\usepackage{mathtools}
% Settings for sublistings
\usepackage{newfloat,caption}
\usepackage{subcaption}
\DeclareFloatingEnvironment[fileext=frm,placement={!ht},name=Listing,within=section]{listing}
% Reference packages
\usepackage{nameref}
\newcommand*{\Appendixautorefname}{appendix}
\def\equationautorefname{equation}
\def\subsectionautorefname{subsection}
\def\sectionautorefname{section}
\def\chapterautorefname{chapter}
\let\orgautoref\autoref
\providecommand{\Autoref}[1]{%
\begingroup%
\def\chapterautorefname{Chapter}%
\def\sectionautorefname{Section}%
\def\subsectionautorefname{Subsection}%
\def\appendixautorefname{Appendix}%
\def\listingautorefname{Listing}%
\def\figureautorefname{Figure}%
\def\tableautorefname{Table}%
\def\equationautorefname{Equation}%
\orgautoref{#1}%
\endgroup
}
\makeatletter
\def\tagform@#1{\maketag@@@{\ignorespaces#1\unskip\@@italiccorr}}
\let\orgtheequation\theequation
\def\theequation{(\orgtheequation)}
\makeatother
\newcommand{\autorefap}[1]{{\hyperref[#1]{appendix}~\ref{#1}}}
\newcommand{\Autorefap}[1]{{\hyperref[#1]{Appendix}~\ref{#1}}}
% Use subcaption packet
\usepackage{subcaption}
% Define listing styles
\definecolor{custom_gray}{RGB}{250, 250, 250}
\definecolor{number_gray}{RGB}{135, 135, 135}
\lstdefinestyle{customc}{
numbers=left,
frame=single,
backgroundcolor=\color{custom_gray},
numberstyle=\color{number_gray},
captionpos=b,
language=C,
showstringspaces=false,
basicstyle=\footnotesize\ttfamily,
keywordstyle=\bfseries\color{green!40!black},
commentstyle=\itshape\color{purple!40!black},
identifierstyle=\color{blue},
stringstyle=\color{orange},
morekeywords={uint64_t,size_t,json_t,time_t,uint32_t,pthread_t, atomic_int, ptrdiff_t}
}
\lstdefinestyle{customconfig}{
numbers=left,
frame=single,
backgroundcolor=\color{custom_gray},
numberstyle=\color{number_gray},
captionpos=b,
showstringspaces=false,
basicstyle=\footnotesize\ttfamily
}
% The bibliography
\usepackage[style=alphabetic, backend=biber]{biblatex}
\addbibresource{bibliography.bib}
% Table packages
\usepackage{multirow}
\usepackage{makecell}
\usepackage{longtable}
\usepackage{hhline}
\usepackage{boldline}
\usepackage{diagbox}
\usepackage{adjustbox}
\definecolor{table_gray}{HTML}{E8E8E8}
\definecolor{table_green}{HTML}{BCED91}
\definecolor{table_red}{HTML}{FA8072}
\definecolor{plot_gray}{HTML}{808080}
\definecolor{plot_blue}{HTML}{00549f}
\definecolor{plot_light_blue}{HTML}{8ebae5}
\newcommand{\graycell}[1]{{\cellcolor{table_gray}#1}}
\newcommand{\greencell}[1]{{\cellcolor{table_green}#1}}
\newcommand{\redcell}[1]{{\cellcolor{table_red}#1}}
\newcommand{\graycellleftline}[1]{{\multicolumn{1}{p{0.6cm}}{\cellcolor{table_gray}#1}}}
\newcommand{\graycellright}[1]{{\multicolumn{1}{p{1.3cm}}{\cellcolor{table_gray}#1}}}
\usepackage{adjustbox}
\usepackage{array}
\newcolumntype{R}[2]{%
>{\adjustbox{angle=#1,lap=\width-(#2)}\bgroup}%
l%
<{\egroup}%
}
\newcommand*\rot{\footnotesize\multicolumn{1}{R{58}{0mm}}}% no optional argument here, please!
\newcommand*\rotright{\footnotesize\multicolumn{1}{R{58}{1em}}}% no optional argument here, please!
% define "struts", as suggested by Claudio Beccari in
% a piece in TeX and TUG News, Vol. 2, 1993.
\newcommand\Tstrut{\rule{0pt}{2.6ex}} % = `top' strut
\newcommand\Bstrut{\rule[-0.9ex]{0pt}{0pt}} % = `bottom' strut
\newcommand\Bstrutlarger{\rule[-1.4ex]{0pt}{0pt}} % = `bottom' strut
% Fix underscore
\newcommand{\undershort}{{\fontfamily{ptm}\selectfont\textunderscore}}
% Math commands
\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}
% Nomenclature
%\usepackage[toc, acronym]{glossaries-extra}
\usepackage[toc, acronym]{glossaries}
\makeglossaries
\newacronymstyle{long-short-emph}%
{%
\ifglshaslong{\glslabel}%
{% acronym
% This is an adaptation of \glsgenacfmt
\ifdefempty\glscustomtext
{%
\ifglsused\glslabel
{%
\glsifplural
{%
\glscapscase
{%
\acronymfont{\glsentryshortpl{\glslabel}}\glsinsert
}%
{%
\acronymfont{\Glsentryshortpl{\glslabel}}\glsinsert
}%
{%
\mfirstucMakeUppercase
{\acronymfont{\glsentryshortpl{\glslabel}}\glsinsert}%
}%
}%
{%
\glscapscase
{%
\acronymfont{\glsentryshort{\glslabel}}\glsinsert
}%
{%
\acronymfont{\Glsentryshort{\glslabel}}\glsinsert
}%
{%
\mfirstucMakeUppercase
{\acronymfont{\glsentryshort{\glslabel}}\glsinsert}%
}%
}%
}%
{%
\glsifplural
{%
\glscapscase
{%
\emph{\glsentrylongpl{\glslabel}\glsinsert}\space%
(\firstacronymfont{\glsentryshortpl{\glslabel}})%
}%
{%
\emph{\Glsentrylongpl{\glslabel}{\glsinsert}}\space%
(\firstacronymfont{\glsentryshortpl{\glslabel}})%
}%
{%
\mfirstucMakeUppercase
{\emph{\glsentrylongpl{\glslabel}{\glsinsert}}\space%
(\firstacronymfont{\glsentryshortpl{\glslabel}})}%
}%
}%
{%
\glscapscase
{%
\emph{\glsentrylong{\glslabel}\glsinsert}\space%
(\firstacronymfont{\glsentryshort{\glslabel}})%
}%
{%
\emph{\Glsentrylong{\glslabel}\glsinsert}\space%
(\firstacronymfont{\glsentryshort{\glslabel}})%
}%
{%
\mfirstucMakeUppercase
{\emph{\glsentrylong{\glslabel}\glsinsert}\space%
(\firstacronymfont{\glsentryshort{\glslabel}})}%
}%
}%
}%
}%
{%
\glscustomtext
}%
}%
{% regular term
\ifglsused{\glslabel}{\glsgenentryfmt}{\emph{\glsgenentryfmt}}%
}%
}%
{%
\GlsUseAcrStyleDefs{long-short}%
}
\setacronymstyle{long-short-emph}
% Remove ugly borders aroung hyperlinks
\hypersetup{
colorlinks,
linkcolor={blue!0!black},
citecolor={blue!50!blue},
urlcolor={blue!80!blue}
}
% Macros
\def\one{\texttt{1}}
\def\zero{\texttt{0}}
\def\comma{,~}
% Font
\usepackage{bold-extra}
% SI units
\usepackage[binary-units]{siunitx}
\sisetup{mode=text,range-phrase = {\text{~to~}}, detect-weight=true}
\DeclareSIUnit\gigabitethernet{GbE}
% Fix command to print SM and TM sign
\renewcommand\textservicemark{\ensuremath{{}^\textsf{\scriptsize SM}}}
\renewcommand\texttrademark{\ensuremath{{}^\textsf{\scriptsize TM}}}
% Prevent single lines to be printed on the next page
\clubpenalty = 10000
\widowpenalty = 10000
\displaywidowpenalty = 10000
% Bookmark
\usepackage{bookmark}
\bookmarksetup{numbered}
% Appendix
\usepackage[page,toc]{appendix}
% pifon
\usepackage{pifont}
\newcommand*\OK{\ding{51}}
\newcommand*\NO{\ding{55}}
% font
\newcommand{\textbi}[1]{{\textbf{\textit{#1}}}}
% hyphenation
\hyphenation{at-o-mic-i-ty}
\hyphenation{da-ta-path}
\hyphenation{name-space}