# How do I hide some of Input

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];
FrontEndTokenExecute["SelectionCloseUnselectedCells"]])


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?

"In(1):
1+1
3+3
Out(2):
1+1
2+2
3+3"

-
Can't you simply fold/close/collapse the input cells that you want to hide? –  rm -rf 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: mathematica.stackexchange.com/q/2977/131 –  Yves Klett Apr 14 '13 at 18:12
–  rm -rf 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
show 2 more comments

## 1 Answer

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.

This is the folded cell:

-
@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
add comment