Message Boards Message Boards

12 Replies
7 Total Likes
View groups...
Share this post:

Comment out whole sections / make them un-executable?

Posted 10 years ago
Hi there,

ocasionally I would like to comment out whole sections, containing several execution groups, from a notebook. Or even better would be to make them un-executable while maintaining their layout.

The usual commenting with (* ... *) cannot do that, since it is limited to comments within one execution group only. On the internet I read that one solution would be to change the section input to Text. But this messes up the fonts, and makes everything hard to read, and is especially cumbersome when one wants to revert is back to usual input to make changes.

Is there a smart way to do what I'd like to do?

I am on Mathematica 9.

12 Replies
POSTED BY: Lou D'Andria

Although I didn't manage to install it, that certainly does the business, thanks! :-)

POSTED BY: Ben Murdin
Posted 2 years ago

What do you mean by "no joy"?

See definition of "no joy"

POSTED BY: Regan Lowrey

For my favorite non-definitions, I will recommend (see the final lines, though best to wait until the end):

POSTED BY: Daniel Lichtblau
Leave the focus on the cell or cell group you want to deactivate. Look at the Function Menu bar for Cell > Cell Properties and find the check mark next to the property, Evaluatable. Remove that check mark and the selected cells will no longer have the commands sent to the kernel for evaluation. The process is reversable.
Posted 4 years ago

... or cell group...

This isn't working in 12. It does work for individual Input cells, but not if the selection includes any cells of any other Style, e.g. Chapter, Section, even Output.

Got another idea?

POSTED BY: Regan Lowrey

Use structured selection to target all the Cells that need to have Evaluatable deactivated. To make a collection of individually targeted Cells hold down the Ctrl key while clicking. To select all Cells of the same type, hold down Alt then click on an exemplar Cell Type and all of the other Cells of the same Type will be included.

Then follow the Menu commands: Cell > Cell Properties, v Evaluatable. It will work the same way to reverse or activate them again.

This doesn't work for me - I'm using 13 on a Mac. Holding down control while trying to select things doesn't seem to allow me to select multiple cells, and anyway brings up a menu that doesn't include the Cell Properties or Evaluatable. I tried other keys like option and command but no joy.

POSTED BY: Ben Murdin
Posted 2 years ago

On a Mac, Command works for me. What do you mean by "no joy"? Do you still get a popup menu?

POSTED BY: Rohit Namjoshi

Sorry for the incomprehensible anglicism: "no joy" just means I don't get what I want. When I use the suggested keystroke, holding down the "control" key when I select a single cell, I do see a pop-up menu with Properties, but if I have multiple cells selected (which was the point of the OP) it doesn't have the options to do with Cell Properties or Evaluatable. If I have only a single cell selected and use "control" then the pop-up menu has a Properties option, but if I click on another cell (while holding down "control") that option disappears. I was trying to say that I tried holding down other keys instead, in case a Mac is different, like the "option" key and the "command" key but then I don't get any pop-up menu at all.

You said "command" works for you, so I played with some different combinations of "command" and "control" etc but I haven't been able to select multiple cells and still see the Properties and/or Evaluatable option.

POSTED BY: Ben Murdin
Posted 2 years ago

On a Mac: Command click on a cell bracket, that cell's bracket is highlighted. Command click on another cell bracket, now both cell brackets are highlighted. Option click on either highlighted cell bracket and the popup menu with options should appear. When multiple cells are selected the options in the popup menu may be different. e.g. when multiple cells are selected there is no "Save Selection As..." since it is not possible to save multiple cells to a file from the UI.

POSTED BY: Rohit Namjoshi

Thanks for that more detailed explanation Rohit, but it still doesn't work for me. I am trying to achieve the result discussed in the OP, i.e. to render a whole group of cells un-Evaluatable. I can select multiple cells with Command click just the way you suggest, but when I Option click I get no pop-up menu at all unfortunately. If instead I Control click I do get a pop-up menu, but as I was saying, it is does not include the Evaluatable or Properties options when there are multiple cells selected. which was mentioned in the response from Wolfram about the OP.

POSTED BY: Ben Murdin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract