\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}
% Make landscape pages display as landscape
\usepackage{pdflscape}
% Better paragraph break in new pages
\usepackage[defaultlines=4,all]{nowidow}

% 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}{-0.9cm}{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 caused invidible overfull hbox
% 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}
%    {\textsc{\hspace{0cm}\normalsize\bfseries \thecontentslabel: }\normalsize\bfseries}
%    {\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

% Fix caption font but not "Σχήμα" and "Πίνακας"
\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={\textgreek{Αναφορά: σελίδα}},
  backrefpages={\textgreek{Αναφορά: σελίδες}},
  urlseen={\textgreek{Επίσκεψη}},
}

% https://tex.stackexchange.com/questions/29802/biblatex-and-new-line-for-doi-url-and-eprint
% 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{\par\nobreak}}
    {}}

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

\DeclareFieldFormat[inproceedings]{pages}{#1} % to not have "Στο σελίδες" in inproceedings

\renewcommand{\listoflistingscaption}{Κατάλογος Εντολών}
\renewcommand{\listingscaption}{\textgreek{Εντολή}}

% Correct font for Σχήμα and Πίνακας
\addto\captionsgreek{%
  \renewcommand{\figurename}{\textgreek{Σχήμα}}%
  \renewcommand{\tablename}{\textgreek{Πίνακας}}%
}

\newminted{bash}{style=sas,breaklines,frame=lines}

\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 black
% Define enumerated description lists
% Control layout of itemize, enumerate, description
\usepackage{enumitem}
% \usepackage[
%    type={CC},
%    modifier={by-nc-sa},
%    version={3.0},
% ]{doclicense}
\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~
}
