%% Necessary macros for this project.
%%
%% These are a set of packages that have been commonly necessary in most
%% LaTeX usages. However, if any are not needed in your work, please feel
%% free to remove them.
%
%% Copyright (C) 2018-2021 Mohammad Akhlaghi <mohammad@akhlaghi.org>
%% Copyright (C) YYYY Your Name <your@email.address>
%
%% This file is free software: you can redistribute it and/or modify it
%% under the terms of the GNU General Public License as published by the
%% Free Software Foundation, either version 3 of the License, or (at your
%% option) any later version.
%
%% This file is distributed in the hope that it will be useful, but WITHOUT
%% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
%% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
%% for more details.
%
%% You should have received a copy of the GNU General Public License along
%% with this file.  If not, see <http://www.gnu.org/licenses/>.





%% Packages you may need in your project
%% -------------------------------------
%
%% Here you can add/remove any custom LaTeX package that you need for this
%% project that aren't provided by the journal's style.

%% For loading images into the output (with '\includegraphics').
\usepackage{graphicx}

%% IEEEtran V1.6 and later pre-defines the format of the cite.sty package
%% \cite{} output to follow that of the IEEE.
\usepackage{cite}

%% For the `\url' command.
\usepackage{url}

%% No need to load xcolor, its included by others below (it conflicts with
%% the listings package.
%\usepackage{xcolor}

%% To have links.
\usepackage[
  colorlinks,
  urlcolor=gray,
  citecolor=gray,
  linkcolor=gray,
  linktocpage]{hyperref}
\renewcommand\UrlFont{\rmfamily}

%% To have multiple bibliographies (one for the main paper, one for the
%% appendix). With 'multibib' we need to specify a name for each
%% bibliography. But this is only necessary when the appendices are to be
%% included in the final paper. When the supplement should be separate, it
%% will be treated as a completely independent build, so '\citeappendix'
%% should just be mapped to '\cite'.
\ifdefined\separatesupplement
\newcommand{\citeappendix}{\cite}
\else
\usepackage{multibib}
\newcites{appendix}{Bibliography}
\fi

%% To have typewriter font
\usepackage{courier}

%% To have bold monospace
%\usepackage[scaled=0.85]{beramono}
\usepackage{inconsolata}

%% To display codes.
\usepackage{listings}
\usepackage{etoolbox}
\input{listings-bash.prf}
\lstset{
  frame=lines,
  numbers=none,
  language=bash,
  commentstyle=\color{gray},
  abovecaptionskip=0mm,
  belowcaptionskip=0mm,
  keywordstyle=\mdseries,
  basicstyle=\small\ttfamily\color{blue!35!black},
}
\makeatletter
\preto\lstlisting{\def\@captype{table}}
\lst@AddToHook{OnEmptyLine}{\vspace{-0.5\baselineskip}}
\pretocmd\lst@makecaption{\noindent{\rule{\linewidth}{1pt}}}{}{}
\makeatother

%% Custom macros
\newcommand{\inlinecode}[1]{\textcolor{blue!35!black}{\texttt{#1}}}

\newcommand\eprint[1]{\href{https://arXiv.org/abs/#1}{{arXiv:#1}}}

\newcommand\doi[1]{\href{https://oadoi.org/#1}{{DOI:#1}}}

%% Import Maneage template for PGFPlots.
\input{tex/src/preamble-pgfplots.tex}
