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

Jupyter Notebook + R: save to pdf without code problem #3804

Open
jclauneuro opened this issue Jul 29, 2018 · 2 comments
Open

Jupyter Notebook + R: save to pdf without code problem #3804

jclauneuro opened this issue Jul 29, 2018 · 2 comments

Comments

@jclauneuro
Copy link

jclauneuro commented Jul 29, 2018

Hi there,

I would like to export a Jupyter notebook containing Markdown + R code + outputs with just Markdown + outputs. I've been following a solution posted on StackOverflow where they suggest setting the --TemplateExporter.exclude_input flag: https://stackoverflow.com/questions/49754862/jupyter-notebook-save-to-pdf-without-code

The following solution works as expected when exporting to html:

$ jupyter nbconvert volume_stats.ipynb --to=html --TemplateExporter.exclude_input=True
[NbConvertApp] Converting notebook volume_stats.ipynb to html
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nbconvert/filters/datatypefilter.py:41: UserWarning: Your element with mimetype(s) [] is not able to be represented.
  mimetypes=output.keys())
[NbConvertApp] Writing 907954 bytes to volume_stats.html

However, switching the export to pdf does not work:

$ jupyter nbconvert volume_stats.ipynb --to=pdf --TemplateExporter.exclude_input=True
[NbConvertApp] Converting notebook volume_stats.ipynb to pdf
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nbconvert/filters/datatypefilter.py:41: UserWarning: Your element with mimetype(s) [] is not able to be represented.
  mimetypes=output.keys())
[NbConvertApp] Support files will be in volume_stats_files/
[NbConvertApp] Making directory volume_stats_files
[NbConvertApp] Making directory volume_stats_files
[NbConvertApp] Making directory volume_stats_files
[NbConvertApp] Making directory volume_stats_files
[NbConvertApp] Making directory volume_stats_files
[NbConvertApp] Making directory volume_stats_files
[NbConvertApp] Writing 35763 bytes to notebook.tex
[NbConvertApp] Building PDF
[NbConvertApp] Running xelatex 3 times: [u'xelatex', u'notebook.tex']
[NbConvertApp] Running bibtex 1 time: [u'bibtex', u'notebook']
[NbConvertApp] WARNING | bibtex had problems, most likely because there were no citations
[NbConvertApp] PDF successfully created
[NbConvertApp] Writing 366844 bytes to volume_stats.pdf

Version info:

Server Information:
You are using Jupyter notebook.

The version of the notebook server is: 5.5.0
The server is running on this version of Python:
Python 3.6.5 |Anaconda, Inc.| (default, Apr 26 2018, 08:42:37) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]

Current Kernel Information:
R version 3.4.3 (2017-11-30)

Appreciate the help,
j

@jclauneuro
Copy link
Author

Fyi, I've updated the stackoverflow question with a workaround solution involving converting to html first and then using a web browser to print to pdf.
https://stackoverflow.com/questions/49754862/jupyter-notebook-save-to-pdf-without-code/51717458#51717458

@godsylla
Copy link

Same issue here.

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

No branches or pull requests

2 participants