Georg Brandl avatar Georg Brandl committed 0f96367 Merge

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

Comments (0)

Files changed (2)

sphinx/texinputs/sphinx.sty

 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
 \ProvidesPackage{sphinx}[2010/01/15 LaTeX package (Sphinx markup)]
 
+\@ifclassloaded{memoir}{}{\RequirePackage{fancyhdr}}
+
 \RequirePackage{textcomp}
-\RequirePackage{fancyhdr}
 \RequirePackage{fancybox}
 \RequirePackage{titlesec}
 \RequirePackage{tabulary}
 % 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.
 %
-\let\py@OldTheindex=\theindex
-\renewcommand{\theindex}{
-  \cleardoublepage
-  \phantomsection
-  \py@OldTheindex
-  \addcontentsline{toc}{chapter}{\indexname}
+\@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

sphinx/writers/latex.py

         '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
         self.elements.update(builder.config.latex_elements)
+        if self.elements['extraclassoptions']:
+            self.elements['classoptions'] += ',' + self.elements['extraclassoptions']
 
         self.highlighter = highlighting.PygmentsBridge('latex',
             builder.config.pygments_style, builder.config.trim_doctest_flags)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.