1. Georg Brandl
  2. sphinx


Georg Brandl  committed 9316423 Merge

merge heads

  • Participants
  • Parent commits 1c51aac, 0f96367
  • Branches default

Comments (0)

Files changed (2)

File sphinx/texinputs/sphinx.sty

View file
 \ProvidesPackage{sphinx}[2010/01/15 LaTeX package (Sphinx markup)]
 % 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.
-  \cleardoublepage
-  \phantomsection
-  \py@OldTheindex
-  \addcontentsline{toc}{chapter}{\indexname}
+  \let\py@OldTheindex=\theindex
+  \renewcommand{\theindex}{
+    \cleardoublepage
+    \phantomsection
+    \py@OldTheindex
+    \addcontentsline{toc}{chapter}{\indexname}
+  }
 % to make pdf with correct encoded bookmarks in Japanese

File sphinx/writers/latex.py

View file
         'papersize':       'letterpaper',
         'pointsize':       '10pt',
         'classoptions':    '',
+        'extraclassoptions': '',
         'inputenc':        '\\usepackage[utf8]{inputenc}',
         'utf8extra':       '\\DeclareUnicodeCharacter{00A0}{\\nobreakspace}',
         'fontenc':         '\\usepackage[T1]{fontenc}',
             self.elements['classoptions'] += ',english'
         # allow the user to override them all
+        if self.elements['extraclassoptions']:
+            self.elements['classoptions'] += ',' + self.elements['extraclassoptions']
         self.highlighter = highlighting.PygmentsBridge('latex',
             builder.config.pygments_style, builder.config.trim_doctest_flags)