Save as PDF without cell numbers

I want to save a notebook file as PDF, but without cell numbers.

For instance, take this document,

then select “save as PDF” and the result is,

How can I remove the cell numbers In[14], In[16], and Out[16]?

=================

1

 

I guess this may be useful… mathematica.stackexchange.com/questions/9437/…
– fasttouch
May 16 at 12:36

=================

2 Answers
2

=================

What you want, I think, is the cell option ShowCellLabel -> False. You can edit the stylesheet to add the option to the styles “Input” and “Output” in the “Printout” environment. Or you can add them to a notebook, assuming it has the default style definitions, as follows:

SetOptions[EvaluationNotebook[],
StyleDefinitions ->
Notebook[{Cell[StyleData[StyleDefinitions -> “Default.nb”]],
Cell[StyleData[“Input”, “Printout”], ShowCellLabel -> False],
Cell[StyleData[“Output”, “Printout”], ShowCellLabel -> False]}]]

As Alexey Popkov points out, it can be done more simply with

SetOptions[EvaluationNotebook[], ShowCellLabel -> False]

or for the current session (affecting all notebook temporarily) with

SetOptions[$FrontEndSession, ShowCellLabel -> False]

1

 

Actually the same can be achieved much simpler by setting the same option at the Notebook level: SetOptions[EvaluationNotebook[], ShowCellLabel -> False]. Note also that this option can also be set globally, for example SetOptions[$FrontEndSession, ShowCellLabel -> False] works (checked by saving as PDF with version 10.4.1).
– Alexey Popkov
May 16 at 20:15

  

 

@AlexeyPopkov Well, what do you know. I’m sure I tried that and was surprised it didn’t work. In fact the code is still in my scratch notebook. Works now, though.
– Michael E2
May 16 at 20:20

Evaluate this and then save as another nb, open the new nb file, and then save as PDF

SetOptions[InputNotebook[], CellLabelAutoDelete -> True];