To suppress the code cells (only input) a custom template can be used. Similar as discussed in this question, a template e.g. latex_nocode.tplx has to be created (in the working directory) with the following content (for IPython 1.x)
((*- extends 'latex_article.tplx' -*))
% Disable input cells
((* block input_group *))
((* endblock input_group *))
use this template like
ipython nbconvert --to=latex --template=latex_nocode.tplx --post=pdf file.ipynb
Maybe I should add that this way the input block is simply replaced by a blank block (actually a latex comment that input cells are disabled).
When checking the predefined latex templates, the individual blocks (code, markdown, heading, etc) can be identified and a respective custom templates can be set-up to style the output as desired.
Edit
as user1248490 pointed out since IPython 2.0 the latex templates to be extended are called
article.tplx
, report.tplx
or base.tplx
. Hence the example from above should look like
((*- extends 'article.tplx' -*))
% Disable input cells
((* block input_group *))
((* endblock input_group *))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…