% !TeX TS-program =
% !TeX spellcheck = en_DK
% !TeX encoding = UTF-8
% !TeX root = main.tex

% Latex Packages
\usepackage{amsmath,amssymb} % math things.
\usepackage{array}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{caption}
\usepackage{chngcntr}
\usepackage{color} % makes custom color codes available.
\usepackage[showisoZ]{datetime2} % more options for time formatting.
\usepackage{dblfnote} % https://tex.stackexchange.com/a/8180
\usepackage{enumitem} % makes available changes to lists.
\usepackage{epigraph} % used to style quotes
\usepackage{expdlist}
\usepackage{fancybox} % styling of boxes.
\usepackage{fancyhdr}
\usepackage{float}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{geometry}
\usepackage[toc,acronym,footnote,nomain]{glossaries} % Load the package with the acronym option
\usepackage{glossaries-extra}
\usepackage{graphicx}
\usepackage[unicode=false,colorlinks=true,linkcolor=darkgray,citecolor=darkgray,filecolor=darkgray,urlcolor=darkgray]{hyperref} % https://en.wikibooks.org/wiki/LaTeX/Hyperlinks
\usepackage{inconsolata}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{listings}
\usepackage{lmodern}
\usepackage{makecell}
\usepackage[toc]{multitoc}
\usepackage[numbers,square,sectionbib,comma,nonamebreak,elide]{natbib} % used with layout for bibliography section.
\usepackage{parskip}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{tikzsymbols} % http://ctan.math.utah.edu/ctan/tex-archive/graphics/pgf/contrib/tikzsymbols/tikzsymbols.pdf
\usepackage{titlepic}
\usepackage{titling} % makes available \thetitle \theauthor \thedate
\usepackage[nottoc]{tocbibind}
\usepackage{transparent}
\usepackage{url} % cmd \url.
\usepackage{varwidth}
\usepackage{wrapfig}
\usepackage[usenames,dvipsnames,svgnames]{xcolor} % makes custom color codes available.


\renewcommand*{\multicolumntoc}{3} % https://tex.stackexchange.com/a/6455


\newcounter{qcounter}


