%%
%% This is file `fithesis-base.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% base.dtx  (with options: `base')
%% 
%% Copyright 1998--2020  Daniel Marek (DM), Jan Pavlovič (JP),
%%                       Vít Novotný (VN), Petr Sojka (PS)
%% http://www.fi.muni.cz/tech/unix/tex/fithesis.xhtml
%% Faculty of Informatics, Masaryk University (Brno, Czech Republic)
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version
%% 1.3 of this license or (at your option) any later version.
%% The latest version of this license is available at
%% 
%%   http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Vít Novotný (VN).
%% Send bug reports, requests for additions and questions
%% either to the fithesis discussion forum at
%% 
%%   http://is.muni.cz/auth/df/fithesis-sazba/
%% 
%% or to the e-mail address <witiko@mail.muni.cz>.
%% 
%% 
%% MODIFICATION ADVICE:
%% 
%% If you want to customize this file, it is best to make a copy of
%% the source file(s) from which it was produced.  Use a different
%% name for your copy(ies) and modify the copy(ies); this will ensure
%% that your modifications do not get overwritten when you install a
%% new release of the standard system.  You should also ensure that
%% your modified source file does not generate any modified file with
%% the same name as a standard file.
%% 
%% You will also need to produce your own, suitably named, .ins file to
%% control the generation of files from your source file; this file
%% should contain your own preambles for the files it generates, not
%% those in the standard .ins files.
%% 
%% The names of the source files used are shown above.
%% 
\ProvidesPackage{fithesis/style/mu/fithesis-base}[2018/12/25]
\NeedsTeXFormat{LaTeX2e}
\DeclareOption{10pt}{\def\thesis@ptsize{0}}
\DeclareOption{11pt}{\def\thesis@ptsize{1}}
\DeclareOption{12pt}{\def\thesis@ptsize{2}}
\newif\ifthesis@twoside@
\DeclareOption{oneside}{%
  \thesis@twoside@false\@twosidefalse\@mparswitchfalse}
\DeclareOption{twoside}{%
  \thesis@twoside@true \@twosidetrue \@mparswitchtrue}
\DeclareOption{onecolumn}{\@twocolumnfalse}
\DeclareOption{twocolumn}{\@twocolumntrue}
\DeclareOption{draft}{\setlength\overfullrule{5pt}}
\DeclareOption{final}{\setlength\overfullrule{0pt}}
\newif\ifthesis@palatino@
\DeclareOption{palatino}{\thesis@palatino@true}
\DeclareOption{nopalatino}{\thesis@palatino@false}
\newif\ifthesis@color@
\DeclareOption{monochrome}{\thesis@color@false}
\DeclareOption{color}{\thesis@color@true}
\newif\ifthesis@microtype@
\DeclareOption{microtype}{\thesis@microtype@true}
\DeclareOption{nomicrotype}{\thesis@microtype@false}
\newif\ifthesis@newtable@
\DeclareOption{table}{\thesis@newtable@true}
\DeclareOption{oldtable}{\thesis@newtable@false}
\DeclareOption{nolot}{\let\thesis@blocks@lot\relax}
\DeclareOption{lot}{\let\thesis@blocks@lot\listoftables}
\DeclareOption{nolof}{\let\thesis@blocks@lof\relax}
\DeclareOption{lof}{\let\thesis@blocks@lof\listoffigures}
\newif\ifthesis@cover@
\DeclareOption{nocover}{\thesis@cover@false}
\DeclareOption{cover}{\thesis@cover@true}
\newif\ifthesis@digital@
\DeclareOption{digital}{%
  \ExecuteOptions{color,cover}%
  \thesis@digital@true}
\DeclareOption{printed}{%
  \ExecuteOptions{monochrome,nocover}%
  \thesis@digital@false}
\ExecuteOptions{%
  printed,12pt,twoside,final,microtype,palatino,oldtable,lot,lof}
