Commit aba7a20f authored by Vít Novotný's avatar Vít Novotný
Browse files

Major locale and style interface changes.

`\thesis@selectLocale` is no longer performed globally for the
entire document during `\thesis@load` (effectively overriding the
user's hyphenation settings, if Babel's or Polyglossia's
`\languagename` differs from `\thesis@locale`). Instead,
`\thesis@preamble` and `\thesis@postamble` now locally switch the
locale and expand `\thesis@blocks@preamble` and
`\thesis@blocks@postamble`, which are the new redefinables. Since
this breaks the behaviour of `\thesis@blocks@mainMatter`, whose
effects would also be local, `\thesis@blocks@mainMatter` is now
executed directly by `\thesis@preamble` after closing the group and
becomes a new part of the interface between the class and the style
files.

As a preparation for the future inclusion of bibliography support,
the /csquotes/ package is loaded, `\thesis@<locale>@csquotesStyle`
is a new part of the locale interface that sets the /csquotes/
style of a locale, and `\thesis@selectLocale` now switches the
/csquotes/ style.
parent deed2642
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -781,7 +781,18 @@ afterwards.
With online services -- such as Overleaf -- all commands are
executed automatically.

\printbibliography[heading=bibintoc] %% Print the bibliography.
%<*pdftex>
{\csname captions\languagename\endcsname %% Temporarily override
%% the BibLaTeX localization with the original babel definitions.
\makeatletter %% Use the correct localization of the quotations.
  \thesis@selectLocale{\thesis@locale}\makeatother
\printbibliography[heading=bibintoc]} %% Print the bibliography.
%</pdftex>
%<*luatex>
{\makeatletter %% Use the correct localization of the quotations.
  \thesis@selectLocale{\thesis@locale}\makeatother
\printbibliography[heading=bibintoc]} %% Print the bibliography.
%</luatex>

\chapter{Inserting the index}
After using the \verb"\makeindex" macro and loading the
+85 −30
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
\DoNotIndex{}
\makeatletter
  \c@IndexColumns=2
  \c@GlossaryColumns=2
\makeatother

\begin{document}
@@ -50,14 +51,33 @@
%<*class>
\NeedsTeXFormat{LaTeX2e}
% Define `\thesis@version` and store it in the `VERSION.tex` file \fi
\def\thesis@version{2015/11/29 v0.3.27-dev fithesis3 MU thesis class}
\def\thesis@version{2015/11/29 v0.3.27:3-dev fithesis3 MU thesis class}
% {\newwrite\f\openout\f=VERSION\write\f{\thesis@version}\closeout\f}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \changes{v0.3.27-dev}{2015/11/29}{Fixed a typo in the guide.
%   Added a compatibility layer with \cs{title}, \cs{author}, and
%   \cs{maketitle}. Minor changes of the documentation.}
% \changes{v0.3.27:3}{2015/11/29}{As a preparation for the future
%   inclusion of bibliography support, the \textsf{csquotes}
%   package is loaded, \texttt{@csquotesStyle} is a new part of
%   the locale interface that sets the \textsf{csquotes} style
%   of a locale, and \cs{thesis@selectLocale} now switches the
%   \textsf{csquotes} style. [VN]}
% \changes{v0.3.27:2}{2015/11/29}{\cs{thesis@selectLocale} is no
%   longer performed globally for the entire document during
%   \cs{thesis@load} (effectively overriding the user's hyphenation
%   settings, if Babel's or Polyglossia's \cs{languagename}
%   differs from \cs{thesis@locale}). Instead, \cs{thesis@preamble}
%   and \texttt{@postamble} now locally switch the locale and
%   expand \cs{thesis@blocks@preamble} and \texttt{@postamble},
%   which are the new redefinables. Since this breaks the behaviour
%   of \cs{thesis@blocks@mainMatter}, whose effects would also be
%   local, \texttt{@mainMatter} is now executed directly by
%   \cs{thesis@preamble} after closing the group and becomes a new
%   part of the interface between the class and the style files.
%   [VN]}
% \changes{v0.3.27:1}{2015/11/29}{Fixed a typo in the guide.
%   Added a compatibility layer for \cs{title}, \cs{author}, and
%   \cs{maketitle}. Minor changes of the documentation. [VN]}
% \changes{v0.3.26}  {2015/11/21}{Updated the example documents and
%   the user guide. Fixed a typo in the description of
%   \cs{thesis@season}. [VN]}
@@ -1083,13 +1103,36 @@
%    \end{macrocode}
% \end{macro} ^^A The nested \ifthesis@auto macro definition
% \end{macro} ^^A The \thesissetup macro definition
% The \DescribeMacro{\thesis@preamble}|\thesis@postamble|
% and \DescribeMacro{\thesis@postamble}|\thesis@preamble|
% macros are defined as empty token strings by default and
% are subject to redefinition by the style files.
%    \begin{macrocode}
\def\thesis@preamble{}
\def\thesis@postamble{}
% The \DescribeMacro{\thesis@preamble}|\thesis@preamble|
% and \DescribeMacro{\thesis@postamble}|\thesis@postamble|
% macros temporarily switch to the hyphenation patterns and the
% \textsf{csquotes} style of the main locale and typeset the
% contents of the
% \DescribeMacro{\thesis@blocks@preamble}|\thesis@blocks@preamble|
% or
% \DescribeMacro{\thesis@blocks@postamble}|\thesis@blocks@postamble|
% macros, respectively.
%
% Before leaving the group, the |\thesis@preamble| macro clears the
% page. After leaving the group, the |\thesis@preamble| macro sets
% up the style of the main matter by expanding the
% \DescribeMacro{\thesis@blocks@mainMatter}|\thesis@blocks@mainMatter|
% macro. All the aforementioned |@block@| macros are defined as
% |\relax| and are subject to redefinition by the loaded style
% files.
%    \begin{macrocode}
\def\thesis@preamble{%
  {\thesis@selectLocale{\thesis@locale}%
  \thesis@blocks@preamble\clearpage}
  \thesis@blocks@mainMatter}

