%%
%% This is file `Thesis.cls', based on 'ECSthesis.cls', by Steve R. Gunn
%% generated with the docstrip utility.
%%
%% Created by Steve R. Gunn, modified by Sunil Patel: www.sunilpatel.co.uk

\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesClass{Thesis}
              [2007/22/02 v1.0
   LaTeX document class]
\def\baseclass{book}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
\def\@checkoptions#1#2{
  \edef\@curroptions{\@ptionlist{\@currname.\@currext}}
  \@tempswafalse
  \@tfor\@this:=#2\do{
    \@expandtwoargs\in@{,\@this,}{,\@curroptions,}
    \ifin@ \@tempswatrue \@break@tfor \fi}
  \let\@this\@empty
  \if@tempswa \else \PassOptionsToClass{#1}{\baseclass}\fi
}
\@checkoptions{11pt}{{10pt}{11pt}{12pt}}
\PassOptionsToClass{a4paper}{\baseclass}
\ProcessOptions\relax
\LoadClass{\baseclass}

\usepackage{polyglossia}
\usepackage{fontspec}
% \defaultfontfeatures{Ligatures=TeX} % probably default behaviour
\setmainfont{CMU Serif}
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}
\setdefaultlanguage{greek}
\newfontfamily\greekfont[Script=Greek]{CMU Serif}
\setotherlanguage{english}
% Fixes the wrong λ in some places like bibliography where we need textenglish for hyphenation rules
\newfontfamily\englishfont[Script=Greek]{CMU Serif}

\usepackage{datetime}
\newdateformat{mydate}{\monthname[\THEMONTH] \THEYEAR}

\newcommand\bhrule{\typeout{------------------------------------------------------------------------------}}

\newcommand\Declaration[1]{
\btypeout{Declaration of Authorship}
\addtotoc{Δήλωση Συγγραφικής Ιδιότητας}
\thispagestyle{plain}
% \null\vfil
% \vskip 60\p@
\begin{center}{\huge\textbf{Δήλωση Συγγραφικής Ιδιότητας}\par}\end{center}
\vskip 50\p@
{\normalsize #1}
\vfil\vfil\null
% \cleardoublepage
}

\newcommand\btypeout[1]{\bhrule\typeout{\space #1}\bhrule}
\def\today{\ifcase\month\or
  Ιανουάριος\or Φεβρουάριος\or Μάρτιος\or Απρίλιος \or Μάιος\or Ιούνιος\or
  Ιούλιος\or Αύγουστος\or Σεπτέμβριος\or Οκτώβριος \or Νοέμβριος \or Δεκέμβριος \fi
  \space \number\year}
\usepackage{setspace}
\onehalfspacing
\setlength{\parindent}{20pt} % Changed from 0pt
\setlength{\parskip}{2.0ex plus0.5ex minus0.2ex}

\usepackage{geometry}
\geometry{
  a4paper,
%  showframe,
  left=0.9in,      % left margin % changed from 1.5in
  top=0.6in,       % top margin
  right=0.8in,     % right margin % changed from 1.0in
  bottom=0.8in,    % bottom margin
  headheight=20pt, % head height
  headsep=0.25in,  % head sep
  foot=9pt,        % foot height
  footskip=0.3in,  % foot sep
  includeheadfoot
}

\raggedbottom
\setlength{\topskip}{1\topskip \@plus 5\p@}
\doublehyphendemerits=10000       % No consecutive line hyphens.
\brokenpenalty=10000              % No broken words across columns/pages.
\widowpenalty=9999                % Almost no widows at bottom of page.
\clubpenalty=9999                 % Almost no orphans at top of page.
\interfootnotelinepenalty=9999    % Almost never break footnotes.
\usepackage{fancyhdr}
\lhead[\rm\thepage]{\fancyplain{}{\sl{\rightmark}}}
\rhead[\fancyplain{}{\sl{\leftmark}}]{\rm\thepage}
\chead{}\lfoot{}\rfoot{}\cfoot{}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\btypeout{\thechapter\space #1}\markboth{\@chapapp\ \thechapter\ #1}{\@chapapp\ \thechapter\ #1}}
\renewcommand{\sectionmark}[1]{}
\renewcommand{\subsectionmark}[1]{}
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\usepackage{amsmath,amsfonts,amssymb,amscd,amsthm,xspace}
\theoremstyle{plain}
\newtheorem{example}{Example}[chapter]
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{axiom}[theorem]{Axiom}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
% \usepackage[centerlast,small,sc]{caption} % caused small caps in caption category
\usepackage{caption}
\setlength{\captionmargin}{20pt}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{.85}
\renewcommand{\textfraction}{0.1}
\renewcommand{\dbltopfraction}{.85}
\renewcommand{\floatpagefraction}{0.75}
\renewcommand{\dblfloatpagefraction}{.75}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
\usepackage{graphicx}
\usepackage[scriptsize]{subfigure}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{listings}
\usepackage{minted}
\usepackage{multirow}
\usepackage{lstpatch}
\lstset{captionpos=b,
        frame=tb,
        basicstyle=\scriptsize\ttfamily,
        showstringspaces=false,
        keepspaces=true}
\lstdefinestyle{matlab} {
        language=Matlab,
        keywordstyle=\color{blue},
        commentstyle=\color[rgb]{0.13,0.55,0.13}\em,
        stringstyle=\color[rgb]{0.7,0,0} }
\usepackage[pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true,
   bookmarksopenlevel=0,bookmarksnumbered=true,hypertexnames=false,
   colorlinks,linkcolor={blue},citecolor={blue},urlcolor={red},
   pdfstartview={FitV},unicode,breaklinks=true,pdfusetitle]{hyperref}
\pdfstringdefDisableCommands{
   \let\\\space
}
\newcommand*{\examiner}[1]{\def\examname{#1}}
\newcommand*{\degree}[1]{\def\degreename{#1}}
\newcommand*{\authors}[1]{\def\authornames{#1}}
\newcommand*{\addresses}[1]{\def\addressnames{#1}}
\newcommand*{\university}[1]{\def\univname{#1}}
\newcommand*{\UNIVERSITY}[1]{\def\UNIVNAME{#1}}
\newcommand*{\department}[1]{\def\deptname{#1}}
\newcommand*{\DEPARTMENT}[1]{\def\DEPTNAME{#1}}
\newcommand*{\faculty}[1]{\def\facname{#1}}
\newcommand*{\FACULTY}[1]{\def\FACNAME{#1}}
\newcommand*{\subject}[1]{\def\subjectname{#1}}
\newcommand*{\keywords}[1]{\def\keywordnames{#1}}
\newcommand*{\supervisor}[1]{\def\supname{#1}}

\examiner    {}
\degree      {}
\authors     {}
\university  {\texorpdfstring{\href{https://www.aegean.gr/}
                {Πανεπιστήμιο Αιγαίου}}
                {University name}}
\UNIVERSITY  {\texorpdfstring{\href{https://www.aegean.gr/}
                {ΠΑΝΕΠΙΣΤΗΜΙΟ ΑΙΓΑΙΟΥ}}
                {UNIVERSITY NAME (IN BLOCK CAPITALS)}}
\department  {\texorpdfstring{\href{https://www.icsd.aegean.gr/}
                {Τμήμα Μηχανικών Πληροφοριακών και Επικοινωνιακών Συστημάτων}}
                {Department or School Name}}
\DEPARTMENT  {\texorpdfstring{\href{https://www.icsd.aegean.gr/}
                {ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ ΠΛΗΡΟΦΟΡΙΑΚΩΝ ΚΑΙ ΕΠΙΚΟΙΝΩΝΙΑΚΩΝ ΣΥΣΤΗΜΑΤΩΝ}}
                {DEPARTMENT OR SCHOOL NAME (IN BLOCK CAPITALS)}}
\faculty     {\texorpdfstring{\href{https://www.aegean.gr/schools/πολυτεχνική-σχολή}
                {Πολυτεχνική Σχολή}}
                {Faculty Name}}
\FACULTY     {\texorpdfstring{\href{https://www.aegean.gr/schools/πολυτεχνική-σχολή}
                {ΠΟΛΥΤΕΧΝΙΚΗ ΣΧΟΛΗ}}
                {FACULTY NAME (IN BLOCK CAPITALS)}}
\supervisor  {
            \texorpdfstring{
                {Επιβλέπων Καθηγητής:}
                \href{https://www.icsd.aegean.gr/profile.php?member=2112}{Δρ. Κρητικός Κυριάκος}\\
                {Αναπληρωτής Καθηγητής Τμήματος ΜΠΕΣ}\\
                \vspace{10pt}
                {Μέλη εξεταστικής επιτροπής:}
                \vfill
                \href{https://www.icsd.aegean.gr/profile.php?member=one}{κάποιος,}\hskip 3em
                \href{https://www.icsd.aegean.gr/profile.php?member=two}{κάποιος άλλος}
            }
                {Supervising Proffessor's name and committee member's names}
            }

\addresses   {}
\subject     {}
\keywords    {}
\renewcommand\maketitle{
  \btypeout{Title Page}
  \hypersetup{pdftitle={\@title}}
  \hypersetup{pdfsubject=\subjectname}
  \hypersetup{pdfauthor=\authornames}
  \hypersetup{pdfkeywords=\keywordnames}
  \thispagestyle{empty}
  \begin{titlepage}
    \let\footnotesize\small
    \let\footnoterule\relax
    \let \footnote \thanks
    \setcounter{footnote}{0}
    \null\vfil
    \vskip 0\p@
    \begin{center}
        \begin{figure}
            \centering
	    \vspace{1pt}
            \includegraphics[scale=0.15]{Figures/aegean_logo}
        \end{figure}
      \setlength{\parskip}{0pt}
      {\large\textbf{\UNIVNAME}\par}
      \vfill
      {\LARGE \textbf \@title \par}
      \vfill
      {\large του \par}
      \smallskip
      {\LARGE \authornames \par}
      \vfill
      {\large Εκπόνηση διπλωματικής ως μέρος του \par}
      {\large Προπτυχιακού Τίτλου Σπουδών \par}
      \bigskip
      \bigskip
      {\large στη \par}
      {\large \facname \par}
      {\large \deptname \par}
      \bigskip
      \bigskip
      {\large \supname \par}
      \bigskip
      \bigskip
      \bigskip
      \bigskip
      {\Large \@date \par}
    \end{center}
    \par
    \@thanks
    \vfil\null
  \end{titlepage}
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
  \cleardoublepage
}
\newenvironment{abstract}
{
  \btypeout{Abstract Page}
  \thispagestyle{empty}
  \null\vfil
  \begin{center}
    \setlength{\parskip}{0pt}
    {\normalsize \UNIVNAME \par}
    \bigskip
    \bigskip
    {\huge{\textgreek{\textbf{Σύνοψη}}} \par}
    \bigskip
    \bigskip
    {\normalsize \facname \par}
    {\normalsize \deptname \par}
    \bigskip
    {\normalsize Προπτυχιακός Τίτλος Σπουδών \par}
    \bigskip
    {\normalsize \textbf{Σκλήρυνση Μηχανής Δοχείων και Λειτουργικού Συστήματος σε Περιβάλλοντα Linux} \par}
    \medskip
    {\normalsize του \authornames \par}
    \bigskip
  \end{center}
}
{
  \vfil\vfil\vfil\null
  \cleardoublepage
}
\newenvironment{abstractenglish}
{
  \btypeout{Abstract Page}
  \thispagestyle{empty}
  \null\vfil
  \begin{center}
    \setlength{\parskip}{0pt}
    \vspace{-5pt}
    {\normalsize \href{https://www.aegean.gr/}{University of the Aegean} \par}
    \bigskip
    \bigskip
    \vspace{-5pt}
    {\huge{\textgreek{\textbf{Abstract}}} \par}
    \bigskip
    \bigskip
    {\normalsize \href{https://www.aegean.edu/departments-schools/}{School of Engineering} \par}
    {\normalsize \href{https://www.icsd.aegean.gr/tmima_en}{Department of Information and Communication Systems Engineering} \par}
    \bigskip
    {\normalsize Undergraduate Studies \par}
    \bigskip
    {\normalsize \textbf{Container Engine and Operating System Hardening in Linux Environments} \par}
    \medskip
    {\normalsize of \href{mailto:konsthol@proton.me}{Cholidis Konstantinos} \par}
    \bigskip
  \end{center}
}
{
  \vfil\vfil\vfil\null
  \cleardoublepage
}
\addtocounter{secnumdepth}{1}
\setcounter{tocdepth}{6}
\newcounter{dummy}
\newcommand\addtotoc[1]{
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{#1}}
\renewcommand\tableofcontents{
\btypeout{Table of Contents}
\begin{spacing}{1}{
    \setlength{\parskip}{1pt}
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\contentsname
        \@mkboth{
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
    \@starttoc{toc}
    \if@restonecol\twocolumn\fi
   \cleardoublepage
}\end{spacing}
}
\renewcommand\listoffigures{
\btypeout{Λίστα Σχημάτων}
\begin{spacing}{1}{
    \setlength{\parskip}{1pt}
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listfigurename
      \@mkboth{\MakeUppercase\listfigurename}
              {\MakeUppercase\listfigurename}}
    \@starttoc{lof}
    \if@restonecol\twocolumn\fi
    \cleardoublepage
}\end{spacing}
}
\renewcommand\listoftables{
\btypeout{Λίστα Πινάκων}
\addtotoc{Λίστα Πινάκων}
\begin{spacing}{1}{
    \setlength{\parskip}{1pt}
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listtablename
      \@mkboth{
          \MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
    \@starttoc{lot}
    \if@restonecol\twocolumn\fi
    \cleardoublepage
}\end{spacing}
}

% Adjusts the listoflistings title at the same height as the rest
\usepackage{etoolbox}
\let\l@listing\l@figure
\let\listoflistings\listoffigures
\patchcmd{\listoflistings}{lof}{lol}{}{}
\patchcmd{\listoflistings}{\listfigurename}{\listoflistingscaption}{}{}
\patchcmd{\listoflistings}{\listfigurename}{\listoflistingscaption}{}{}
\patchcmd{\listoflistings}{\listfigurename}{\listoflistingscaption}{}{}

\newcommand\listsymbolname{Συντομογραφίες}
\usepackage{longtable}
\newcommand\listofsymbols[2]{
\btypeout{\listsymbolname}
\addtotoc{\listsymbolname}
    \chapter*{\listsymbolname
      \@mkboth{
          \MakeUppercase\listsymbolname}{\MakeUppercase\listsymbolname}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
    \cleardoublepage
}

\newcommand\listconstants{Φυσικές Σταθερές}
\usepackage{longtable}
\newcommand\listofconstants[2]{
\btypeout{\listconstants}
\addtotoc{\listconstants}
    \chapter*{\listconstants
      \@mkboth{
          \MakeUppercase\listconstants}{\MakeUppercase\listconstants}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
    \cleardoublepage
}
\newcommand\listnomenclature{Σύμβολα}
\usepackage{longtable}
\newcommand\listofnomenclature[2]{
\btypeout{\listnomenclature}
\addtotoc{\listnomenclature}
    \chapter*{\listnomenclature
      \@mkboth{
          \MakeUppercase\listnomenclature}{\MakeUppercase\listnomenclature}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
    \cleardoublepage
}
\newcommand\acknowledgements[1]{
\btypeout{Acknowledgements}
\addtotoc{Ευχαριστίες}
\thispagestyle{plain}
\begin{center}{\huge{\textbf{Ευχαριστίες}} \par}\end{center}
{\normalsize #1}
\vfil\vfil\null

}
\newcommand\dedicatory[1]{
\btypeout{Dedicatory}
\thispagestyle{plain}
\null\vfil
\vskip 60\p@
\begin{center}{\Large \sl #1}\end{center}
\vfil\null
\cleardoublepage
}
\renewcommand\backmatter{
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \addtotoc{\bibname}
  \btypeout{\bibname}
  \@mainmatterfalse}
\endinput
%%
%% End of file `Thesis.cls'.
