0

I have a notebook (assume the notebook name is notebook for now, even though it isn't) that I currently run using the following command: jupyter nbconvert --to pdf --execute notebook.ipynb. I want the output to be a pdf, not html so I add the --to pdf. While this runs successfully, I do not want the code cells at the top to show such as my imports and function definitions. Using the edit metadata under view (toolbar), I changed the cells at the top to "hide_input": true.

From my research, it seems that a template is the best way to hide the code cells. However, I am not sure how to use these correctly. I create a .tplx file in my working directory that follows the printviewlatex.tplx code here (I directly copied the code and pasted into a file in the same directory as my notebook): https://github.com/mandli/IPython-notebook-extensions/blob/master/templates/printviewlatex.tplx. However, it does not work and I don't fully understand the errors. I have included a snippet of what popped up in my terminal, in case that helps.

I know the pdf generated properly without the template, so there must be an issue with that itself or how I am currently using it. I would love any thoughts on how to fix this, or even other approaches to hide the code input. Ultimately, that is my goal so I am okay with any solution, template or no template. Thank you!

enter image description here

Jane Sully
  • 3,137
  • 10
  • 48
  • 87
  • Did you check out `hide_code` and why did you decide against using it if so https://github.com/kirbs-/hide_code – Charles Landau Jan 23 '19 at 04:26
  • I might be sharing the notebook with other people, so it's one more thing for them to install if so. Also I came across it and pip installed it, but it doesn't show up for me. Not sure why? – Jane Sully Jan 23 '19 at 04:29
  • Might not show up because of `Note: add --sys-prefix to jupyter nbextension to install into virtualenv or conda environment.` – Charles Landau Jan 23 '19 at 04:30

0 Answers0