% \file{style/mu/fithesis-fsps.sty}
% This is the style file for the theses written at the Faculty of
% Sports Studies at the Masaryk University in Brno. It has been
% prepared in accordance with the formal requirements published at
% the website of the faculty\footnote{See \url{http://www.fsps.^^A
% muni.cz/~korvas/pokyny_k_zaverecne_praci.doc}}.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fithesis/style/mu/fithesis-fsps}[2016/04/18]
%    \end{macrocode}
% The file defines the color scheme of the respective faculty. Note
% the the color definitions are in RGB, which makes the resulting
% files generally unsuitable for printing.
%    \begin{macrocode}
\thesis@color@setup{
  links={HTML}{93BCF5},
  tableEmph={HTML}{A8BDE3},
  tableOdd={HTML}{EBEFF5},
  tableEven={HTML}{D1DAEB}}
%    \end{macrocode}
% The bibliography support is enabled. The |authoryear| citations
% are used and the bibliography is sorted by name, title, and year.
%    \begin{macrocode}
\thesis@bibliography@setup{
  style=iso-authoryear,
  sorting=nty}
\thesis@bibliography@load
%    \end{macrocode}
% The file loads the following packages:
% \begin{itemize}
%   \item\textsf{tikz} -- Used for dimension arithmetic.
%   \item\textsf{geometry} -- Allows for modifications of the type
%     area dimensions.
%   \item\textsf{setspace} -- Allows for line height modifications.
% \end{itemize}
% In addition to this, the type area width is set to
% 14\,cm in accordance with the formal requirements of the faculty.
%    \begin{macrocode}
\thesis@require{tikz}
\thesis@require{geometry}
\thesis@require{setspace}
\geometry{top=30mm,bottom=30mm,left=40mm,right=30mm,includeheadfoot}
%    \end{macrocode}
% The paragraph indentation is 1.25\,cm as per the requirements of the faculty.
%    \begin{macrocode}
\setlength{\parindent}{1.25cm}
%    \end{macrocode}
% The style file redefines the title page content
% not to include the author's name and the title page footer
% to include both the author's and advisor's name, the year and
% place of the thesis defense in accordance with the formal
% requirements of the faculty.
%    \begin{macrocode}
\def\thesis@blocks@titlePage@footer{%
  {\thesis@titlePage@large
    {% Calculate the width of the thesis author and advisor boxes
     \let\@A\relax\newlength{\@A}\settowidth{\@A}{{%
       \bf\thesis@@{advisorTitle}:}}
     \let\@B\relax\newlength{\@B}\settowidth{\@B}{\thesis@advisor}
     \let\@C\relax\newlength{\@C}\settowidth{\@C}{{%
       \bf\thesis@@{authorTitle}:}}
     \let\@D\relax\newlength{\@D}\settowidth{\@D}{\thesis@author}
     \let\@E\relax\newlength{\@E}\settowidth{\@E}{\thesis@field}
     \let\@F\relax\newlength{\@F}\pgfmathsetlength{\@F}{max(\@D,\@E)}
    \let\@left\relax\newlength{\@left}\pgfmathsetlength{\@left}{%
      max(\@A,\@B)}
    \let\@right\relax\newlength{\@right}\pgfmathsetlength{\@right}{%
      max(\@C,\@F)}
    % Typeset the thesis author and advisor boxes
    \vskip 2in\begin{minipage}[t]{\@left}
      {\bf\thesis@@{advisorTitle}:}\\\thesis@advisor
    \end{minipage}\hfill\begin{minipage}[t]{\@right}
      {\bf\thesis@@{authorTitle}:}\\\thesis@author\\\thesis@field
    \end{minipage}}\\[4em]\thesis@place, \thesis@year}}
%    \end{macrocode}
% \begin{macro}{\thesis@blocks@frontMatter}
% The |\thesis@blocks@frontMatter| macro sets up the style of the
% front matter of the thesis. The leading is adjusted in
% accordance with the requirements of the faculty.
% \begin{macrocode}
\def\thesis@blocks@frontMatter{%
  \thesis@blocks@clear
  \pagestyle{plain}
  \parindent 1.5em
  \setcounter{page}{1}
  \pagenumbering{roman}
  \onehalfspacing}
%    \end{macrocode}
% \end{macro}\begin{macro}{\thesis@blocks@mainMatter}
% The |\thesis@blocks@mainMatter| macro sets up the style
% of the main matter of the thesis. The leading is adjusted in
% accordance with the requirements of the faculty.
% \begin{macrocode}
\def\thesis@blocks@mainMatter{%
  \thesis@blocks@clear
  \setcounter{page}{1}
  \pagenumbering{arabic}
  \pagestyle{thesisheadings}
  \parindent 1.5em
  \onehalfspacing}
%    \end{macrocode}
% \end{macro}\begin{macro}{\thesis@blocks@bibliography}
% The |\thesis@blocks@bibliography| macro typesets the
% bibliography. The leading is adjusted in accordance
% with the requirements of the faculty.
% \begin{macrocode}
\def\thesis@blocks@bibliography{%
  \ifthesis@bibliography@loaded@
    \ifthesis@bibliography@included@\else
      \singlespacing
      \thesis@blocks@clear
      {\emergencystretch=3em%
      \printbibliography[heading=bibintoc]}%
    \fi
  \fi}
%    \end{macrocode}
% \end{macro}
% Note that there is no direct support for the seminar paper and
% thesis proposal types.  If you would like to change the contents
% of the preamble and the postamble, you should modify the
% |\thesis@blocks@preamble| and |\thesis@blocks@postamble| macros.
%
% All blocks within the autolayout preamble and postamble that are
% not defined within this file are defined in the
% \texttt{style/mu/fithesis-base.sty} file.
%    \begin{macrocode}
\def\thesis@blocks@preamble{%
  \thesis@blocks@coverMatter
    \thesis@blocks@cover
    \thesis@blocks@titlePage
  \thesis@blocks@frontMatter
    \thesis@blocks@declaration
    \thesis@blocks@thanks
    \thesis@blocks@tables}
\def\thesis@blocks@postamble{%
  \thesis@blocks@bibliography}
%    \end{macrocode}
