1. Georg Brandl
  2. sphinx


Georg Brandl  committed 0f96367 Merge

Merged in klukas/sphinx/memoir (pull request #67)

  • Participants
  • Parent commits 8984842, 57e5e6e
  • 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)