% PAGE LAYOUT
\usepackage[margin=2cm]{geometry} % Margins

% FONT STYLE
\usepackage[T1, T2A]{fontenc} % Font rendering
\usepackage[utf8]{inputenc}  % Input encoding
\usepackage[english, serbianc]{babel}
% \usepackage[defaultsans]{droidsans} % main font
% \usepackage[p,osf,space]{erewhon} % main font
% \usepackage[erewhon,vvarbb,bigdelims]{newtxmath} % math font
\usepackage{microtype}

% PARAGRAPH SETTINGS
\widowpenalty10000 % Prevent widows
\clubpenalty10000 % Prevent orphans
\setlength{\parindent}{0pt} % Paragraph indentation
\setlength{\parskip}{12pt}  % Space between paragraphs
\usepackage[doublespacing]{setspace}
\setlength{\jot}{2ex}       % Line spacing inside equation env
\setcounter{secnumdepth}{5} % Depth of section numbering

\usepackage{comment}  % Comment env for orgtbl exports

% CHAPTER STYLE
\usepackage{titlesec} % Modify titles style
\titleformat{\chapter}[hang]{\singlespacing\Huge\bfseries}{\thechapter%
  \hspace{20pt}}{0pt}{} % Modify chapter style

% continuous numbering
\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\counterwithout{equation}{chapter}

% HEADER AND FOOTER
\usepackage{fancyhdr}
\pagestyle{fancy}
\makeatletter
\renewcommand{\footrulewidth}{0.4pt}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
\fancypagestyle{mainmatter}{
  \fancyhf{}
  \lhead{\textsf{\nouppercase{\removelinebreaks\@naslov}}}
  \rhead{}
  \ifbsc \lfoot{\textsf{\nouppercase{\removelinebreaks\@student} - Дипломски рад}} \fi
  \ifmsc \lfoot{\textsf{\nouppercase{\removelinebreaks\@student} - Мастер рад}} \fi
  \cfoot{}
  \rfoot{\thepage}
}
\fancypagestyle{frontmatter}{
  \fancyhf{}
  \lhead{}
  \rhead{}
  \cfoot{}
  \rfoot{}
}
\fancypagestyle{plain}{
  \lhead{\textsf{\nouppercase{\removelinebreaks\@naslov}}}
  \rhead{}
  \ifbsc \lfoot{\textsf{\nouppercase{\removelinebreaks\@student} - Дипломски рад}} \fi
  \ifmsc \lfoot{\textsf{\nouppercase{\removelinebreaks\@student} - Мастер рад}} \fi
  \cfoot{}
  \rfoot{\thepage}
}
\addtocontents{toc}{\protect\thispagestyle{frontmatter}}
\makeatother

% BIBLIOGRAPHY
\addto{\captionsserbianc}{\renewcommand{\bibname}{Литература}}
\usepackage{cite}

% QUOTES
\usepackage[style=german]{csquotes}

% SUPPRESS PAGE NUMBER RESET
% \makeatletter
% \def\pagenumbering#1{%
%   \gdef\thepage{\csname @#1\endcsname \c@page}}
% \makeatother

% FIGURES
\usepackage[inkscapepath=svgsubdir]{svg}
\usepackage{pgfplots, etoolbox}  % Plot directly from csv
\usepackage{tikz-3dplot}
\usepackage{tikz-dimline}
\usepackage[mode=buildnew]{standalone}
\usepackage{xstring}
\usepackage{calc}

\usepackage{tikzscale}
\usetikzlibrary{pgfplots.groupplots}
\usetikzlibrary{arrows.meta, bending, positioning, matrix}
\pgfplotsset{
  compat=1.15,
  table/search path={csv},
  every axis/.append style={
    thick, 
    cycle list name=black white,
  %   ylabel style={rotate=-90}
  }
}
% \usetikzlibrary{external}
% \tikzexternalize[prefix=tikz-external/]

% MATH
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathtools}
\usepackage{physics}
\usepackage{commath}  % differentials
\usepackage{interval}  % Intervals definitions
\intervalconfig{soft open fences, separator symbol=;}
\usepackage{xfrac}  % Nicer fractions
\usepackage{siunitx}  % Nicer units
\usepackage{arydshln}  % Dashes in matrices
\usepackage[Symbol]{upgreek} % Straight Greek symbols

\newcommand\mat[1]{\boldsymbol{\mathrm{#1}}}
\renewcommand\vec[1]{\boldsymbol{#1}}

\newcommand{\myfourier}{\mbox{\unitlength1em
    \begin{picture}(2,0.5)
      \put(0.5,0.25){\circle{0.4}}
      \put(0.7,0.25){\thicklines \line(1,0){0.6}}
      \put(1.5,0.25){\circle*{0.4}}
\end{picture}}}

\newcommand{\myinvfourier}{\mbox{\unitlength1em
    \begin{picture}(2,0.5)
      \put(0.5,0.25){\circle*{0.4}}
      \put(0.7,0.25){\thicklines \line(1,0){0.6}}
      \put(1.5,0.25){\circle{0.4}}
\end{picture}}}

% REFERENCES & CAPTIONS
\usepackage{hyperref} % use [hidelinks] to hide links
\usepackage{subcaption}
\captionsetup{justification=centering}

% NOMENCLATURE
\usepackage[intoc]{nomencl}
\renewcommand*{\pagedeclaration}[1]{\unskip, page \hyperpage{#1}}
\newcommand{\nomunit}[1]{%
\renewcommand{\nomentryend}{\hspace*{\fill}#1}}
\makenomenclature
\makeatletter
\patchcmd{\thenomenclature}{\section*}{\section}{}{}
\makeatother

% ACRONYMS
\usepackage{acronym}

% ITEMIZE
\usepackage{enumitem}
\setlist[itemize]{noitemsep, topsep=0pt}

% TABLES
\usepackage{booktabs}

%% DEBUGGING

% SHOW LABELS
% \usepackage[draft,inline]{showlabels}
\makeatletter
\newcommand{\naslov}[1]{\gdef\@naslov{#1}}
\newcommand{\naslove}[1]{\gdef\@naslove{#1}}
\newcommand{\teza}[1]{\gdef\@teza{#1}}
\newcommand{\mentor}[1]{\gdef\@mentor{#1}}
\newcommand{\student}[1]{\gdef\@student{#1}}
\newcommand{\odobreno}[1]{\gdef\@odobreno{#1}}
\newcommand{\godina}[1]{\gdef\@godina{#1}}
\newif\ifbsc
\newif\ifmsc
\newcommand{\removelinebreaks}[1]{%
  \begingroup\def\\{}#1\endgroup}

\renewcommand{\maketitle}{
\begin{titlepage}
    \begin{center}
      {\fontsize{16}{\baselineskip}\selectfont УНИВЕРЗИТЕТ У БЕОГРАДУ\\ ГРАЂЕВИНСКИ ФАКУЛТЕТ}

      \includegraphics[width=46mm]{img/grf.png}
      \vspace{2cm}

      {\linespread{2}\fontsize{20}{10}\selectfont\bfseries\MakeUppercase{\@naslov}}

      \vspace{1cm}

      { \fontsize{16}{\baselineskip}\selectfont
        \ifbsc - ДИПЛОМСКИ РАД - \fi
        \ifmsc - МАСТЕР РАД - \fi
      }
      \vfill

      { \fontsize{16}{0.8\baselineskip}\selectfont

        \begin{minipage}{0.5\linewidth}
          \textbf{Ментор:} \\
          \@mentor
        \end{minipage}%
        \begin{minipage}{0.5\linewidth}
          \textbf{Кандидат:} \\
          \@student
        \end{minipage}
      }
      
      { \fontsize{16}{\baselineskip}\selectfont Београд, \@godina }
    \end{center}
  \end{titlepage}
}
\makeatother

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "main"
%%% End:

