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.

Is there a way to insert a closed section? I know in .m files if you do (* ::Section::Closed:: *) and open the .m file using system editor, a closed section will be displayed. Is there a way to create a closed section in the notebook while using CreateDocument[]?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

yes, but a notebook has a more involved structure than the .m files you have investigated. The code to do what you want isn't very complicated, though:

CreateDocument[{CellGroup[{
    TextCell["section", "Section"],
    TextCell["content", "Text"]
    }, Closed]}]
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.