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.

This question already has an answer here:

I would like to use a Mathematica notebook as a printable document with conditional output. If the condition is true, some parts of the notebook should be printed; otherwise they should not be printed. The condition that controls printing might be set in a cell at the start of the notebook, but this cell should not be visible in the printed document.

How could I do this? I have looked into cells, input and output in the Documentation Center, but could not find what I needed.

share|improve this question

marked as duplicate by Mr.Wizard Sep 2 '13 at 6:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

By parts you mean Cells or you want to split cells also? What version are you using? –  Kuba Sep 1 '13 at 14:54
Thank you for your answer!I am using version 9. I would like to be able to hide cells when the document is prepared for printing... Is that possible? –  Gabriel Sep 1 '13 at 15:34
Closely related, possible duplicate: (11898) –  Mr.Wizard Sep 1 '13 at 23:07
@Mr.Wizard I think you are right. Should I answer that question and delete or not this answer? I may also edit tkott's answer, it was before Cells, bacause it seems he is offline quite long. –  Kuba Sep 2 '13 at 6:08
@Kuba I think you should answer that question if you feel this is a duplicate. You are not obligated to delete this one, but it would keep the site a little cleaner if you do. –  Mr.Wizard Sep 2 '13 at 6:52

1 Answer 1

up vote 5 down vote accepted

Too long for comment and there is not much information in the question but I would use CellTags. You can add tag by Ctrl+J or via menu: Cell/CelTags/Add...

If you want to print only cells with particular tag you can create such document:

               NotebookRead /@ Cells[EvaluationNotebook[], 
                                     GeneratedCell -> False, CellTags -> "tag1"]

And you can print it then. And close without saving.

You only have to change "tag1" to change the content of new notebook.

share|improve this answer
Thank you a lot for your answer, this was just what I was looking for! –  Gabriel Sep 1 '13 at 16:01
@Gabriel I'm glad it helps :) If you restate your question to be more precise (maybe a screenshot too?) You may receive even better answers. Then, it is also good habit to hold on with accept (a day or two) to not discourage others :) Meanwhile, you can always upvote the answers you find useful. –  Kuba Sep 1 '13 at 16:13
@PinguinDirk Thanks :) –  Kuba Sep 1 '13 at 19:14
:) I like the answer, I once had to solve a similar problem. And as the Crtl drove me crazy and I might revisit that answer, I just had to –  Pinguin Dirk Sep 1 '13 at 19:27

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