By giving a cell the simple option CellOpen -> False, it can be hidden from view.

But for inline cells (cell within a cell) this does not work.

An option Visible -> False only seems to exist for notebooks, not for cells.

What to do?

  • $\begingroup$ One way would be to add a CellSize option to the inline cell and toggle between {0,0} and Inherited but this would be quite messy to implement I think. $\endgroup$ – Mike Honeychurch Oct 18 '12 at 22:05
  • $\begingroup$ May be you can add an White color or Balck color or other color for all your inline cells and set the content unseen. $\endgroup$ – HyperGroups May 8 '13 at 6:31

One way is to go with stylesheets, you can set DefaultNewInlineCellStyle option for StyleData["Notebook"] and for this given style, a specific CellSize, then you can proceed with toggling it. But it is messy and probably an overreaction.

I'd go with this simple procedure, you can put it as a MenuItem, a new shortcut or whatever you find convenient. For simplicity let's create a quick palette:

So, first of all, from documentation of Cells[obj]:

obj may be a NotebookObject or a CellObject. If obj is a CellObject, then Cells returns the inline cells in the specified cell.

     "Toggle inline cells visibility",
       inlineCells = Cells /@ Cells @ InputNotebook[] // Flatten;
          CurrentValue[#, CellSize] === {1, 1},
          SetOptions[#, CellSize -> Automatic],
          SetOptions[#, CellSize -> {1, 1}]
       ] & /@ inlineCells

Size {0,0} is not supported so we are using {1, 1} which is small enough :)


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.