% \file{style/mu/fithesis-econ.sty}
% This is the style file for the theses written at the Faculty of
% Economics and Administration at the Masaryk University in Brno.
% It has been prepared in accordance with the formal requirements
% \changes{v0.3.46}{2017/06/02}{The documentation now points to the
%   2/2017 dean's directive for the Faculty of Economics and
%   Administration, Masaryk University, Brno. [VN]}
% published at the website of the faculty\footnote{See \url{htt^^A
% ps://is.muni.cz/auth/do/econ/uredni_deska/predpisy_ESF/smerni^^A
% ce/smernice_dekana/prehled/67159928/SmerniceDekana2017-c.9-o_^^A
% zaverecnych_pracich_2017.docx}}.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fithesis/style/mu/fithesis-econ}[2018/06/11]
%    \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}{F27995},
  tableEmph={HTML}{E8B88B},
  tableOdd={HTML}{F5ECEB},
  tableEven={HTML}{EBD8D5}}
%    \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{array} -- Enables |<{decl.}| and |>{decl.}|
%     declarations in table preambles.
% \end{itemize}
% In addition to this, the type area width is set to
% 16\,cm in accordance with the formal requirements of the faculty.
% This leads to overfull lines and is against the good conscience
% of the author of this style.
%    \begin{macrocode}
\thesis@require{tikz}
\thesis@require{geometry}
\thesis@require{array}
\geometry{top=25mm,bottom=20mm,left=25mm,right=25mm,includeheadfoot}
%    \end{macrocode}
% \changes{v0.3.47}{2017/07/09}{Enabled the inclusion of the
%   scanned assignment inside the digital version of the document
%   in \texttt{style/mu/fithesis-econ.sty} in accordance with the
%   formal requirements of the faculty. The patch was submitted by
%   Jana Ratajská. [VN]}
% Enable the inclusion of the scanned assignment inside the digital
% version of the document.
%    \begin{macrocode}
\thesis@blocks@assignment@hideIfDigital@false
%    \end{macrocode}
% \begin{macro}{\thesis@blocks@cover}
% The |\thesis@blocks@cover| macro typesets the thesis
% cover.
%    \begin{macrocode}
\def\thesis@blocks@cover{%
  \ifthesis@cover@
    \thesis@blocks@clear
    \begin{alwayssingle}
      \thispagestyle{empty}
      \begin{center}
      {\sc\thesis@titlePage@LARGE\thesis@@{universityName}\\%
          \thesis@titlePage@Large\thesis@@{facultyName}\\}
      \vfill
      {\bf\thesis@titlePage@Huge\thesis@@{typeName}}
      \vfill
      {\thesis@titlePage@large\thesis@place
       \ \thesis@year\hfill\thesis@author}
      \end{center}
    \end{alwayssingle}
  \fi}
%    \end{macrocode}
% \end{macro}
% The style file configures the title page header to include the
% name of the field of study and 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}
\thesis@blocks@titlePage@field@true
\def\thesis@blocks@titlePage@content{%
  {\thesis@titlePage@Huge\bf\thesis@TeXtitle}
  \ifthesis@english\else
    {\\[0.1in]\thesis@titlePage@Large\bf\thesis@TeXtitleEn}
  \fi {\\[0.3in]\thesis@titlePage@large\sc\thesis@@{typeName}\\}}
\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\@left\relax\newlength{\@left}\pgfmathsetlength{\@left}{%
      max(\@A,\@B)}
    \let\@right\relax\newlength{\@right}\pgfmathsetlength{\@right}{%
      max(\@C,\@D)}
%    \end{macrocode}
% \changes{v0.3.49}{2018/02/11}{Removed an extraneous \cs{vskip} in
%   the style files for the Masaryk University in Brno. [VN]}
% \begin{macrocode}
    % Typeset the thesis author and advisor boxes
    \begin{minipage}[t]{\@left}
      {\bf\thesis@@{advisorTitle}:}\\\thesis@advisor
    \end{minipage}\hfill\begin{minipage}[t]{\@right}
      {\bf\thesis@@{authorTitle}:}\\\thesis@author
    \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 page numbering is arabic
% as per the formal requirements and it is hidden. In case of
% double-sided typesetting, the geometry is altered according to
% the requirements of the faculty.
% \begin{macrocode}
\def\thesis@blocks@frontMatter{%
  \thesis@blocks@clear
  \newgeometry{top=25mm,bottom=20mm,left=35mm,
    right=15mm, includeheadfoot}
  \pagestyle{empty}
  \parindent 1.5em
  \setcounter{page}{1}
  \pagenumbering{arabic}}
