summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Klukas <devnull@localhost>2012-05-22 15:50:45 -0500
committerJeff Klukas <devnull@localhost>2012-05-22 15:50:45 -0500
commit31394e589aac73387bbf6c3ae3103be2c78a947b (patch)
tree6b3aab381cd86b1f68e4ed2984e248e4d921ab1c
parent86dfb82611fd1e932da2f3154149efe477848e43 (diff)
downloadsphinx-31394e589aac73387bbf6c3ae3103be2c78a947b.tar.gz
Added protection for the memoir class
-rw-r--r--sphinx/texinputs/sphinx.sty18
-rw-r--r--sphinx/writers/latex.py3
2 files changed, 14 insertions, 7 deletions
diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
index 08adec9e..78919046 100644
--- a/sphinx/texinputs/sphinx.sty
+++ b/sphinx/texinputs/sphinx.sty
@@ -8,8 +8,9 @@
\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}
@@ -405,18 +406,21 @@
% 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}
+ }
}
% Include hyperref last.
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index e5ef3a61..56b3e9ce 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -134,6 +134,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
'papersize': 'letterpaper',
'pointsize': '10pt',
'classoptions': '',
+ 'extraclassoptions': '',
'inputenc': '\\usepackage[utf8]{inputenc}',
'utf8extra': '\\DeclareUnicodeCharacter{00A0}{\\nobreakspace}',
'fontenc': '\\usepackage[T1]{fontenc}',
@@ -216,6 +217,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
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)