From 44d1f1e952bf5a6b195987c4329c119b8487e56b Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sat, 30 Mar 2013 14:00:43 +0100 Subject: [PATCH] Closes #995: Fix table-of-contents and page numbering for the LaTeX "howto" class. --- CHANGES | 1 + sphinx/texinputs/sphinx.sty | 24 +----------------------- sphinx/texinputs/sphinxhowto.cls | 12 ++++++++++++ sphinx/texinputs/sphinxmanual.cls | 14 ++++++++++++++ 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/CHANGES b/CHANGES index ed62a593b..0e4a8a13f 100644 --- a/CHANGES +++ b/CHANGES @@ -194,6 +194,7 @@ Bugs fixed * #1015: Stop overriding jQuery contains() in the JavaScript. * #1010: Make pngmath images transparent by default; IE7+ should handle it. * #1008: Fix test failures with Python 3.3. +* #995: Fix table-of-contents and page numbering for the LaTeX "howto" class. * #976: Fix gettext does not extract index entries. * PR#72: #975: Fix gettext not extracting definition terms before docutils 0.10. * #961: Fix LaTeX output for triple quotes in code snippets. diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index ce15591a2..9b083cc6b 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -102,8 +102,7 @@ \sloppy \hbadness = 5000 % don't print trivial gripes -\pagestyle{empty} % start this way; change for -\pagenumbering{roman} % ToC & chapters +\pagestyle{empty} % start this way % Use this to set the font family for headers and other decor: \newcommand{\py@HeaderFamily}{\sffamily\bfseries} @@ -413,27 +412,6 @@ \fi% } - -% Fix the index environment to add an entry to the Table of -% Contents; this is much nicer than just having to jump to the end of the book -% and flip around, especially with multiple indexes. -% The memoir class already does this, so we don't duplicate it in that case. -% -% A similiar fix must be done to the bibliography environment, although -% dependant on document class. In particular, the '\addcontentsline' command -% should use 'chapter' for a report and 'section' for an article. -% See sphinxmanual.cls and sphinxhowto.cls for specific fixes. -% -\@ifclassloaded{memoir}{}{ - \let\py@OldTheindex=\theindex - \renewcommand{\theindex}{ - \cleardoublepage - \phantomsection - \py@OldTheindex - \addcontentsline{toc}{chapter}{\indexname} - } -} - % to make pdf with correct encoded bookmarks in Japanese % this should precede the hyperref package \ifx\kanjiskip\undefined\else diff --git a/sphinx/texinputs/sphinxhowto.cls b/sphinx/texinputs/sphinxhowto.cls index 9625870e7..26e63a7ee 100644 --- a/sphinx/texinputs/sphinxhowto.cls +++ b/sphinx/texinputs/sphinxhowto.cls @@ -90,3 +90,15 @@ \py@OldThebibliography{1} \addcontentsline{toc}{section}{\bibname} } + +% Same for the indices. +% The memoir class already does this, so we don't duplicate it in that case. +% +\@ifclassloaded{memoir}{}{ + \let\py@OldTheindex=\theindex + \renewcommand{\theindex}{ + \phantomsection + \py@OldTheindex + \addcontentsline{toc}{section}{\indexname} + } +} diff --git a/sphinx/texinputs/sphinxmanual.cls b/sphinx/texinputs/sphinxmanual.cls index a04cea5ba..26df488ef 100644 --- a/sphinx/texinputs/sphinxmanual.cls +++ b/sphinx/texinputs/sphinxmanual.cls @@ -114,6 +114,7 @@ \pagenumbering{arabic}% \@ifundefined{fancyhf}{}{\pagestyle{normal}}% } +\pagenumbering{roman} % 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. @@ -131,3 +132,16 @@ \py@OldThebibliography{1} \addcontentsline{toc}{chapter}{\bibname} } + +% Same for the indices. +% The memoir class already does this, so we don't duplicate it in that case. +% +\@ifclassloaded{memoir}{}{ + \let\py@OldTheindex=\theindex + \renewcommand{\theindex}{ + \cleardoublepage + \phantomsection + \py@OldTheindex + \addcontentsline{toc}{chapter}{\indexname} + } +}