\def\thesis@postamble{{%
  \thesis@selectLocale{\thesis@locale}%
  \thesis@blocks@postamble}}

\let\thesis@blocks@preamble\relax
\let\thesis@blocks@postamble\relax
\let\thesis@blocks@mainMatter\relax
%    \end{macrocode}
% \subsection{The \cs{thesislong} macro}\label{sec:thesislong}
% \begin{macro}{\thesislong}
@@ -1128,14 +1171,12 @@
    \thesis@loadedtrue
    \makeatletter%
%    \end{macrocode}
% First, the main locale is selected and its files are loaded using
% the |\thesis@selectLocale| macro. If the user specified an
% explicit empty string as the value of |\thesis@locale|, do
% nothing.
% First, the main locale file is loaded using the
% |\thesis@requireLocale| macro. If the user specified an explicit
% empty string as the value of |\thesis@locale|, do nothing.
%    \begin{macrocode}
      \ifx\thesis@locale\empty\else
        \thesis@requireLocale{\thesis@locale}
        \thesis@selectLocale{\thesis@locale}
      \fi
%    \end{macrocode}
% Consequently, the style files are loaded. If the user specified an
@@ -1362,16 +1403,24 @@
%    \end{macrocode}
% \DescribeMacro{\thesis@selectLocale}|\thesis@selectLocale|\marg{locale}
% macro redefines the |\thesis@locale| macro to \textit{locale},
% and switches to the hyphenation patterns of \textit{locale}. The
% respective locale files and polyglossia locale definitions should
% be loaded beforehand using the |\thesis@requireLocale| macro.
% switches to the hyphenation patterns of \textit{locale}, and
% starts using the |\thesis@|\textit{locale}|@csquotesStyle| style
% of the \textsf{csquotes} package. The respective locale files and
% polyglossia locale definitions should be loaded beforehand using
% the |\thesis@requireLocale| macro.
%
% This macro should always be used within a group, so that the
% locale settings and the hyphenation return back to what the user
% has specified after the localized block of typographic material.
% locale, \textsf{csquotes}, and hyphenation settings return back to
% what the user has specified after the localized blocks of
% typographic material.
%
% If not loaded by the user, the \textsf{csquotes} package gets
% loaded at the end of the preamble.
%    \begin{macrocode}
\AtEndPreamble{\thesis@require{csquotes}}
\def\thesis@selectLocale#1{%
  \edef\thesis@locale{#1}%
  \csq@setstyle{\thesis@@{csquotesStyle}}%
  \ltx@ifpackageloaded{polyglossia}{%
    \selectlanguage{\thesis@locale}
  }{%
@@ -1435,6 +1484,9 @@
% in Section \ref{sec:reflection}) needs to globally define the
% following macros:
% \begin{itemize}
%   \item|\thesis@|\textit{locale}|@csquotesStyle| -- The name of
%     the style of the \textsf{csquotes} package that matches this
%     locale
%   \item|\thesis@|\textit{locale}|@universityName| -- The name of
%     the university
%   \item|\thesis@|\textit{locale}|@facultyName| -- The name of the
@@ -1500,14 +1552,17 @@
% Section \ref{sec:reflection}) should globally define at least one
% of the following macros:
% \begin{itemize}
%   \item\DescribeMacro{\thesis@preamble}
%                      |\thesis@preamble| -- If autolayout is
%                      enabled, then this macro is expanded at the
%                      very beginning of the document.
%   \item\DescribeMacro{\thesis@postamble}
%                      |\thesis@postamble| -- If autolayout is
%                      enabled, then this macro is expanded at the
%                      very end of the document.
%   \item\DescribeMacro{\thesis@blocks@preamble}^^A
%     |\thesis@blocks@preamble| -- If autolayout is enabled, then
%     this macro is expanded at the very beginning of the document.
%   \item\DescribeMacro{\thesis@blocks@postamble}^^A
%     |\thesis@blocks@postamble| -- If autolayout is enabled, then
%     this macro is expanded at the very end of the document.
%   \item\DescribeMacro{\thesis@blocks@mainMatter}^^A
%     |\thesis@blocks@mainMatter| -- If autolayout is enabled, then
%     this macro is expanded at the beginning of the document right
%     after |\thesis@blocks@preamble|. This macro sets the style of
%     the main matter of the thesis.
% \end{itemize}
%
% \subsubsection{Base style files}
+42 −26
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@
  \textsf{fontspec}, \textsf{unicode-math}, \textsf{mathpazo},
  \textsf{tex-gyre-pagella}, \textsf{lm}, \textsf{cmap},
  \textsf{fontenc}, \textsf{tabularx}, \textsf{tabu},
  \textsf{booktabs}, \textsf{fithesis}.
  \textsf{booktabs}, \textsf{csquotes}, \textsf{fithesis}.
 
  {\makeatletter %% A placeholder string macro
  \def\thguide@placeholder#1{$\langle$\textit{#1}$\rangle$}
@@ -820,13 +820,24 @@
    \label{fig:example02}
  \end{figure}
  We are now back to the original document. Instead of inserting
  the \texttt{\string\thesis\-@preamble} and 
  \texttt{\string\thesis\-@postamble} commands into the document,
  the \texttt{\string\th e\-sis\-@pre\-amble} and 
  \texttt{\string\th e\-sis\-@post\-amble} commands into the document,
  we can insert only certain sections at the beginning and at the
  end of the document. For the \makeatletter
  \thesis@english@facultyName, \makeatother
  \texttt{\string\thesis\-@preamble} expands to the following
  commands:
  end of the document.
  
  The \texttt{\string\th e\-sis\-@preamble} and
  \texttt{\string\th e\-sis\-@postamble} commands set up the proper
  environment and execute the \texttt{\string
  \th e\-sis\-@blocks\-@preamble} and
  \texttt{\string\th e\-sis\-@blocks\-@postamble} commands. To
  change the layout, it is sufficient to redefine \texttt{\string
  \th e\-sis\-@blocks\-@pre\-amble} and
  \texttt{\string\th e\-sis\-@blocks\-@post\-amble} without changing
  the definition of \texttt{\string\th e\-sis\-@pre\-amble} and
  \texttt{\string\th e\-sis\-@post\-amble}. For the
  \makeatletter\thesis@english@facultyName\makeatother,
  \texttt{\string\th e\-sis\-@blocks\-@preamble} expands to the
  following commands:
  {\makeatletter
    % This macro typesets the meaning of another macro.
    \def\thguide@macromeaning#1{%
@@ -836,23 +847,24 @@
      \def\thguide@parse##1 ##2{%
        ##1\ifx##2\relax\ea\@gobbletwo\else\\\fi\thguide@parse##2}%
      \begin{verse}%
        \ea\ifx\@empty\thguide@macro\@empty%
        \ea\ifx\thguide@macro\relax%
          $\langle$\emph{empty}$\rangle$
        \else%
          \tt\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea%
          \ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\thguide@parse\ea%
          \ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\@gobbletwo\ea%
          \ea\ea\ea\ea\ea\ea\@gobbletwo\ea\ea\ea\@gobbletwo\ea%
          \@gobbletwo\thguide@meaning \relax%
        \fi%
          \tt\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea
          \ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\thguide@parse\ea
          \ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\ea\@gobbletwo\ea
          \ea\ea\ea\ea\ea\ea\@gobbletwo\ea\ea\ea\@gobbletwo\ea
          \@gobbletwo\thguide@meaning{} \relax
        \fi
      \end{verse}}
  \thguide@macromeaning{thesis@preamble} and
  \texttt{\string\thesis\-@postamble} 
    \thguide@macromeaning{thesis@blocks@preamble} and
    \texttt{\string\th e\-sis\-@blocks\-@post\-amble} 
    expands to the following commands:
  \thguide@macromeaning{thesis@postamble}
    \thguide@macromeaning{thesis@blocks@postamble}
  \makeatother}
  To create a document that only contains the title page prior to
  the text, we would use the following code:
  To create a document that only contains the title page at the
  beginning of the document and the list of tables at the end of
  the document, we would use the following code:
  \begin{minted}{latex}
