jupyter/notebook

Jupyter Notebook + R: save to pdf without code problem

jclauneuro opened this issue · 2 comments

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

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

Same issue here.