Make the 'bibliography TOC fix' specific to document class howto/manual (article/report)

This commit is contained in:
Marcio Mazza 2011-12-04 14:43:46 -02:00
parent dcd3408b8a
commit a6de8b78aa
3 changed files with 28 additions and 9 deletions

View File

@ -402,10 +402,15 @@
} }
% Fix the index and bibliography environments to add an entry to the Table of % 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 % Contents; this is much nicer than just having to jump to the end of the book
% and flip around, especially with multiple indexes. % and flip around, especially with multiple indexes.
% %
% 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.
%
\let\py@OldTheindex=\theindex \let\py@OldTheindex=\theindex
\renewcommand{\theindex}{ \renewcommand{\theindex}{
\cleardoublepage \cleardoublepage
@ -414,14 +419,6 @@
\addcontentsline{toc}{chapter}{\indexname} \addcontentsline{toc}{chapter}{\indexname}
} }
\let\py@OldThebibliography=\thebibliography
\renewcommand{\thebibliography}[1]{
\cleardoublepage
\phantomsection
\py@OldThebibliography{1}
\addcontentsline{toc}{chapter}{\bibname}
}
% Include hyperref last. % Include hyperref last.
\RequirePackage[colorlinks,breaklinks, \RequirePackage[colorlinks,breaklinks,
linkcolor=InnerLinkColor,filecolor=OuterLinkColor, linkcolor=InnerLinkColor,filecolor=OuterLinkColor,

View File

@ -79,3 +79,14 @@
\pagenumbering{arabic} % ToC & chapters \pagenumbering{arabic} % ToC & chapters
\thispagestyle{empty} \thispagestyle{empty}
% Fix the bibliography environment to add an entry to the Table of
% Contents.
% For an article document class this environment is a section,
% so no page break before it.
\let\py@OldThebibliography=\thebibliography
\renewcommand{\thebibliography}[1]{
\phantomsection
\py@OldThebibliography{1}
\addcontentsline{toc}{section}{\bibname}
}

View File

@ -120,3 +120,14 @@
% %
\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}} \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}} \renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}
% Fix the bibliography environment to add an entry to the Table of
% Contents.
% For a report document class this environment is a chapter.
\let\py@OldThebibliography=\thebibliography
\renewcommand{\thebibliography}[1]{
\cleardoublepage
\phantomsection
\py@OldThebibliography{1}
\addcontentsline{toc}{chapter}{\bibname}
}