%    \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 page numbering doesn't
% reset at the beginning of the main thesis as per the formal
% requirements.
% \begin{macrocode}
\def\thesis@blocks@mainMatter{%
  \thesis@blocks@clear
  \newgeometry{top=25mm,bottom=20mm,left=35mm,
    right=15mm, includeheadfoot}
  \pagestyle{thesisheadings}
  \parindent 1.5em\relax}
%    \end{macrocode}
% \end{macro}\begin{macro}{\thesis@blocks@tables}
% The |\thesis@blocks@tables| macro optionally typesets the
% |\listoftables| and |\listoffigures|.
% \begin{macrocode}
\def\thesis@blocks@tables{%
  \thesis@blocks@lot
  \thesis@blocks@lof}
%    \end{macrocode}
% \end{macro}
% If the |nolot| and |nolof| options haven't been specified, the
% |\thesis@blocks@lot| and |\thesis@blocks@lof| macros are
% redefined to create an entry in the table of contents.
% \begin{macrocode}
\ifx\thesis@blocks@lot\relax\else
  \def\thesis@blocks@lot{%
    \thesis@blocks@clear
    \phantomsection
    \addcontentsline{toc}{chapter}{\listtablename}%
    \listoftables}
\fi

\ifx\thesis@blocks@lof\relax\else
  \def\thesis@blocks@lof{%
    \thesis@blocks@clear
    \phantomsection
    \addcontentsline{toc}{chapter}{\listfigurename}%
    \listoffigures}
\fi
%    \end{macrocode}
% \begin{macro}{\thesis@blocks@declaration}
% The |\thesis@blocks@declaration| macro typesets the declaration
% text. Unlike the generic |\thesis@blocks@declaration| macro from
% the \texttt{style/mu/fithesis-sci.sty} file, this definition
% includes the date and a blank line for the author's signature, as
% per the requirements of the faculty.
% \changes{v0.3.46}{2017/06/02}{Redefined
%   \cs{thesis@blocks@declaration} in
%   \texttt{style/mu/fithesis-econ.sty} in accordance with the
%   example documents. The patch was submitted by Jana Ratajská.
%   [VN]}
%    \begin{macrocode}
\def\thesis@blocks@declaration{%
  \begin{alwayssingle}%
    \thesis@blocks@clear
    \leavevmode\vfill
    % Start the new chapter without clearing any page.
    {\let\thesis@blocks@clear\relax
    \chapter*{\thesis@@{declarationTitle}}}%
    \thesis@declaration
    \vskip 2cm%
    {\let\@A\relax\newlength{\@A}
      \settowidth{\@A}{\thesis@@{authorSignature}}
      \setlength{\@A}{\@A+1cm}
    \noindent\thesis@place, \thesis@@{formattedDate}\hfill
    \begin{minipage}[t]{\@A}%
      \centering\rule{\@A}{1pt}\\
      \thesis@@{authorSignature}\par
    \end{minipage}}
  \end{alwayssingle}}
%    \end{macrocode}
% \end{macro}\begin{macro}{\thesis@blocks@abstract}
% \changes{v0.3.46}{2017/06/02}{Redefined
%   \cs{thesis@blocks@abstract}, \cs{thesis@blocks@abstractEn},
%   \cs{thesis@blocks@keywords}, and \cs{thesis@blocks@keywordsEn}
%   in \texttt{style/mu/fithesis-econ.sty} in accordance with the
%   example documents. The patch was submitted by Jana Ratajská.
%   [VN]}
% The |\thesis@blocks@abstract| macro typesets the
% abstract. This definition typesets the abstract on the same page.
% \begin{macrocode}
\def\thesis@blocks@abstract{%
  \begin{alwayssingle}%
    \vskip 40\p@
    {\let\thesis@blocks@clear\relax
    \chapter*{\thesis@@{abstractTitle}}}%
    \noindent\thesis@abstract
  \end{alwayssingle}}