\documentclass[...]{fithesis3}
\thesissetup{
@@ -886,11 +898,15 @@
  autoLayout=false}
\begin{document}
  \makeatletter
    \thesis@blocks@titlePage
    \thesis@blocks@mainMatter
    \def\thesis@blocks@preamble{\thesis@blocks@titlePage}
    \thesis@preamble
  \makeatother
  A document that only contains the title page and the
  list of tables.
  \makeatletter
    \def\thesis@blocks@postamble{\thesis@blocks@lot}
    \thesis@postamble
  \makeatother
  A document which contains only the title
  page of the thesis and the main matter.
\end{document}
  \end{minted}
  The available blocks are documented in Section 3.6 of the
+12 −6
Original line number Diff line number Diff line
% \file{locale/fithesis-czech.def}
% This is the base file of the Czech locale. It defines all the
% private macros mandated by the locale file interface.
% This is the base file of the Czech locale.\iffalse
%<*base>
% \fi\begin{macrocode}
\ProvidesFile{fithesis/locale/fithesis-czech.def}[2015/11/29]
%    \end{macrocode}
% The locale file defines all the private macros mandated by the
% locale file interface.
% \begin{macro}{\thesis@czech@gender@koncovka}
% The locale file also defines the |\thesis@czech@gender@koncovka|
% macro, which expands to the correct verb ending based on the
% value of the |\thesis@ifwoman| macro and the
% \end{macro}\begin{macro}{\thesis@czech@typeName@akuzativ}
% |\thesis@czech@typeName@akuzativ| containing the accusative case
% of the thesis type name.
% \end{macro}\iffalse
%<*base>
% \fi\begin{macrocode}
\ProvidesFile{fithesis/locale/fithesis-czech.def}[2015/11/17]
% \end{macro}\begin{macrocode}

