Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding a space to notebook title breaks conversion to pdf #633

Closed
clancia opened this issue Jul 26, 2017 · 6 comments
Closed

adding a space to notebook title breaks conversion to pdf #633

clancia opened this issue Jul 26, 2017 · 6 comments
Labels
format:PDF pertains to exporting to the PDF format

Comments

@clancia
Copy link

clancia commented Jul 26, 2017

Hi there,

not sure if it qualifies as an issue.
I've just noticed that if the notebook title contains a space, then

jupyter nbconvert --to pdf note\ book.ipnb

fails if the notebook contains image output.

The error given by xelatex is

! Missing $ inserted.
<inserted text> 
                $

The issue is not present with Markdown-embedded images, but only with output images (e.g. generated by matplotlib.pyplot).

Please note that exporting to pdf via File > Download as > PDF via LaTeX works fine. Perhaps this is because spaces are replaced by +'s?
Anyway, a very simple solution is to avoid spaces in the notebook name and use a template for having a nicely formatted title when exporting to pdf.

Jupyter v. 4.3.0
Python 3.6.2 :: Anaconda custom (x86_64)
macOS 10.12.6

@mpacer
Copy link
Member

mpacer commented Aug 16, 2017

If you go to tex directly and then convert it does this work?

@jpgrayson
Copy link

I am also observing this issue with jupyter-core 4.3.0. Running:

jupyter-nbconvert --to pdf Notebook\ With\ Spaces.ipynb

produces a truncated, single-page pdf whereas File > Download as > PDF via LaTeX produces the correct (six-page) pdf.

If you go to tex directly and then convert it does this work?

Yes, this workflow seems to produce the same output as the browser export:

jupyter-nbconvert --to latex Notebook\ With\ Spaces.ipynb
pdflatex Notebook\ With\ Spaces.tex

@clancia
Copy link
Author

clancia commented Oct 26, 2017

Seems to be xelatex related, as far as I understand

jupyter nbconvert --to latex note\ book.ipynb
xelatex note\ book.ipynb

throws the same error as jupyter nbconvert --to pdf note\ book.ipynb

@erinzm
Copy link

erinzm commented Oct 28, 2017

this is related to spaces in the filename when calling the \adjustimage command.

@t-makaro
Copy link
Contributor

t-makaro commented Aug 6, 2019

See my closing comment here.

@t-makaro t-makaro closed this as completed Aug 6, 2019
@ytomar
Copy link

ytomar commented Jul 16, 2020

Work perfectly for me if we enclose the file name in double quotes

jupyter nbconvert --to pdf --TemplateExporter.exclude_input=True "Note book with spaces.ipynb"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
format:PDF pertains to exporting to the PDF format
Projects
None yet
Development

No branches or pull requests

6 participants