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

I have a project with a friend, and we make some work in Mathematica. He is not very good at Mathematica, and I have made some long necessary formulas we need. I would like to show what I've made but only show what's important. Therefore I need to hide some of the input but not all of it.

I have made some research and found this:

AutoCollapse[] := (If[$FrontEnd =!= $Failed,SelectionMove[EvaluationNotebook[], All, GeneratedCell];

The problem with this is it hides all input when used. The example i made below, is it possible in some way, or do I have to break it up into two different inputs?

share|improve this question
Can't you simply fold/close/collapse the input cells that you want to hide? – R. M. Apr 14 '13 at 17:55
If you double click an output cell's cell bracket, the input cell grouped together with it will be hidden. Is this what you are looking for? – Szabolcs Apr 14 '13 at 18:07
Have a look here: – Yves Klett Apr 14 '13 at 18:12
Related: – R. M. Apr 14 '13 at 18:57
@rm-rf It is that function I need, but it must be as a formula. When I Evaluate Notebook they all gets shown again. – Jens Jensen Apr 14 '13 at 19:07
up vote 8 down vote accepted

If you double click an output cell's cell bracket, the input cell grouped together with it will be hidden. This functionality may not be obvious, so it'l good to point out it exists.

enter image description here

This is the folded cell:

enter image description here

share|improve this answer
@Szaboics The problem is, that when you do that, you hide all Input. I only want some parts of input to be hidden. Does it make sense? – Jens Jensen Apr 14 '13 at 18:17
@Jens Did you put your inputs in separate cells? This method does not hide all input. It only hides a single cell. – Szabolcs Apr 14 '13 at 19:08
@Szaboics I tried to do so. When I do so, the document becomes very messy because I must use % all the time. It was therefore i needed a formula for the problem - if it is possible to make of course. – Jens Jensen Apr 14 '13 at 19:12
@JensJensen I'm afraid any solution that you're going to get that can hide things within single cells is going to be more messy and detrimental to your program's reliability than splitting it into several cells. Splitting a program is usually good practice and improves readability. Don't use %. Use variables instead. – Szabolcs Apr 14 '13 at 19:35
@JensJensen If you really really want to hide things within cells, it's possible using Interpretation. Look it up in the docs. – Szabolcs Apr 14 '13 at 19:36

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.