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

Make writes of `\thesis@pages` and `\thesis@pages@postamble}` immediate

This is so that we don't lose the writes if the last page ends up empty
parent ca919366
Loading
Loading
Loading
Loading
+10 −4
Original line number Original line Diff line number Diff line
@@ -56,7 +56,7 @@
  \gdef\thesis@version@number{#1}
  \gdef\thesis@version@number{#1}
  \gdef\thesis@version@date{#2}
  \gdef\thesis@version@date{#2}
  \gdef\thesis@version{#2 #1 fithesis3 MU thesis class}}
  \gdef\thesis@version{#2 #1 fithesis3 MU thesis class}}
\thesis@versiondef{v0.3.49}{2018/02/11}}
\thesis@versiondef{v0.3.50}{2018/03/25}}
% {\newwrite\f\openout\f=VERSION\write\f{\thesis@version}\closeout\f}
% {\newwrite\f\openout\f=VERSION\write\f{\thesis@version}\closeout\f}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1342,10 +1342,12 @@
% group, the |\thesis@postamble| macro defines the
% group, the |\thesis@postamble| macro defines the
% \cs{thesis@pages@postamble} macro, writes the definition to the
% \cs{thesis@pages@postamble} macro, writes the definition to the
% auxiliary file, and  clears the page.
% auxiliary file, and  clears the page.
% \changes{v0.3.50}{2018/03/25}{Make writes immediate, so that they
%   do not get lost when they occur at an empty page. [VN]}
%    \begin{macrocode}
%    \begin{macrocode}
\def\thesis@postamble{%
\def\thesis@postamble{%
  \gdef\thesis@pages@postamble{\thepage}
  \gdef\thesis@pages@postamble{\thepage}
  \write\@auxout{\noexpand\gdef\noexpand
  \immediate\write\@auxout{\noexpand\gdef\noexpand
    \thesis@pages@postamble{\thepage}}
    \thesis@pages@postamble{\thepage}}
  {\thesis@selectLocale{\thesis@locale}%
  {\thesis@selectLocale{\thesis@locale}%
  \thesis@blocks@postamble}}
  \thesis@blocks@postamble}}
@@ -1597,15 +1599,19 @@
% beginning and at the end of the document, respectively. The
% beginning and at the end of the document, respectively. The
% definition of the |\thesis@pages| macro is also scheduled to be
% definition of the |\thesis@pages| macro is also scheduled to be
% written to the auxiliary file at the end of the document.
% written to the auxiliary file at the end of the document.
% \changes{v0.3.50}{2018/03/25}{Make writes immediate, so that they
%   do not get lost when they occur at an empty page. [VN]}
%    \begin{macrocode}
%    \begin{macrocode}
      \ifthesis@auto
      \ifthesis@auto
        \AtBeginDocument{\thesis@preamble}
        \AtBeginDocument{\thesis@preamble}
        \AtEndDocument{%
        \AtEndDocument{%
          \thesis@postamble
          \thesis@postamble
          \write\@auxout{\noexpand\gdef\noexpand\thesis@pages{\thepage}}}
          \immediate\write\@auxout{%
            \noexpand\gdef\noexpand\thesis@pages{\thepage}}}
      \else
      \else
        \AtEndDocument{%
        \AtEndDocument{%
          \write\@auxout{\noexpand\gdef\noexpand\thesis@pages{\thepage}}}
          \immediate\write\@auxout{%
            \noexpand\gdef\noexpand\thesis@pages{\thepage}}}
      \fi
      \fi
    \makeatother
    \makeatother
  \fi}
  \fi}