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]
?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityI 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]
?
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]
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).
$\endgroup$
May 16, 2016 at 20:15
Evaluate this and then save as another nb, open the new nb file, and then save as PDF
SetOptions[InputNotebook[], CellLabelAutoDelete -> True];