2017-02-03 94 views
1

我目前使用sphinx 1.4.9来创建文档。当给make latexpdf时,我得到以下错误。使用sphinx生成latexpdf时出错

(/usr/share/texmf/tex/latex/upquote/upquote.sty) 
(/usr/share/texmf/tex/latex/float/float.sty) 
(/usr/share/texmf/tex/latex/graphics/graphicx.sty 
(/usr/share/texmf/tex/latex/graphics/graphics.sty 
(/usr/share/texmf/tex/latex/graphics/trig.sty) 
(/usr/lib/texmf/tex/latex/config/graphics.cfg))) 
(/usr/share/texmf/tex/plain/misc/pdfcolor.tex) 
(/usr/share/texmf/tex/latex/hyperref/hyperref.sty 
(/usr/share/texmf/tex/latex/hyperref/pd1enc.def) 
(/usr/lib/texmf/tex/latex/config/hyperref.cfg) 
(/usr/share/texmf/tex/latex/oberdiek/kvoptions.sty) 

****! Package keyval Error: pdfencoding undefined.**** 

See the keyval package documentation for explanation. 

我已经在sphinx.egg中搜索pdfencoding,它也只出现在sphinx.sty中。 但我不知道如何定义这个pdfencoding。是否编辑conf.py或如何操作。

+0

同问题http://tex.stackexchange.com/q/351851 – mzjn

回答

0

你的hyperref已过时。经测试,Sphinx 1.4.x系列可与Ubuntu Precise(Debian/TeXLive 2009)一起使用。我无法尝试,但这是一种可以帮助你的黑客攻击。不过,或许是因为你的TeX的安装是真的老了其他部分会失败......

'passoptionstopackages' : """ 
\\let\\originalPassOptionsToPackage\\PassOptionsToPackage 
\\makeatletter 
\\def\\PassOptionsToPackage#1{% 
    \\def\\@tempa{#1}\\def\\@tempb{pdfencoding=unicode}% 
    \\ifx\\@tempa\\@tempb\\expandafter\\@gobbletwo 
    \\else\\expandafter\\originalPassOptionsToPackage\\fi {#1}} 
\\makeatother 
""", 

conf.pylatex_elements配置变量里面。可以工作...

+0

我已经尝试了很多与passoptionstopackages。但似乎总是出现“Package keyval Error:pdfencoding undefined”错误。或unicode未定义。 现在将狮身人面像版本降级到1.3.6。因为pdfencoding是在1.4.x中引入的。目前工作正常。 –

+0

上面重新定义了LaTeX'\ PassOptionsToPackage'来拦截该特定场合,当它与第一个参数'pdfencoding = unicode'一起使用时,这是Sphinx自1.4.2以来所做的。如果你能在构建LaTeX的'.log'文件中找到它,这将会很有趣。最上面的一行会告诉你使用什么样的TeX安装信息,如果你搜索'hyperref'字符串,你会得到它的包版本号和日期。只是好奇 ... – jfbu