\graphicspath{Figures/}  % Location of the graphics files (set up for graphics to be in PDF format)

\usepackage[final]{microtype} % Improves character and word spacing

% Redifine how ' appears with current font

% In order to quote, better use \textquote{quote} instead of 'quote' since it
% already did not work correctly with current font

%Math mode is not supported and will still print ’ instead of ' unless you
%invoke \prime for an almost correct result

\catcode`\'=\active
\def'{’}

% Table configuration packages
% Extending the array and tabular environments, Enhanced support for graphics
\usepackage{array,graphicx}
% Publication quality tables in LaTeX
\usepackage{booktabs}
% Access to PostScript standard Symbol and Dingbats fonts
\usepackage{pifont}
% Flexible LaTeX tabulars
\usepackage{tabu}
% Allow tables to flow over page boundaries
\usepackage{longtable}
% Driver-independent color extensions for LaTeX and pdfLaTeX
\usepackage{xcolor}
% Coloured boxes, for LaTeX examples and theorems, etc
\usepackage{tcolorbox}
% LaTeX support for the Text Companion fonts
\usepackage{textcomp}

% Select alternative section titles (Better chapter, section and subsection titles)
\usepackage{titlesec}
% Somehow messes up indentfirst for chapters only where it didn't before
\titleformat{\chapter}[block]{\huge\bfseries\centering}{\chaptertitlename\ \thechapter.}{0.5em}{} % frame is also good as opposed to block
\titleformat{\section}[hang]{\large\bfseries}{\thesection}{0.5em}{}
\titleformat{\subsection}[hang]{\normalsize\bfseries}{\thesubsection}{0.5em}{}
\titleformat{\subsubsection}[hang]{\normalsize\bfseries}{\thesubsubsection}{0.5em}{}
\titlespacing{\chapter}{-5pt}{-1cm}{1cm} % How low the chapter title is
% Better formatting of the chapter names in the table of contents
\usepackage{titletoc}
% \newcommand{\chaptitlefont}[1]{{\bfseries\Large #1}}

% Bellow is the same as the default settings but with : between the number and the title
\titlecontents{chapter}% level to be modified
    [0pt]{\addvspace{0.3cm}}%
    {\textsc{\hspace{0cm}\normalsize\bfseries \thecontentslabel: }\normalsize\bfseries\chaptitlefont}
    {\normalsize\bfseries}% for star chapters
    {\hfill\bfseries\contentspage}
    [\addvspace{.2pc}]%

\PolyglossiaSetup{greek}{indentfirst=false} % Do not indent first paragraph

% Intermix single and multiple columns
\usepackage{multicol}
% Context sensitive quotation facilities
\usepackage{csquotes} % Recommended with babel by biblatex
% make \textquote add quotation marks as “…”
\DeclareQuoteStyle{greek}{\textquotedblleft}{\textquotedblright}{\textquoteleft}{\textquoteright}
% Improve on LaTeX's footnote handling
\usepackage{footnote} % For footcite in tables
% A range of footnote options
\usepackage[bottom]{footmisc} % For footcite to be at the bottom of the page
% \fancyhfinit{\mdseries\rmfamily} % Header font

% Fix caption font
\usepackage{caption}
\DeclareCaptionFont{myfont}{\selectlanguage{greek}\selectfont}
\captionsetup{textfont=myfont}

\makeatother

% Include any extra LaTeX packages required
% biblatex because it has foocite built-in
% Sophisticated Bibliographies in LaTeX
\usepackage[backend=biber,style=trad-abbrv,backref=true,autocite=plain,sorting=none,natbib=true]{biblatex} % Use the "Natbib" style for the references in the Bibliography

\DefineBibliographyStrings{greek}{
  backrefpage={Αναφορά στη σελίδα},
  backrefpages={Αναφορά στις σελίδες},
}

%%% Print url and doi in a new line when on the bibliography page
\newbibmacro*{bbx:parunit}{%
  \ifbibliography
    {\setunit{\bibpagerefpunct}\newblock
     \usebibmacro{pageref}%
     \clearlist{pageref}%
     \setunit{\adddot\par\nobreak}}
    {}}

\renewbibmacro*{doi+eprint+url}{%
  \usebibmacro{bbx:parunit}% Added
  \iftoggle{bbx:doi}
    {\printfield{doi}}
    {}%
  \iftoggle{bbx:eprint}
    {\usebibmacro{eprint}}
    {}%
  \iftoggle{bbx:url}
    {\usebibmacro{url+urldate}}
    {}}

\renewbibmacro*{eprint}{%
  \usebibmacro{bbx:parunit}% Added
  \iffieldundef{eprinttype}
    {\printfield{eprint}}
    {\printfield[eprint:\strfield{eprinttype}]{eprint}}}

\renewbibmacro*{url+urldate}{%
  \usebibmacro{bbx:parunit}% Added
  \printfield{url}%
  \iffieldundef{urlyear}
    {}
    {\setunit*{\addspace}%
     \printtext[urldate]{\printurldate}}}
%%%

%%%%

% \newbibmacro*{cite:ibid}{%
%   \printtext{%
%     \bibhyperlink{cite\csuse{cbx@lastcite@\thefield{entrykey}}}{%
%       \bibstring[\mkibid]{ibidem}}}%
%   \ifloccit
%     {\global\toggletrue{cbx:loccit}}
%     {}}
%
% \renewbibmacro*{cite:ibid}{%
%   \printtext{%
%     \bibhyperlink{cite\csuse{cbx@lastcite@\thefield{entrykey}}}{%
%       \ifloccit
%         {\bibstring[\mkibid]{ibidem}%
%          \global\toggletrue{cbx:loccit}}
%         {\bibstring[\mkibid]{idem\thefield{gender}}}}}}

%%%%

\addbibresource{Bibliography.bib} % The references (bibliography) information are stored in the file named "Bibliography.bib"

% Reimplementation of and extensions to LaTeX verbatim
\usepackage{verbatim}  % Needed for the "comment" environment to make LaTeX comments
% Improved interface for floating objects
\usepackage{float} % To keep figures in place
% Make sure to load hyperref last of your loaded packages, and that hypertexnames is true so
% that bibliography backreferences work properly.
\AtEndPreamble{\RequirePackage{hyperref}}
\hypersetup{hypertexnames=true, urlcolor=black, colorlinks=false, pdfborder = {0 0 0}}  % Colours hyperlinks in blue
% Define enumerated description lists
% Control layout of itemize, enumerate, description
\usepackage{enumitem}
\newcounter{descriptcount}
\newcounter{descriptcount2}
\newlist{enumdescript}{description}{2}
\setlist[enumdescript,1]{%
  before={\setcounter{descriptcount}{0}%
          \renewcommand*\thedescriptcount{\arabic{descriptcount}.}}
  ,font=\bfseries\stepcounter{descriptcount}\thedescriptcount~
}
\setlist[enumdescript,2]{%
  before={\setcounter{descriptcount2}{0}%
          \renewcommand*\thedescriptcount{\roman{descriptcount2}.}}
  ,font=\bfseries\stepcounter{descriptcount2}\thedescriptcount~
}