\catcode`\_=12


% styles list is available at
% https://www.sharelatex.com/learn/Natbib_bibliography_styles
\bibliographystyle{unsrtnat}


% Path where images are located relative
% to the file main.tex
\graphicspath{{img/}{figures/}}


% In which order to look after images in
% declared graphicspath{}'s
% 1. Low-quality JPG
% 2. Med-quality PNG
% 3. High-quality PDF
\DeclareGraphicsExtensions{.jpg,.png,.pdf}


\fancypagestyle{fancybook}{%
	\fancyhf{}%
	% Note the ## here. It's required because \fancypagestyle is making a macro (\ps@fancybook).
	% If we just wrote #1, TeX would think that it's the argument to \ps@fancybook, but
	% \ps@fancybook doesn't take any arguments, so TeX would complain with an error message.
	% You are not expected to understand this.
	\renewcommand*{\sectionmark}[1]{ \markright{\thesection\ ##1} }%
	\renewcommand*{\chaptermark}[1]{ \markboth{\chaptername\ \thechapter: ##1}{} }%
	% Increase the length of the header such that the folios
	% (typography jargon for page numbers) move into the margin
	\fancyhfoffset[LE]{6mm}% slightly less than 0.25in
	\fancyhfoffset[RO]{6mm}%
	% Put some space and a vertical bar between the folio and the rest of the header
	\fancyhead[LE]{\color{Black}\thepage\color{Gray}\hskip3mm\vrule\hskip3mm\leftmark}%
    \fancyhead[RE]{\color{Gray}{\tiny Generated \utccurrenttime}}%
	\fancyhead[RO]{\color{Gray}\rightmark\hskip3mm\vrule\hskip3mm\color{Black}\thepage}%
    \fancyhead[LO]{\color{Gray}{\tiny \theauthor}}%
}
\pagestyle{fancybook}


% Use the roman numeric system for pagenumbers
\pagenumbering{Roman}


\input{commands} % Import user-defined commands


\input{layout/color} %user-defined colors


% https://tex.stackexchange.com/a/174553
\lstdefinestyle{mystyle}{
    language=cisco,
    backgroundcolor=\color{backcolour},
    commentstyle=\color{codegreen}\ttfamily,
    keywordstyle=\color{magenta},
    numberstyle=\tiny\color{codegray},
    stringstyle=\color{codepurple},
    basicstyle=\scriptsize\ttfamily,
    breakatwhitespace=false,
    breaklines=true,
    captionpos=b,
    keepspaces=true,
    numbers=left,
    showspaces=false,
    showstringspaces=false,
    showtabs=false,
    tabsize=4,
    abovecaptionskip=1em,
    aboveskip=1em,
    belowcaptionskip=1em,
    belowskip=3em,
    upquote=true,
    numbersep=8pt,
    rulecolor=\color{black},
}


\lstdefinestyle{plaintxt}{
    language=TeX,
    numbers=none,
    frame=trBL,
    frameround=fttt,
    backgroundcolor=\color{white},
    boxpos=c,
}


\lstdefinelanguage{cisco}{
    keywords={
        end,
        interface,
        ip,
        line,
        no,
        router,
        show,
        shutdown,
        vlan,
        vrf
    },
    keywordstyle=\color{blue}\bfseries,
    ndkeywords={
        addr,
        address,
        deny,
        enable,
        fa,
        FastEthernet,
        gi,
        GigabitEthernet,
        permit,
        remark,
        run,
        view,
    },
    ndkeywordstyle=\color{darkgray}\bfseries,
    identifierstyle=\color{black},
    sensitive=false,
    comment=[l]{!},
    commentstyle=\color{purple}\ttfamily,
    stringstyle=\color{red}\ttfamily,
    caption=\lstname,
    tabsize=1,
    captionpos=t,
    showstringspaces=false,
    breaklines=true,
    breakatwhitespace=true,
}


\geometry{a4paper,margin=1.25cm}
\setlength{\columnsep}{1.25cm} %space between columns
\setlength{\headheight}{15pt}
\setlength{\footnotesep}{1mm} %space between footnotes:
\setlength{\skip\footins}{1.25cm} %space between the text body and the footnotes
\setlist[itemize,1]{leftmargin=\dimexpr 26pt-.2cm}
\setlist[itemize,2]{leftmargin=\dimexpr 26pt-.3cm}
\lstset{style=mystyle} %apply lst styling


\renewcommand{\familydefault}{\sfdefault}


\DeclareCaptionFormat{myformat}{%
    % #1: label (e.g. "Table 1")
    % #2: separator (e.g. ": ")
    % #3: caption text
    \begin{varwidth}{\linewidth}%
        \centering
        #1#2#3%
    \end{varwidth}%
}
\captionsetup{format=myformat}% global activation


\newlist{todolist}{itemize}{2}
\setlist[todolist]{label=$\square$}
\usepackage{pifont}
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\newcommand{\done}{\rlap{$\square$}{\raisebox{2pt}{\large\hspace{1pt}\cmark}}%
    \hspace{-2.5pt}}
\newcommand{\wontfix}{\rlap{$\square$}{\large\hspace{1pt}\xmark}}


\renewcommand\theadalign{cb}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}

\def\tsq#1{\textquotesingle{#1}}
\def\bsq#1{%both single quotes
    \lq{#1}\rq}


\makeglossaries % Generate the glossary


\renewcommand*{\acronymname}{Abbreviations}


% Do not reset counter for footnotes at all
% through the document from start to finish.
% https://tex.stackexchange.com/a/10449
\counterwithout{footnote}{chapter}


% Do not reset counter for figures at all
% through the document from start to finish.
% https://tex.stackexchange.com/a/28334
\counterwithout{figure}{chapter}


% Do not reset counter for tables at all
% through the document from start to finish.
% https://tex.stackexchange.com/a/28020
\counterwithout{table}{chapter}


% Set footnote numeration
% https://www.sharelatex.com/learn/Footnotes
% This command need to be run AFTER
% "\counterwithout{footnote}{chapter}" for the
% changes to be able to take effect.
\renewcommand{\thefootnote}{\arabic{footnote}}


\addtolength{\skip\footins}{2pt}    % vertical space between rule and main text


% https://tex.stackexchange.com/a/141975
\let\origfootnote\footnote % font size of footnotes; changes \footnotesize command only inside footnotes!
\renewcommand{\footnote}[1]{%
    \renewcommand\footnotesize\scriptsize % here there is scriptsize in footnotes (example)
    \origfootnote{#1}}


% https://tex.stackexchange.com/a/146312
\newlist{mylist}{enumerate*}{1}
\setlist[mylist]{label={\alph*)},font={\color{red!25!black}\bfseries}}
