diff --git a/CHANGES b/CHANGES index b239fe080..80e29155a 100644 --- a/CHANGES +++ b/CHANGES @@ -125,6 +125,9 @@ Bugs fixed * Update to newest fncychap.sty, to fix problems with non-ASCII characters at the start of chapter titles. +* Fix a problem with index generation in LaTeX output, caused by + hyperref not being included last. + Release 0.4.3 (Oct 8, 2008) =========================== diff --git a/sphinx/latexwriter.py b/sphinx/latexwriter.py index 5a182f40f..ace15e554 100644 --- a/sphinx/latexwriter.py +++ b/sphinx/latexwriter.py @@ -33,6 +33,7 @@ HEADER = r'''%% Generated by Sphinx. %(babel)s %(fontpkg)s %(fncychap)s +\usepackage{sphinx} %(preamble)s \title{%(title)s} diff --git a/sphinx/texinputs/howto.cls b/sphinx/texinputs/howto.cls index c58bff4c3..8c98a8ded 100644 --- a/sphinx/texinputs/howto.cls +++ b/sphinx/texinputs/howto.cls @@ -3,9 +3,7 @@ % \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesClass{howto}[2008/09/12 Document class (Sphinx HOWTO)] - -\RequirePackage{fancybox} +\ProvidesClass{howto}[2008/10/18 Document class (Sphinx HOWTO)] % Pass all given class options to the parent class. \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} @@ -17,17 +15,6 @@ % \setcounter{secnumdepth}{2} -% This gives us all the Python-specific markup that we really want. This should -% come last. Do not change this. -% -\RequirePackage{sphinx} - -% This comes after python.sty because it otherwise defines its own "seealso" -% command. -% -\RequirePackage{makeidx} - - % Change the title page to look a bit better, and fit in with the fncychap % ``Bjarne'' style a bit better. % @@ -61,7 +48,6 @@ %\gdef\@thanks{}\gdef\@author{}\gdef\@title{} } - \let\py@OldTableofcontents=\tableofcontents \renewcommand{\tableofcontents}{ \begingroup diff --git a/sphinx/texinputs/manual.cls b/sphinx/texinputs/manual.cls index 8c99228ae..e4712c81e 100644 --- a/sphinx/texinputs/manual.cls +++ b/sphinx/texinputs/manual.cls @@ -3,9 +3,7 @@ % \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesClass{manual}[2008/09/12 Document class (Sphinx manual)] - -\RequirePackage{fancybox} +\ProvidesClass{manual}[2008/10/18 Document class (Sphinx manual)] % Pass all given class options to the parent class. \DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}} @@ -18,17 +16,6 @@ \setcounter{secnumdepth}{2} \setcounter{tocdepth}{1} -% This gives us all the Sphinx-specific markup that we really want. This should -% come last. Do not change this. -% -\RequirePackage{sphinx} - -% This comes after sphinx.sty because it otherwise defines its own "seealso" -% command. -% -\RequirePackage{makeidx} - - % Change the title page to look a bit better, and fit in with the fncychap % ``Bjarne'' style a bit better. % @@ -85,7 +72,6 @@ \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. @@ -110,14 +96,12 @@ \@ifundefined{fancyhf}{}{\pagestyle{normal}}% } - % 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. % \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}} \renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}} - % Fix the theindex 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. diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 5b137a2cb..7ce6cb513 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -11,11 +11,14 @@ \RequirePackage{textcomp} \RequirePackage{fancyvrb} \RequirePackage{fancyhdr} +\RequirePackage{fancybox} \RequirePackage{titlesec} \RequirePackage{tabulary} \RequirePackage{amsmath} % for \text - +\RequirePackage{makeidx} +\RequirePackage{framed} \RequirePackage{color} + % Redefine these colors to your liking in the preamble. \definecolor{TitleColor}{rgb}{0.126,0.263,0.361} \definecolor{InnerLinkColor}{rgb}{0.208,0.374,0.486} @@ -25,17 +28,6 @@ \definecolor{VerbatimColor}{rgb}{1,1,1} \definecolor{VerbatimBorderColor}{rgb}{1,1,1} -\RequirePackage[colorlinks, - breaklinks, - linkcolor=InnerLinkColor, - filecolor=OuterLinkColor, - menucolor=OuterLinkColor, - pagecolor=OuterLinkColor, - urlcolor=OuterLinkColor, - ]{hyperref} - -\RequirePackage{framed} - % Uncomment these two lines to ignore the paper size and make the page % size more like a typical published manual. %\renewcommand{\paperheight}{9in} @@ -98,23 +90,6 @@ % Use this to set the font family for headers and other decor: \newcommand{\py@HeaderFamily}{\sffamily\bfseries} -% Set up abstract ways to get the normal and smaller font sizes that -% work even in footnote context. -\newif\ifpy@infootnote \py@infootnotefalse -\let\py@oldmakefntext\@makefntext -\renewcommand{\@makefntext}[1]{% - \begingroup% - \py@infootnotetrue - \py@oldmakefntext{#1}% - \endgroup% -} -\def\py@defaultsize{% - \ifpy@infootnote\footnotesize\else\normalsize\fi% -} -\def\py@smallsize{% - \ifpy@infootnote\scriptsize\else\small\fi% -} - % Redefine the 'normal' header/footer style when using "fancyhdr" package: \@ifundefined{fancyhf}{}{ % Use \pagestyle{normal} as the primary pagestyle for text. @@ -144,7 +119,7 @@ \newcommand{\code}[1]{\texttt{#1}} \newcommand{\bfcode}[1]{\code{\bfseries#1}} \newcommand{\samp}[1]{`\code{#1}'} -\newcommand{\email}[1]{{\py@smallsize\textsf{#1}}} +\newcommand{\email}[1]{\textsf{#1}} \newcommand{\py@modulebadkey}{{--just-some-junk--}} @@ -153,7 +128,7 @@ \let\OriginalVerbatim=\Verbatim \let\endOriginalVerbatim=\endVerbatim -% Play with vpsace to be able to keep the indentation. +% Play with vspace to be able to keep the indentation. \newlength\distancetoright \newlength\leftsidespace \def\mycolorbox#1{% @@ -703,3 +678,10 @@ \py@Oldincludegraphics[#1]{#2}% \fi% } + + +% Include hyperref last. +\RequirePackage[colorlinks,breaklinks, + linkcolor=InnerLinkColor,filecolor=OuterLinkColor, + menucolor=OuterLinkColor,pagecolor=OuterLinkColor, + urlcolor=OuterLinkColor]{hyperref}