Mathematica Cheat Sheet

Hacks

Hide and show cell

  • Function for closing all cells inputs:
CloseAllInputsCells[] := Module[{nb, cells},
  nb = EvaluationNotebook[];
  cells = Cells[nb, CellStyle -> "Input"];
  SetOptions[#, CellOpen -> False] & /@ cells;
 ];
  • Function for recovering or made visible again:
 OpenAllInputsCells[] := Module[{nb, cells},
  nb = EvaluationNotebook[];
  cells = Cells[nb, CellStyle -> "Input"];
  SetOptions[#, CellOpen -> True] & /@ cells;
 ];
  • How to use it?
  1. Copy / Paste both functions above in a fresh / new notebook and run the notebook.
  2. Inside your target Notebook, at the end of your document, run CloseAllInputsCells[] . All input cells will be closed.
  3. For recovering all inputs again, run OpenAllInputsCells[]

Note: You can also do by double-clicking any output cell bracket.

Published on May 23, 2021

Last revised on May 23, 2021

References