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.

I have a long Mathematica notebook where some cells on multiple levels are closed for clarity.

When I export the notebook as a PDF via Print or Save as, the print only contains the opened cells.

I want to be able to print all cells - even the closed ones - into the PDF.
When I open them via Cell -> Grouping -> Open all Subgroups my actual notebook is changed destructively, and I have to re-close certain groups by hand because there's no proper undo.

Did I miss any option?

share|improve this question
3  
Quick an dirty: save your notebook in the desired state, open all cells, print and then revert to the saved notebook? –  Yves Klett Jul 1 at 14:36
    
@YvesKlett Pity, that you didn't put your comment as an answer :) –  eldo Jul 1 at 14:55
    
Thank you for your answer! I hoped there was a much more elegant solution to this - I don't have the feeling that I'm trying to achieve something extravagant here. Hopefully Mathematica 10 will improve this. –  Thomas Fankhauser Jul 1 at 17:18

1 Answer 1

Another quick(?) and dirty way:

Let nb be the notebook to be printed. E.g., execute nb = EvaluationNotebook[] in the notebook you would like. Then execute

NotebookPrint[NotebookGet@nb /. CellGroupData[data_, Closed] :> CellGroupData[data, Open]]

or

Export["/tmp/foo.pdf", 
 NotebookGet@nb /. CellGroupData[data_, Closed] :> CellGroupData[data, Open]]

One potential drawback is that NotebookGet essentially creates a copy of the notebook (I assume).

There is probably a way to make it more automatic. Others here are more fluent in manipulating notebooks than I am. I have had this problem, but I cannot find or recall how I dealt with it. Perhaps as Yves suggested in a comment: save the notebook, open all cells, print, and revert to saved.

share|improve this answer

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.