Merge pull request #3034 from jfbu/use_sphinxoption_forkeepoldnames

make sphinx latex style file use a package option
This commit is contained in:
Takeshi KOMIYA 2016-10-12 21:14:51 +09:00 committed by GitHub
commit 54d2084fc4
3 changed files with 8 additions and 3 deletions

View File

@ -1,6 +1,6 @@
%% Generated by Sphinx.
\def\sphinxdocclass{<%= docclass %>}
\newif\ifsphinxKeepOldNames <%= keepoldnames %>
<%= keepoldnames %>
\documentclass[<%= papersize %>,<%= pointsize %><%= classoptions %>]{<%= wrapperclass %>}
\ifdefined\pdfpxdimen
\let\sphinxpxdimen\pdfpxdimen\else\newdimen\sphinxpxdimen

View File

@ -7,6 +7,10 @@
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sphinx}[2016/06/10 LaTeX package (Sphinx markup)]
\newif\ifsphinxKeepOldNames \sphinxKeepOldNamestrue
\DeclareOption{dontkeepoldnames}{\sphinxKeepOldNamesfalse}
\DeclareOption*{\PackageWarning{sphinx}{Unknown option `\CurrentOption'}}
\ProcessOptions\relax
% this is the \ltx@ifundefined of ltxcmds.sty, which is loaded by
% hyperref.sty, but we need it before, and initial ltxcmds.sty

View File

@ -350,9 +350,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
})
# set-up boolean for sphinx.sty
if builder.config.latex_keep_old_macro_names:
self.elements['keepoldnames'] = '\\sphinxKeepOldNamestrue'
self.elements['keepoldnames'] = ''
else:
self.elements['keepoldnames'] = '\\sphinxKeepOldNamesfalse'
self.elements['keepoldnames'] = ('\\PassOptionsToPackage'
'{dontkeepoldnames}{sphinx}')
if document.settings.docclass == 'howto':
docclass = builder.config.latex_docclass.get('howto', 'article')
else: