4
$\begingroup$

Every evaluation generates a pair of In[n]/Out[n] signs tagged before actual input and output. Like the following:

enter image description here

If I save the file, close it and re-open it, that In[n]/Out[n] signs will disappear (as expected). Like the following:

enter image description here

However, A code example in documentation file will always have its In[n]/Out[n] signs no matter you have computed that piece of code or not. Like the following:

enter image description here

My question is: How to perserve the In[n]/Out[n] signs generated by computation even if I re-open the same file on a fresh kernel? Like what it looks like for documentation files.

Maybe it is necessary to use DumpSave like stated in this question?

Besides, how to access stylesheet of documentation files? If I can apply that style to my code notes would be great.

$\endgroup$
5
  • 1
    $\begingroup$ The documentation notebooks have Savable -> False, so you can edit but not save them. So all you need to do is to start with a clean kernel (Quit), evaluate the notebook, save and then set Saveable to False. $\endgroup$
    – rm -rf
    Jul 8, 2014 at 5:36
  • $\begingroup$ @rm-rf hrmm... answer? $\endgroup$
    – Yves Klett
    Jul 8, 2014 at 7:09
  • $\begingroup$ @YvesKlett Can't use mma right now, so no dice. Please feel free to post it as an answer after verifying that it does work... I'm not sure I got the steps in the right order :) $\endgroup$
    – rm -rf
    Jul 8, 2014 at 7:13
  • $\begingroup$ @rm-rf Thank you for your advice. But I don't think it's a Saveable problem. (Or maybe you can enlighten me more precisely?) I have re-phrased my question. Hope it is clearer now? $\endgroup$
    – Naitree
    Jul 8, 2014 at 7:39
  • 1
    $\begingroup$ @Naitree I was wrong then :) Mike's answer is the correct one $\endgroup$
    – rm -rf
    Jul 8, 2014 at 7:48

1 Answer 1

6
$\begingroup$

You need to set CellLabelAutoDelete->False

You can do this programmatically:

SetOptions[EvaluationNotebook[],CellLabelAutoDelete->False]

or set it in your stylesheet.

$\endgroup$
1
  • $\begingroup$ Many thanks. A simple setting saved my day! :) $\endgroup$
    – Naitree
    Jul 8, 2014 at 7:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.