2

The output of the DataFrame package for Julia looks good in a Jupyter notebook, but converting to a pdf with nbconvert causes the following error.

! Package ucs Error: Unknown Unicode character 9474 = U+2502,
(ucs)                possibly declared in uni-37.def.
(ucs)                Type H to see if it is available with options.

See the ucs package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.410 │ Row │ A │ B       │ C    │

? 
! Emergency stop.
 ...                                              

l.410 │ Row │ A │ B       │ C    │

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

The unicode character U+2502 is the "BOX DRAWINGS LIGHT VERTICAL", which is the vertical pipes the DataFrames package uses to separate the table columns.

Any suggestions on how to stop this?

Clay
  • 2,584
  • 1
  • 28
  • 63
  • 1
    I suggest you report this as an issue directly on the nbconvert repository on GitHub. – David P. Sanders May 19 '16 at 10:15
  • https://github.com/jupyter/nbconvert/blob/master/nbconvert/templates/latex/base.tplx : \usepackage[mathletters]{ucs} % Extended unicode (utf-8) support – Artem Oboturov May 19 '16 at 18:40
  • @ArtemOboturov, I put this template in my Jupyter directory to replace the existing base.tplx file and put it in the same folder of the notebook and nothing changed. Sorry, but what do I do with this information? – Clay May 24 '16 at 06:13
  • @Clay you could build and install package from sources changing encoding from [mathletters] to something else. Or just report a bug specifying that you have unicode problems. – Artem Oboturov May 25 '16 at 21:37
  • @ArtemOboturov, thanks. I did this. You can see the progress on [github](https://github.com/jupyter/nbconvert/issues/314#issuecomment-222130808). – Clay May 28 '16 at 23:29

1 Answers1

2

Thanks to Thomas K and minrk on github the following fixed the problem.

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

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

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

Community
  • 1
  • 1
Clay
  • 2,584
  • 1
  • 28
  • 63