将iPython Notebook转换为PDF时出错

时间:2014-12-09 16:10:57

标签: latex ipython ipython-notebook ubuntu-14.04 tex

我搜索了许多相关帖子而没有找到解决方案。我正在尝试使用以下命令将Ipython Notebook .ipynb文件转换为PDF:

$ ipython nbconvert --to latex --post PDF BTNFWeatherStationplotter.ipynb

我正在运行Ubuntu 14.04,iPython 2.2.0,TeX 3.1415926(TeX Live 2013 / Debian),pandoc 1.12.2.1以及iPython Notebook安装文档中指定的所有其他依赖项。

我收到以下错误消息:

(gen_sci)pwright@PJW:~/CSCI250_comp_science/snow_scraper/BTNFWeatherStationplotter_files [master] $ ipython nbconvert --to latex --post PDF BTNFWeatherStationplotter.ipynb
[NbConvertApp] Using existing profile dir: u'/home/pwright/.ipython/profile_default'
[NbConvertApp] Converting notebook BTNFWeatherStationplotter.ipynb to latex
[NbConvertApp] Support files will be in BTNFWeatherStationplotter_files/  
[NbConvertApp] Loaded template article.tplx
[NbConvertApp] Writing 74454 bytes to BTNFWeatherStationplotter.tex
[NbConvertApp] Building PDF
[NbConvertApp] Running pdflatex 3 times: [u'pdflatex', u'BTNFWeatherStationplotter.tex']
[NbConvertApp] CRITICAL | pdflatex failed: [u'pdflatex', u'BTNFWeatherStationplotter.tex']
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) restricted \write18 enabled. entering extended mode
(./BTNFWeatherStationplotter.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 2 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/etc/texmf/tex/latex/config/graphics.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(/usr/share/texlive/texmf-dist/tex/latex/adjustbox/adjustbox.sty
(/usr/share/texlive/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkeyval.tex))
(/usr/share/texlive/texmf-dist/tex/latex/adjustbox/adjcalc.sty)
(/usr/share/texlive/texmf-dist/tex/latex/adjustbox/trimclip.sty
(/usr/share/texlive/texmf-dist/tex/latex/collectbox/collectbox.sty)
(/usr/share/texlive/texmf-dist/tex/latex/adjustbox/tc-pdftex.def))
(/usr/share/texlive/texmf-dist/tex/latex/ifoddpage/ifoddpage.sty)
(/usr/share/texlive/texmf-dist/tex/latex/varwidth/varwidth.sty))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty
(/etc/texmf/tex/latex/config/color.cfg))
(/usr/share/texlive/texmf-dist/tex/latex/tools/enumerate.sty)
(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty
(/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def))
(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def))
(/usr/share/texlive/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix 
<2008/02/07> (tvz))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grffile.sty
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty))))
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty))
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty))

Package hyperref Message: Driver (autodetected): hpdftex.

(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/share/texlive/texmf-dist/tex/latex/tools/longtable.sty)
(/usr/share/texlive/texmf-dist/tex/latex/booktabs/booktabs.sty)
(./BTNFWeatherStationplotter.aux)
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
)
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex

Package geometry Warning: The marginal notes overrun the paper.
 Add 3.73001pt and more to the right margin.

*geometry* verbose mode - [ preamble ] result:
* driver: pdftex
* paper: <default>
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes: 
* h-part:(L,W,R)=(72.26999pt, 469.75502pt, 72.26999pt)
* v-part:(T,H,B)=(72.26999pt, 650.43001pt, 72.26999pt)
* \paperwidth=614.295pt
* \paperheight=794.96999pt
* \textwidth=469.75502pt
* \textheight=650.43001pt
* \oddsidemargin=0.0pt
* \evensidemargin=0.0pt
* \topmargin=-37.0pt
* \headheight=12.0pt
* \headsep=25.0pt
* \topskip=10.0pt
* \footskip=30.0pt
* \marginparwidth=65.0pt
* \marginparsep=11.0pt
* \columnsep=10.0pt
* \skip\footins=9.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidefalse
* \@mparswitchfalse
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)

(/usr/share/texlive/texmf-dist/tex/latex/ucs/ucsencs.def)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./BTNFWeatherStationplotter.out) (./BTNFWeatherStationplotter.out)
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd)

LaTeX Warning: No \author given.

! Argument of \@xverbatim has an extra }.
<inserted text> 
            \par 
l.233 \end{verbatim}}

? 
! Emergency stop.
<inserted text> 
            \par 
l.233 \end{verbatim}}

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on BTNFWeatherStationplotter.log.

[NbConvertApp] Removing temporary LaTeX files

我可以使用wkhtmltopdf成功从html获取PDF,但我想看看使用nbconvert的质量是否更好。

此外,这是我的q.log文件的输出:

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) (format=latex   2014.8.18)  8 DEC 2014 22:34
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**q
(/usr/share/texlive/texmf-dist/tex/latex/tools/q.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 2 languages loaded.
File ignored
)
! Emergency stop.
<*> q

*** (job aborted, no legal \end found)


Here is how much of TeX's memory you used:
 6 strings out of 495033
 245 string characters out of 6181744
 45941 words of memory out of 5000000
 3315 multiletter control sequences out of 15000+600000
 3640 words of font info for 14 fonts, out of 8000000 for 9000
 14 hyphenation exceptions out of 8191
 5i,0n,1p,81b,8s stack positions out of 5000i,500n,10000p,200000b,80000s
No pages of output.

1 个答案:

答案 0 :(得分:1)

您的第一个文本单元实际上有两个问题(&#34;以下代码访问snow和...&#34; enter image description here

  1. 你使用标题3单元格,因此这部分转换为LaTeX子部分,很可能不是你想要的。

  2. 您已使用4个空格缩进文本,这是用于创建逐字环境的markdown语法。 乳胶标题中不允许使用逐字环境,因此也必须更改。

  3. 如果您坚持笔记本中的标题样式,可以使用<h3> html标记来标记您的第一段(但没有4个空格缩进)。但是,在转换为pdf期间,这些标签将被删除 - 文本将是纯乳胶。

    如果要突出显示笔记本中的第一段和pdf,可以使用粗体字符。必要的降价语法是**foo**。这种降价在转换为乳胶后仍然存在。