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?

  • 1
    $\begingroup$ Can't you simply fold/close/collapse the input cells that you want to hide? $\endgroup$ – rm -rf Apr 14 '13 at 17:55
  • $\begingroup$ 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? $\endgroup$ – Szabolcs Apr 14 '13 at 18:07
  • $\begingroup$ Have a look here: mathematica.stackexchange.com/q/2977/131 $\endgroup$ – Yves Klett Apr 14 '13 at 18:12
  • $\begingroup$ Related: mathematica.stackexchange.com/q/14466/5 $\endgroup$ – rm -rf Apr 14 '13 at 18:57
  • $\begingroup$ @rm-rf It is that function I need, but it must be as a formula. When I Evaluate Notebook they all gets shown again. $\endgroup$ – Jens Jensen Apr 14 '13 at 19:07

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

| improve this answer | |
  • $\begingroup$ @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? $\endgroup$ – Jens Jensen Apr 14 '13 at 18:17
  • 1
    $\begingroup$ @Jens Did you put your inputs in separate cells? This method does not hide all input. It only hides a single cell. $\endgroup$ – Szabolcs Apr 14 '13 at 19:08
  • $\begingroup$ @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. $\endgroup$ – Jens Jensen Apr 14 '13 at 19:12
  • 1
    $\begingroup$ @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. $\endgroup$ – Szabolcs Apr 14 '13 at 19:35
  • 2
    $\begingroup$ @JensJensen If you really really want to hide things within cells, it's possible using Interpretation. Look it up in the docs. $\endgroup$ – Szabolcs Apr 14 '13 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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