Suppress code in NBConvert? IPython

后端 未结 3 1131
南旧
南旧 2020-12-08 01:32

I have figured out how to suppress large code blocks from showing up in final NB convert (PDF) output.

By putting the LaTex command in a \"raw cell before the code I

3条回答
  •  青春惊慌失措
    2020-12-08 01:51

    Corrections to the answer above:

    1) Correct document class name in the latex file above

    You should change the line

    ((*- extends 'article.tplx' -*))
    % Disable input cells
    ((* block input_group *))
    ((* endblock input_group *))
    

    2) Add local directory to nbconvert config as

    sudo gedit /usr/local/lib/python2.7/dist-packages/jupyter_core/tests/dotipython/profile_default/ipython_nbconvert_config.py

    add a line c.TemplateExporter.template_path = ['.'] to the file

    3) Call the converter as

    ipython nbconvert --to=pdf --template=latex_nocode.tplx tested_notebook.ipynb

    or if you want to execute all cells for a report for example:

    ipython nbconvert --to=pdf --template=latex_nocode.tplx --ExecutePreprocessor.enabled=True tested_notebook.ipynb

提交回复
热议问题