%    \end{macrocode}
% \end{macro}\begin{macro}{\thesis@blocks@abstractEn}
% The |\thesis@blocks@abstractEn| macro typesets the abstract in
% English. If the current locale is English, the macro produces no
% output. This macro typesets the abstract on the same page.
% \begin{macrocode}
\def\thesis@blocks@abstractEn{%
  \ifthesis@english\else
    {\thesis@selectLocale{english}%
    \begin{alwayssingle}%
      \vskip 20\p@
      {\let\thesis@blocks@clear\relax
      \chapter*{\thesis@english@abstractTitle}}%
      \noindent\thesis@abstractEn
    \end{alwayssingle}}%
  \fi}
%    \end{macrocode}
% \end{macro}\begin{macro}{\thesis@blocks@keywords}
% The |\thesis@blocks@keywords| macro typesets the keywords. This
% definition typesets the keywords on the same page.
% \begin{macrocode}
\def\thesis@blocks@keywords{%
  \begin{alwayssingle}%
    \vskip 40\p@
    {\let\thesis@blocks@clear\relax
    \chapter*{\thesis@@{keywordsTitle}}%
    \noindent\thesis@TeXkeywords}%
  \end{alwayssingle}}
%    \end{macrocode}
% \end{macro}\begin{macro}{\thesis@blocks@keywordsEn}
% The |\thesis@blocks@keywordsEn| macro typesets the keywords in
% English. If the current locale is English, the macro produces no
% output.
% \begin{macrocode}
\def\thesis@blocks@keywordsEn{%
  \ifthesis@english\else
    {\thesis@selectLocale{english}%
    \begin{alwayssingle}%
      \vskip 20\p@
      {\let\thesis@blocks@clear\relax%
      \chapter*{\thesis@english@keywordsTitle}}%
      \noindent\thesis@TeXkeywordsEn
    \end{alwayssingle}}%
  \fi}
%    \end{macrocode}
% \end{macro}\begin{macro}{\thesis@blocks@bibEntry}
% The |\thesis@blocks@bibEntry| macro typesets a bibliographical
% entry. Along with the macros required by the locale file
% interface, the locale files need to define the following macros:
% \begin{itemize}
%   \item|\thesis@|\textit{locale}|@bib@author| -- The label of the
%     author name entry
%   \item|\thesis@|\textit{locale}|@bib@title| -- The label of the
%     title name entry
%   \item|\thesis@|\textit{locale}|@bib@titleEn| -- The label of the
%     English title name entry (\cs{thesis@english@bib@titleEn}
%     does not need to be defined)
%   \item|\thesis@|\textit{locale}|@bib@department| -- The label of
%     the department name entry
%   \item|\thesis@|\textit{locale}|@bib@advisor| -- The label of
%     the advisor name entry
%   \item|\thesis@|\textit{locale}|@bib@year| -- The label of the
%     year entry
% \end{itemize}
% \changes{v0.3.46}{2017/06/02}{Defined \cs{thesis@blocks@bibEntry}
%   in \texttt{style/mu/fithesis-econ.sty} in accordance with the
%   example documents. The patch was submitted by Jana Ratajská.
%   [VN]}
%    \begin{macrocode}
\def\thesis@blocks@bibEntry{%
  \thesis@blocks@clear
  \noindent\begin{thesis@newtable@old}{@{}>{\bfseries}ll@{}}
    \thesis@@{bib@author}:        & \thesis@author     \\
    \thesis@@{bib@thesisTitle}:   & \thesis@title      \\
  \ifthesis@english\else
    \thesis@@{bib@thesisTitleEn}: & \thesis@titleEn    \\
  \fi
    \thesis@@{bib@department}:    & \thesis@department \\
    \thesis@@{bib@advisor}:       & \thesis@advisor    \\
    \thesis@@{bib@year}:          & \thesis@year       \\
  \end{thesis@newtable@old}}
%    \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 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@frontMatter
    \thesis@blocks@titlePage
    \thesis@blocks@assignment
    \thesis@blocks@bibEntry
    \thesis@blocks@abstract
    \thesis@blocks@abstractEn
    \thesis@blocks@keywords
    \thesis@blocks@keywordsEn
    \thesis@blocks@declaration
    \thesis@blocks@thanks
    \thesis@blocks@toc}
%    \end{macrocode}
% All blocks within the autolayout postamble that are not defined
% within this file are defined in the \texttt{style/mu/base.sty}
% file.
%    \begin{macrocode}
\def\thesis@blocks@postamble{%
  \thesis@blocks@bibliography
  \thesis@blocks@tables}
%    \end{macrocode}
