Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
1  
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. –  rm -rf Jul 8 at 5:36
    
@rm-rf hrmm... answer? –  Yves Klett Jul 8 at 7:09
    
@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 :) –  rm -rf Jul 8 at 7:13
    
@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? –  Naitree Jul 8 at 7:39
1  
@Naitree I was wrong then :) Mike's answer is the correct one –  rm -rf Jul 8 at 7:48

1 Answer 1

up vote 5 down vote accepted

You need to set CellLabelAutoDelete->False

You can do this programmatically:

SetOptions[EvaluationNotebook[],CellLabelAutoDelete->False]

or set it in your stylesheet.

share|improve this answer
    
Many thanks. A simple setting saved my day! :) –  Naitree Jul 8 at 7:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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