Fix #2622 (done): correctly obey openany option

Clean sphinxmanual.cls of superfluous unneeded code. And also avoid
skipping blank pages if openany for bibliography and index.
This commit is contained in:
jfbu
2016-06-06 18:34:47 +02:00
parent aa31bae17a
commit 9af0583f22

View File

@@ -77,56 +77,27 @@
\end{flushright}%\par \end{flushright}%\par
\@thanks \@thanks
\end{titlepage}% \end{titlepage}%
% avoid extra blank page after title if openany option
\if@openright\cleardoublepage\else\clearpage\fi
\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{}
} }
% This is only needed for the \typeout message.
\if@openright
\let\py@OldEndAbstract=\endabstract
\renewcommand{\endabstract}{%
\py@OldEndAbstract
% mimic \clearpage/\cleardoublepage with added message to log
\clearpage
% LaTeX's standard is that openright has any effect only under twoside
\if@twoside
\ifodd\c@page\else
\typeout{Adding blank page after the abstract}%
\hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi
\fi
\fi
}
\fi
% Mainly for the \typeout message.
\let\py@OldTableofcontents=\tableofcontents \let\py@OldTableofcontents=\tableofcontents
\renewcommand{\tableofcontents}{% \renewcommand{\tableofcontents}{%
% before resetting page counter, let's do the right thing. % before resetting page counter, let's do the right thing.
\if@openright\cleardoublepage\else\clearpage\fi \if@openright\cleardoublepage\else\clearpage\fi
\pagenumbering{roman}% \pagenumbering{roman}%
\setcounter{page}{1}%
\pagestyle{plain}% \pagestyle{plain}%
{% \begingroup
\parskip \z@skip \parskip \z@skip
\py@OldTableofcontents \py@OldTableofcontents
% mimic \clearpage/\cleardoublepage with added message to log \endgroup
\clearpage % before resetting page counter, let's do the right thing.
% LaTeX's standard is that openright has any effect only under twoside \if@openright\cleardoublepage\else\clearpage\fi
\if@openright\if@twoside
\ifodd\c@page\else
\typeout{Adding blank page after the table of contents}%
\hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi
\fi
\fi\fi
}%
\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.
@@ -139,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}
@@ -151,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}