Message Boards Message Boards

2
|
42167 Views
|
12 Replies
|
7 Total Likes
View groups...
Share
Share this post:

Comment out whole sections / make them un-executable?

Posted 11 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.

Cheers!
POSTED BY: Gernot H
12 Replies

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

POSTED BY: Ben Murdin

Yeah.... When you have a mixture of evaluating and non-evaluating cells selected, the behavior of the Cell > CellProperties > Evaluatable menu isn't obvious. I think the two states the OP wants to toggle between are:

  • set Evaluatable to False for the currently selected cells, or
  • reset the Evaluatable setting back to the default for those cells.

That's trivial to do with the option inspector, but it's just as easy to generate a palette to do this:

CreatePalette[Column[{
  Button["Turn off Evaluatable for Selected Cells",
    CurrentValue[SelectedCells[InputNotebook[]], Evaluatable] = False],
  Button["Reset Evaluatable for Selected Cells",
    CurrentValue[SelectedCells[InputNotebook[]], Evaluatable] = Inherited]}]]

This palette can even be installed with the Install Palette item at the bottom of the Palettes menu. Then it'll always be there in menus when needed.

POSTED BY: Lou D'Andria

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

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

https://etc.usf.edu/lit2go/154/casey-at-the-bat/2726/casey-at-the-bat/

https://www.ssec.wisc.edu/~scottl/poem3.html

POSTED BY: Daniel Lichtblau
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

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

What do you mean by "no joy"?

See definition of "no joy"

POSTED BY: Regan Lowrey
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

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

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.

Posted 5 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
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.
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