% Pomocná makra
\gdef\thesis@czech@gender@koncovka{%
  \ifthesis@woman a\fi}

% Csquotes styl
\gdef\thesis@czech@csquotesStyle{german}

% Zástupné texty
\gdef\thesis@czech@universityName{Název univerzity}
\gdef\thesis@czech@facultyName{Název fakulty}
+9 −4
Original line number Diff line number Diff line
% \file{locale/fithesis-english.def}
% This is the base file of the English locale. It defines all the
% private macros mandated by the locale file interface.
% \iffalse
% This is the base file of the English locale.\iffalse
%<*base>
% \fi\begin{macrocode}
\ProvidesFile{fithesis/locale/fithesis-english.def}[2015/11/10]
\ProvidesFile{fithesis/locale/fithesis-english.def}[2015/11/29]
%    \end{macrocode}
% The locale file defines all the private macros mandated by the
% locale file interface.
% \begin{macrocode}

% Placeholders
\gdef\thesis@english@universityName{University name}
@@ -13,6 +15,9 @@
  of the official signed thesis assignment.}
\gdef\thesis@english@declaration{Declaration text ...}

% Csquotes style
\gdef\thesis@english@csquotesStyle{english}

% Miscellaneous
\gdef\thesis@english@fieldTitle{Field of study}
\gdef\thesis@english@advisorTitle{Advisor}
Loading