\ProcessOptions*
\thesis@requireLocale{english}
\thesis@require{xcolor}
\thesis@require{graphicx}
\thesis@require{pdfpages}
\thesis@require{keyval}
\thesis@require{ifxetex}
\thesis@require{ifluatex}
\ifthesis@microtype@
  \thesis@require[final,babel]{microtype}
\fi
{\let\x\expandafter
\x\global\x\let\x\ifthesis@xeluatex\csname if%
  \ifxetex true\else
    \ifluatex\x\x\x t\x\x\x r\x\x\x u\x\x\x e%
    \else   f\x\x\x a\x\x\x l\x\x\x s\x\x\x e%
    \fi
  \fi\endcsname}
\ifthesis@xeluatex
  \ifthesis@palatino@
    \thesis@require{fontspec}
    \thesis@require{unicode-math}
    \setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
    \setmathfont[math-style=ISO,bold-style=ISO]{texgyrepagella-math.otf}
  \fi
\else
  \ifthesis@palatino@
    \RequirePackage[resetfonts]{cmap}
    \thesis@require{lmodern}
    \thesis@require{mathpazo}
    \thesis@require{tgpagella}
    \RequirePackage[T1]{fontenc}
  \fi
\fi
\let\thesis@newtable@old\tabular
\let\endthesis@newtable@old\endtabular
\ifthesis@newtable@
  % Load the packages.
  \thesis@require{tabularx}
  \thesis@require{tabu}
  \thesis@require{booktabs}
  % Adjust the measurements.
  \setlength{\aboverulesep}{0pt}
  \setlength{\belowrulesep}{0pt}
  \setlength{\extrarowheight}{.75ex}
  \ifthesis@color@
    % The redefinition of `tabular`
    \renewenvironment{tabular}%
      {\rowcolors{1}{thesis@color@tableOdd}%
                    {thesis@color@tableEven}%
       \thesis@newtable@old}%
      {\endthesis@newtable@old}
    % The redefinition of `tabularx`
    \let\thesis@newtable@oldx\tabularx
    \let\endthesis@newtable@oldx\endtabularx
    \renewenvironment{tabularx}%
      {\rowcolors{1}{thesis@color@tableEven}%
                    {thesis@color@tableOdd}%
       \thesis@newtable@oldx}%
      {\endthesis@newtable@oldx}
    % The redefinition of `tabu`
    \let\thesis@newtable@oldtabu\tabu
    \let\endthesis@newtable@oldtabu\endtabu
    \renewenvironment{tabu}%
      {\rowcolors{1}{thesis@color@tableEven}%
                    {thesis@color@tableOdd}%
       \thesis@newtable@oldtabu}%
      {\endthesis@newtable@oldtabu}
  \fi
\fi
\newif\ifthesis@bibliography@
\thesis@bibliography@false
\ifx\thesis@bibFiles\undefined\else
  {\edef\@bibList{\thesis@bibFiles}%
  \ifx\@bibList\empty\else
    \global\thesis@bibliography@true
  \fi}
