For easy searching I copied the answer from Mr. Wizard
AutoCollapse[]
function
Please try this code, based on Sasha's adaption of my own answer to this question.
AutoCollapse[] := (
If[$FrontEnd =!= $Failed,
SelectionMove[EvaluationNotebook[], All, GeneratedCell];
FrontEndTokenExecute["SelectionCloseUnselectedCells"]])
Then in a new cell:
2 + 2
AutoCollapse[]
Always place AutoCollapse[]
as the last line of an Input cell.
Stylesheets
To get the behavior without having to include AutoCollapse[]
in each cell you can use Stylesheets and CellEpilog
. For example to create an InputHidden
style use menu Format > Edit Stylesheet... and then add a Cell with the following code (use Ctrl+Shift+E to edit Cell code):
Cell[StyleData["InputHidden", StyleDefinitions -> StyleData["Input"]],
CellEpilog :> (SelectionMove[EvaluationNotebook[], All, GeneratedCell];
FrontEndTokenExecute["SelectionCloseUnselectedCells"]),
MenuSortingValue -> 1510
, MenuCommandKey -> "8"
]

This creates a new style that behaves like Input but which auto-collapses when evaluated. MenuCommandKey -> "8"
lets it be quickly applied using Alt+8; change or remove this line as desired.
I may be reading more into your question than is there. As Heike points you can close the input cells manually by deselecting menu Cell > Cell Properties > Open
but I assumed you knew this already and provided the soluition(?) above. If all you need is a hidden cell that generates output, use the menu. If you need something a little more flexible that automatically hides after you make your changes I hope you will find the methods above useful.
AutoCollapse
from this answer. After having appended it to each cell with MaTeX in them, the cells hid themselves after evaluation, which was really nice because then I could see immediately what the final presentation was going to look like. Others will have to answer how to hide cells only on export... $\endgroup$AutoCollapse
in a Notebook (taking advantage of the memory) and I run in my main file. A little beginner but I'm enjoying it... $\endgroup$AutoCollapse[]
function. $\endgroup$