Message Boards Message Boards

GROUPS:

Hide input boxes / display only output boxes?

Posted 2 months ago
387 Views
|
4 Replies
|
0 Total Likes
|

Hello,

I am a newbie on Wolfram Desktop and I am having trouble finding any documentation on the following: I'd like to be able to export a notebook to PDF or HTML but hide the Wolfram Language code displayed on Input Boxes and only display their results on the OutputBoxes.

That's because my audience are of non-programmers and they would be confused by the source code.

Any help is appreciated, Quenio

4 Replies

You can hide the input cell by double-clicking on its cell bracket. I wish I knew an automatic way of doing it in the whole document. Right now I must intervene manually on each input-output group. I also wish there was an automatic way of getting rid of those dummy Out[.] cell labels that started showing up in version 11.3, and for which I can see no possible use.

Sorry, you have to double-click on the cell bracket of the output cell.

Gianluca,

I wish I knew an automatic way of doing it in the whole document.

You can program a button to do this.

Button["HideInputs", NotebookFind[SelectedNotebook[], "Output", All, CellStyle]; 
FrontEndExecute[FrontEndToken["OpenCloseGroup"]]]

do a select all (cmd-a) followed by a open (Cmd-') to undo this. You can replace the frontend execute by doing a Cell->Grouping>Open/Close Group from the menu (Cmd-' on the mac). First you click the button to select all the output cells and then type the shortcut to close them.

I also wish there was an automatic way of getting rid of those dummy Out[.] cell labels that started showing up in version 11.3, and for which I can see no possible use.

go to Format->Options Inspector and change "ShowCellLabel" for the notebook to False to hide the labels, True will show the labels but not show the expired labels and you can leave it on Automatic but edit "CellLabelTemplate" to get rid of the "expired" cells that bug you by altering the format.

I hope this helps.

Regards,

Neil

Thanks, Gianluca and Neil, for your suggestions.

What ended up working for me was the following code:

export[notebookFile_, outputFile_] := With[
  {notebook = NotebookPut[Get[notebookFile], Visible -> False]},
  SetOptions[notebook, ShowCellBracket -> False, ShowCellLabel -> False];
  SetOptions[#, CellOpen -> False] & /@ Cells[notebook, CellStyle -> "Input"];
  Export[outputFile, NotebookGet[notebook]]
  ]

It hides the input cells and removes the label from the output cells, and then exports the file to PDF or HTML, based on the file extension.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract