Nbconvert: DataFrames output in Jupyter notebook - nbconvert to pdf error

Created on 24 May 2016  路  6Comments  路  Source: jupyter/nbconvert

migrated from DataFrames and jupyter-js-notebook as this is likely the more appropriate place to post this issue.

Converting output of Jupyter notebook with DataFrames output to a pdf with nbconvert causes the a 500 error. reporting Unknown Unicode character 9474 = U+2502,.

When I clear the DataFrame output that generates these characters, nbconvert works just fine. However, nbconvert should be able to deal with this unicode character.

LaTeX

Most helpful comment

Thanks @takluyver

Setting up a config file nbConvertConfig.py in the same directory as the notebook that contains the following:

c = get_config()
c.PDFExporter.latex_command = ['xelatex', '{filename}']

then running jupyter nbconvert --to pdf --config nbConvertConfig.py Example.ipynb from the console worked.

All 6 comments

The switch from pdflatex to xelatex in master may fix this.

Thanks @minrk . I am having the same issue. Could you explain what you mean by ' master may fix this'

@Shaun1818 look at use xelatex by default

I updated nbconvert but still get this

[NbConvertApp] Running pdflatex 3 times: ['pdflatex', 'notebook.tex']
[NbConvertApp] CRITICAL | p failed: pdflatex notebook.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (MiKTeX 2.9 64-bit)

from jupyter nbconvert --help-all, one of the options under PDFExporter options is

--PDFExporter.latex_command=<List>
    Default: ['pdflatex', '{filename}']
    Shell command used to compile latex.

So from the console

jupyter nbconvert --to pdf --PDFExporter.latex_command=(xelatex Example.ipynb)

where Example.ipynb is the name of your notebook.

However, this just opens up the notebook in TeXworks.

To set that config option, one of the arguments actually needs to be {filename}. Nbconvert will generate a .tex file from the notebook file and then pass that filename to latex in place of {filename}. It's probably easier to set it in a config file than to work out what combination of quoting and escapes you need to pass it at the command line.

Thanks @takluyver

Setting up a config file nbConvertConfig.py in the same directory as the notebook that contains the following:

c = get_config()
c.PDFExporter.latex_command = ['xelatex', '{filename}']

then running jupyter nbconvert --to pdf --config nbConvertConfig.py Example.ipynb from the console worked.

Great, I'm glad you got it working. In that case, I think this should be fixed by changing the default to xelatex, so I'll close this issue.

Was this page helpful?
0 / 5 - 0 ratings