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

Escape filename for pdflatex in nbconvert #3865

Merged
merged 3 commits into from Aug 1, 2013

Conversation

astrofrog
Copy link
Contributor

This is a simple change, but it's needed otherwise filenames with spaces cause issues:

$ ipython3 nbconvert 12.\ Files\ and\ strings\ \(advanced\).ipynb --to latex --post PDF
[NbConvertApp] Using existing profile dir: '/Users/tom/.ipython/profile_default'
[NbConvertApp] Converting notebook 12. Files and strings (advanced).ipynb to latex
[NbConvertApp] Support files will be in 12. Files and strings (advanced)_files/
[NbConvertApp] Loaded template latex_article.tplx
[NbConvertApp] Writing 30139 bytes to ./12. Files and strings (advanced).tex
[NbConvertApp] Building PDF: `pdflatex ./12. Files and strings (advanced).tex`
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `pdflatex ./12. Files and strings (advanced).tex'
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `pdflatex ./12. Files and strings (advanced).tex'
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `pdflatex ./12. Files and strings (advanced).tex'

@minrk
Copy link
Member

minrk commented Aug 1, 2013

We really shouldn't ever be building subcommands as a single string when we don't have to. Do you want to change the code so that the configurable is actually a list? Something like:

    command = List(["pdflatex", "{filename}"], config=True,...)
    ...
    command = [ c.format(filename=input) for c in self.command ]

@astrofrog
Copy link
Contributor Author

@minrk - no problem, I'll see what I can do

…-processor, which is a better way to avoid issues if there are spaces in the filename.
@astrofrog
Copy link
Contributor Author

@minrk - I implement it the way you suggest, which I agree is cleaner. Would you prefer for me to rebase and squash the commits?

@@ -30,7 +30,7 @@ class PDFPostProcessor(PostProcessorBase):
How many times pdflatex will be called.
""")

compiler = Unicode(u'pdflatex {0}', config=True, help="""
compiler = List(["pdflatex", "{filename}"], config=True, help="""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe rename 'compiler' to 'command'

@minrk
Copy link
Member

minrk commented Aug 1, 2013

No need to rebase. Rename 'compiler' to perhaps more accurate 'command', and it should be ready to go.

@minrk
Copy link
Member

minrk commented Aug 1, 2013

Thanks!

minrk added a commit that referenced this pull request Aug 1, 2013
use `command` list instead of compiler string in PDFPostProcessor

avoids issues with spaces
@minrk minrk merged commit 4266eb0 into ipython:master Aug 1, 2013
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
…-spaces

use `command` list instead of compiler string in PDFPostProcessor

avoids issues with spaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants