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
commit f689186e58

View File

@ -77,52 +77,27 @@
\end{flushright}%\par
\@thanks
\end{titlepage}%
\cleardoublepage%
\setcounter{footnote}{0}%
\let\thanks\relax\let\maketitle\relax
%\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
\renewcommand{\tableofcontents}{%
% before resetting page counter, let's do the right thing.
\if@openright\cleardoublepage\else\clearpage\fi
\pagenumbering{roman}%
\setcounter{page}{1}%
\pagebreak%
\pagestyle{plain}%
{%
\parskip = 0mm%
\py@OldTableofcontents%
\if@openright%
\ifodd\value{page}%
\typeout{Adding blank page after the table of contents.}%
\pagebreak\hspace{0pt}%
\fi%
\fi%
\cleardoublepage%
}%
\begingroup
\parskip \z@skip
\py@OldTableofcontents
\endgroup
% before resetting page counter, let's do the right thing.
\if@openright\cleardoublepage\else\clearpage\fi
\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
% 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.
\let\py@OldThebibliography=\thebibliography
\renewcommand{\thebibliography}[1]{
\cleardoublepage
\if@openright\cleardoublepage\else\clearpage\fi
\phantomsection
\py@OldThebibliography{1}
\addcontentsline{toc}{chapter}{\bibname}
@ -147,7 +122,7 @@
\@ifclassloaded{memoir}{}{
\let\py@OldTheindex=\theindex
\renewcommand{\theindex}{
\cleardoublepage
\if@openright\cleardoublepage\else\clearpage\fi
\phantomsection
\py@OldTheindex
\addcontentsline{toc}{chapter}{\indexname}