Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I print grouped cells with CellPrint ?

The closest thing I have to what I want to do is this


But the cells aren't grouped.

share|improve this question

Not pretty, but it works:

  CellGroup[{TextCell["i", "Item", CellTags -> "groupit"], 
    ExpressionCell[Defer[x^2;], "Input", CellTags -> "groupit"]}, 1]];
NotebookFind[EvaluationNotebook[], "groupit", All, CellTags];
SelectionMove[EvaluationNotebook[], After, Cell]
share|improve this answer
Thanks, this would be perfect if the grouped cells were closed, as the ExpressionCell typically contains big outputs in what I want to do. – faysou Feb 5 '13 at 14:44
I found it, FrontEndExecute[FrontEndToken["OpenCloseGroup"]]; before SelectionMove – faysou Feb 5 '13 at 14:48
Fyi I have incorporated your answer in my answer here – faysou Feb 5 '13 at 15:06

Your Answer


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.