Merge pull request #2626 from jfbu/latex_fixopenany

Fix #2622: Latex produces empty pages after title and table of contents
This commit is contained in:
Jean-François B
2016-06-08 08:20:10 +02:00

View File

@@ -77,52 +77,27 @@
\end{flushright}%\par \end{flushright}%\par
\@thanks \@thanks
\end{titlepage}% \end{titlepage}%
\cleardoublepage%
\setcounter{footnote}{0}% \setcounter{footnote}{0}%
\let\thanks\relax\let\maketitle\relax \let\thanks\relax\let\maketitle\relax
%\gdef\@thanks{}\gdef\@author{}\gdef\@title{} %\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
} }
% Catch the end of the {abstract} environment, but here make sure the abstract
% is followed by a blank page if the 'openright' option is used.
%
\let\py@OldEndAbstract=\endabstract
\renewcommand{\endabstract}{
\if@openright
\ifodd\value{page}
\typeout{Adding blank page after the abstract.}
\vfil\pagebreak
\fi
\fi
\py@OldEndAbstract
}
% This wraps the \tableofcontents macro with all the magic to get the spacing
% right and have the right number of pages if the 'openright' option has been
% used. This eliminates a fair amount of crud in the individual document files.
%
\let\py@OldTableofcontents=\tableofcontents \let\py@OldTableofcontents=\tableofcontents
\renewcommand{\tableofcontents}{% \renewcommand{\tableofcontents}{%
% before resetting page counter, let's do the right thing.
\if@openright\cleardoublepage\else\clearpage\fi
\pagenumbering{roman}% \pagenumbering{roman}%
\setcounter{page}{1}%
\pagebreak%
\pagestyle{plain}% \pagestyle{plain}%
{% \begingroup
\parskip = 0mm% \parskip \z@skip
\py@OldTableofcontents% \py@OldTableofcontents
\if@openright% \endgroup
\ifodd\value{page}% % before resetting page counter, let's do the right thing.
\typeout{Adding blank page after the table of contents.}% \if@openright\cleardoublepage\else\clearpage\fi
\pagebreak\hspace{0pt}%
\fi%
\fi%
\cleardoublepage%
}%
\pagenumbering{arabic}% \pagenumbering{arabic}%
\@ifundefined{fancyhf}{}{\pagestyle{normal}}% \ifdefined\fancyhf\pagestyle{normal}\fi
} }
\pagenumbering{alph} %\pagenumbering{alph}%
% This is needed to get the width of the section # area wide enough in the % This is needed to get the width of the section # area wide enough in the
% library reference. Doing it here keeps it the same for all the manuals. % library reference. Doing it here keeps it the same for all the manuals.
@@ -135,7 +110,7 @@
% For a report document class this environment is a chapter. % For a report document class this environment is a chapter.
\let\py@OldThebibliography=\thebibliography \let\py@OldThebibliography=\thebibliography
\renewcommand{\thebibliography}[1]{ \renewcommand{\thebibliography}[1]{
\cleardoublepage \if@openright\cleardoublepage\else\clearpage\fi
\phantomsection \phantomsection
\py@OldThebibliography{1} \py@OldThebibliography{1}
\addcontentsline{toc}{chapter}{\bibname} \addcontentsline{toc}{chapter}{\bibname}
@@ -147,7 +122,7 @@
\@ifclassloaded{memoir}{}{ \@ifclassloaded{memoir}{}{
\let\py@OldTheindex=\theindex \let\py@OldTheindex=\theindex
\renewcommand{\theindex}{ \renewcommand{\theindex}{
\cleardoublepage \if@openright\cleardoublepage\else\clearpage\fi
\phantomsection \phantomsection
\py@OldTheindex \py@OldTheindex
\addcontentsline{toc}{chapter}{\indexname} \addcontentsline{toc}{chapter}{\indexname}