\fi
\def\thesis@bibliography@setup#1{%
  \setkeys{thesis@bibliography}{#1}}
\define@key{thesis@bibliography}{style}{%
  \ifx\thesis@bibliography@style\undefined
    \def\thesis@bibliography@style{#1}%
  \fi}
\define@key{thesis@bibliography}{sorting}{%
  \ifx\thesis@bibliography@sorting\undefined
    \def\thesis@bibliography@sorting{#1}%
  \fi}
\thesis@def@extra[]{bibliography}
\ifx\thesis@extra@bibliography
    \thesis@placeholder@extra@bibliography\else
  \expandafter\thesis@bibliography@setup\expandafter{%
    \thesis@extra@bibliography}%
\fi
\newif\ifthesis@bibliography@loaded@
  \thesis@bibliography@loaded@false
\newif\ifthesis@bibliography@included@
  \thesis@bibliography@included@false
\def\thesis@bibliography@load{%
  \ifthesis@bibliography@
    \ifthesis@bibliography@loaded@\else
      \thesis@bibliography@loaded@true
      % Load csquotes and BibLaTeX.
      \thesis@require{csquotes}
      \thesis@bibliography@setup{
        style = iso-numeric,
        sorting = none}
      \thesis@require[
        backend=biber,
        style=\thesis@bibliography@style,
        sorting=\thesis@bibliography@sorting,
        autolang=other,
        sortlocale=auto]{biblatex}
      % Load the bibliography databases.
      {\edef\@bibList{\thesis@bibFiles}%
      \def\@inject##1,{%
        \def\@args{##1}\def\@relax{\relax}%
        \ifx\@args\@relax\else
          % Trim leading spaces.
          \edef\@trimmed{\romannumeral-`\.##1}%
          \addbibresource\@trimmed
          \expandafter\@inject\fi}%
      \expandafter\@inject\@bibList,\relax,}%
      \let\thesis@printbibliography@old\printbibliography
      \def\printbibliography{%
        \global\thesis@bibliography@included@true
        \thesis@printbibliography@old}
    \fi
  \fi}
\thesis@require{hyperref}
\ifthesis@digital@
  \hypersetup{pdfborderstyle={/S/U/W 1}}
\else
  \hypersetup{hidelinks}
\fi
\widowpenalty 10000
\clubpenalty  10000
\def\thesis@color@setup#1{%
  \setkeys{thesis@color}{#1}}
\define@key{thesis@color}{links}{%
  \definecolor{thesis@color@links}#1
  \hypersetup{linkbordercolor=thesis@color@links}}
\define@key{thesis@color}{tableOdd}{%
  \definecolor{thesis@color@tableOdd}#1}
\define@key{thesis@color}{tableEven}{%
  \definecolor{thesis@color@tableEven}#1}
\define@key{thesis@color}{tableEmph}{%
  \definecolor{thesis@color@tableEmph}#1}
\def\thesis@blocks@coverMatter{%
  \pagenumbering{gobble}}
\def\thesis@blocks@frontMatter{%
  \thesis@blocks@clear
  \pagestyle{plain}
  \parindent 1.5em
  \setcounter{page}{1}
  \pagenumbering{roman}}
\def\thesis@blocks@clear{%
  \ifthesis@twoside@
    \clearpage
    \ifodd\value{page}\else%
      \thispagestyle{empty}%
      \hbox{}%
      \newpage
    \fi
  \else
    \newpage
  \fi}
\def\thesis@blocks@clearRight{%
  \ifthesis@twoside@
    \clearpage
    \ifodd\value{page}%
      \thispagestyle{empty}%
      \hbox{}%
      \newpage
    \fi
  \else
    \newpage
  \fi}
\newcommand{\thesis@blocks@facultyLogo@monochrome}[1]%
  [width=40mm]{{%
    \edef\@path{\thesis@logopath\thesis@facultyLogo}%
    \includegraphics[#1]{\@path}}}
\newcommand{\thesis@blocks@facultyLogo@color}[1]%
  [width=40mm]{{%
    \edef\@path{\thesis@logopath\thesis@facultyLogo
      \ifthesis@color@-color\fi}%
    \includegraphics[#1]{\@path}}}
\newcommand{\thesis@blocks@universityLogo@monochrome}[1]%
  [width=40mm]{{%
    \edef\@path{\thesis@logopath\thesis@universityLogo}%
    \includegraphics[#1]{\@path}}}
\newcommand{\thesis@blocks@universityLogo@color}[1]%
  [width=40mm]{{%
    \edef\@path{\thesis@logopath\thesis@universityLogo
      \ifthesis@color@-color\fi}%
    \includegraphics[#1]{\@path}}}
\let\thesis@department@name\thesis@department
\let\thesis@departmentEn@name\thesis@departmentEn
\let\thesis@field@name\thesis@field
\let\thesis@fieldEn@name\thesis@fieldEn
\def\thesis@blocks@cover{%
  \ifthesis@cover@
    \thesis@blocks@clear
    \begin{alwayssingle}%
      \thispagestyle{empty}%
      \begin{center}%
        \thesis@blocks@cover@header
        \thesis@blocks@facultyLogo@monochrome\\[0.4in]%
        \let\footnotesize\small
        \let\footnoterule\relax{}%
        \thesis@blocks@cover@content
        \par\vfill
        \thesis@blocks@cover@footer
      \end{center}%
    \end{alwayssingle}%
  \fi}
\newif\ifthesis@blocks@cover@university@
\thesis@blocks@cover@university@true
\newif\ifthesis@blocks@cover@faculty@
\thesis@blocks@cover@faculty@true
\newif\ifthesis@blocks@cover@department@
\thesis@blocks@cover@department@false
\newif\ifthesis@blocks@cover@field@
\thesis@blocks@cover@field@false

\def\thesis@blocks@cover@header{%
  {\sc\ifthesis@blocks@cover@university@
        \thesis@titlePage@LARGE\thesis@@{universityName}\\%
   \fi\ifthesis@blocks@cover@faculty@
        \thesis@titlePage@Large\thesis@@{facultyName}\\%
   \fi\ifthesis@blocks@cover@department@
        \thesis@titlePage@large\thesis@department@name\\%
      \fi}
  \ifthesis@blocks@cover@field@
    {\thesis@titlePage@large\vskip 1em%
      {\bf\thesis@@{fieldTitle}:} \thesis@field@name}%
  \fi\vskip 2em}
\def\thesis@blocks@cover@content{%
  {\thesis@titlePage@Huge\bf\thesis@TeXtitle\par\vfil}%
  \vskip 0.8in%
  {\thesis@titlePage@large\sc\thesis@@{typeName}}\\[0.3in]%
  {\thesis@titlePage@Large\bf\thesis@author}}
\def\thesis@blocks@cover@footer{%
  {\thesis@titlePage@large\thesis@place, \thesis@@{semester}}}
\def\thesis@blocks@titlePage{%
    \thesis@blocks@clear
    \begin{alwayssingle}%
      \thispagestyle{empty}%
      \begin{center}%
        \thesis@blocks@titlePage@header
        \thesis@blocks@facultyLogo@color\\[0.4in]%
        \let\footnotesize\small
        \let\footnoterule\relax{}%
        \thesis@blocks@titlePage@content
        \par\vfill
        \thesis@blocks@titlePage@footer
      \end{center}%
    \end{alwayssingle}}
\newif\ifthesis@blocks@titlePage@university@
\thesis@blocks@titlePage@university@true
\newif\ifthesis@blocks@titlePage@faculty@
\thesis@blocks@titlePage@faculty@true
\newif\ifthesis@blocks@titlePage@department@
\thesis@blocks@titlePage@department@false
\newif\ifthesis@blocks@titlePage@field@
\thesis@blocks@titlePage@field@false

\def\thesis@blocks@titlePage@header{%
  {\sc\ifthesis@blocks@titlePage@university@
        \thesis@titlePage@LARGE\thesis@@{universityName}\\%
   \fi\ifthesis@blocks@titlePage@faculty@
        \thesis@titlePage@Large\thesis@@{facultyName}\\%
   \fi\ifthesis@blocks@titlePage@department@
        \thesis@titlePage@large\thesis@department@name\\%
      \fi}
  \ifthesis@blocks@titlePage@field@
    {\thesis@titlePage@large\vskip 1em%
      {\bf\thesis@@{fieldTitle}:} \thesis@field@name}%
  \fi\vskip 2em}
\let\thesis@blocks@titlePage@content=\thesis@blocks@cover@content
\let\thesis@blocks@titlePage@footer=\thesis@blocks@cover@footer
\def\thesis@blocks@toc{%
  \thesis@blocks@clear
  \tableofcontents}
\def\thesis@blocks@tables{%
  \thesis@blocks@toc
  \thesis@blocks@lot
  \thesis@blocks@lof}
\def\thesis@blocks@declaration{%
  \thesis@blocks@clear
  \begin{alwayssingle}%
    \chapter*{\thesis@@{declarationTitle}}%
    \thesis@declaration
    \vskip 2cm%
    \hfill\thesis@author
  \end{alwayssingle}}
\def\thesis@blocks@thanks{%
  \ifx\thesis@thanks\undefined\else
    \thesis@blocks@clear
    \begin{alwayssingle}%
      \chapter*{\vspace*{\fill}\thesis@@{thanksTitle}}%
      \leavevmode\thesis@thanks
    \end{alwayssingle}%
  \fi}
\def\thesis@blocks@abstract{%
  \begin{alwayssingle}%
    % Start the new chapter without clearing the left page.
    \clearpage
    {\let\thesis@blocks@clear\relax
    \chapter*{\thesis@@{abstractTitle}}}%
    \noindent\thesis@abstract
    \par\vfil\null
  \end{alwayssingle}}
\def\thesis@blocks@abstractEn{%
  \ifthesis@english\else
    {\thesis@selectLocale{english}%
    \begin{alwayssingle}%
      % Start the new chapter without clearing the left page.
      \clearpage
      {\let\thesis@blocks@clear\relax
      \chapter*{\thesis@english@abstractTitle}}%
      \noindent\thesis@abstractEn
      \par\vfil\null
    \end{alwayssingle}}%
  \fi}
\def\thesis@blocks@keywords{%
  \begin{alwayssingle}%
    % Start the new chapter without clearing the left page.
    \clearpage
    {\let\thesis@blocks@clear\relax
    \chapter*{\thesis@@{keywordsTitle}}%
    \noindent\thesis@TeXkeywords}%
    \par\vfil\null
  \end{alwayssingle}}
\def\thesis@blocks@keywordsEn{%
  \ifthesis@english\else
    {\thesis@selectLocale{english}%
    \begin{alwayssingle}%
      % Start the new chapter without clearing the left page.
      \clearpage
      {\let\thesis@blocks@clear\relax%
      \chapter*{\thesis@english@keywordsTitle}}%
      \noindent\thesis@TeXkeywordsEn
      \par\vfil\null
    \end{alwayssingle}}%
  \fi}
\def\thesis@rewind{%
  \addtocounter{page}{-\ifthesis@twoside@2\else1\fi}}
\newif\ifthesis@blocks@assignment@
\thesis@blocks@assignment@true
\newif\ifthesis@blocks@assignment@hideIfDigital@
\thesis@blocks@assignment@hideIfDigital@true
\def\thesis@blocks@assignment{%
  \ifthesis@blocks@assignment@
    \ifx\thesis@assignmentFiles\undefined
      % Rewind the pages and typeset a placeholder page.
      \thesis@blocks@clear
      \begin{alwayssingle}%
        \thispagestyle{empty}\thesis@rewind
        \noindent\textit{\thesis@@{assignment}}%
      \end{alwayssingle}%
    \else
      {\edef\@pdfList{\thesis@assignmentFiles}%
      \let\ea\expandafter
      % Injects the specified PDF documents.
      \def\@inject##1,{\thesis@blocks@clear
        \def\@args{##1}\def\@relax{\relax}%
        \ifx\@args\@relax\else
          % Trim leading spaces.
          \edef\@trimmed{\romannumeral-`\.##1}%
          % Rewind the pages and include the PDF.
          \thesis@rewind\includepdf[pages=-]\@trimmed
          \ea\@inject\fi}%
      \ifx\@pdfList\empty\else
        \ifthesis@digital@
          \ifthesis@blocks@assignment@hideIfDigital@
            \thesis@blocks@clear
            \begin{alwayssingle}%
              \thispagestyle{empty}\thesis@rewind
              \noindent\textit{\thesis@@{assignment}}%
            \end{alwayssingle}%
          \else
            \ea\@inject\@pdfList,\relax,%
          \fi
        \else
          \ea\@inject\@pdfList,\relax,%
        \fi
      \fi}%
    \fi
  \fi}
\def\thesis@blocks@mainMatter{%
  \thesis@blocks@clear
  \setcounter{page}{1}
  \pagenumbering{arabic}
  \pagestyle{thesisheadings}
  \parindent 1.5em\relax}
\def\thesis@blocks@bibEntry{%
  \chapter*{\thesis@@{bib@title}}
  \noindent\thesis@upper{author@tail}, \thesis@author@head.
  \emph{\thesis@title}. \thesis@place: \thesis@@{universityName},
  \thesis@@{facultyName}, \thesis@department@name, \thesis@year.
  \thesis@pages\ \thesis@@{bib@pages}.
  \thesis@@{advisorTitle}: \thesis@advisor
  \thesis@blocks@clearRight}
\def\thesis@blocks@bibliography{%
  \ifthesis@bibliography@loaded@
    \ifthesis@bibliography@included@\else
      \thesis@blocks@clear
      {\emergencystretch=3em%
      \printbibliography[heading=bibintoc]}%
    \fi
  \fi}
\setcounter{tocdepth}{2}

\setcounter{secnumdepth}{2}

\input\thesis@stylepath mu/fithesis-1\thesis@ptsize.clo\relax

\def\ps@thesisheadings{%
  \def\chaptermark##1{%
    \markright{%
      \ifnum\c@secnumdepth >\m@ne
        \thechapter.\ %
      \fi ##1}}
  \let\@oddfoot\@empty
  \let\@oddhead\@empty
  \def\@oddhead{%
    \vbox{%
      \hbox to \textwidth{%
      \hfil{\sc\rightmark}}%
      \vskip 4pt\hrule}}
  \if@twoside
    \def\@evenhead{%
      \vbox{%
        \hbox to \textwidth{%
          {\sc\rightmark}%
          \hfil}
        \vskip 4pt\hrule}}
  \else
    \let\@evenhead\@oddhead
  \fi
  \def\@oddfoot{\hfil\PageFont\thepage}
  \if@twoside
    \def\@evenfoot{\PageFont\thepage\hfil}%
  \else
    \let\@evenfoot\@oddfoot
  \fi
  \let\@mkboth\markboth}

\renewcommand*\chapter{%
  \thesis@blocks@clear
  \thispagestyle{plain}%
  \global\@topnum\z@
  \@afterindentfalse
  \secdef\@chapter\@schapter}

\renewcommand*\part{%
  \thesis@blocks@clear
  \if@twocolumn
    \onecolumn
    \@tempswatrue
  \else
    \@tempswafalse
  \fi
  \hbox{}\vfil
  \secdef\@part\@spart}

\newif\if@restonecol
\def\alwayssingle{%
  \@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi}
\def\endalwayssingle{\if@restonecol\twocolumn\fi}

\pdfstringdefDisableCommands{%
  \let\MakeUppercase\relax}

\renewcommand*\toc@font[1]{%
  \ifcase #1\relax
    \bfseries % \chapter (0)
  \or
    \slshape  % \section (1)
  \else
    \rmfamily % \subsection (2), \subsubsection (3)
              % \paragraph, \subparagraph (4)
  \fi}

\renewcommand*\l@part[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty{-\@highpenalty}%
    \ifnum \c@tocdepth >0\relax
      \addvspace{2.25em \@plus\p@}%
    \else
      \addvspace{1.0em \@plus\p@}%
    \fi
    \begingroup
      \setlength\@tempdima{3em}%
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
       \normalfont \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
       \nobreak
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}%
    \endgroup
  \fi}

\renewcommand*\l@chapter[2]{%
  \ifnum \c@tocdepth >0\relax
    \addpenalty{-\@highpenalty}%
    \addvspace{1.0em \@plus\p@}%
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
      \penalty\@highpenalty
    \endgroup
  \else
    \@dottedtocline{0}{0em}{1.5em}{#1}{#2}
  \fi}

\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
\renewcommand*\l@paragraph{\@dottedtocline{4}{10.0em}{5.0em}}
\renewcommand*\l@subparagraph{\@dottedtocline{4}{12.0em}{6.0em}}
\endinput
%%
%% End of file `fithesis-base.sty'.
