3
$\begingroup$

Let us say that I want to make all the cells within a section not evaluable. In principle, I would simply highlight the relevant section, then go to Cell -> Cell properties and untick the Evaluable. However, the problem is that if for some reason, I wish to make the section evaluable again, I would go back and tick the Evaluable box again. This, however, causes the section title and all the Texts within the section to also be evaluated, which of course is not what I want. When I toggle back the Evaluable, I would like it to do so only for the Input Cells of course. Is there to achieve this?

$\endgroup$
  • 1
    $\begingroup$ Is it satisfactory to enclose everything which you're not interested in evaluating in in a comment? Simply highlight everything you don't need to run and then either Edit -> Un/Comment section or just put comments over something you don't want? $\endgroup$ – Brad Mar 12 '19 at 20:59
1
$\begingroup$

The key is to re-enable it with CurrentValue[_CellObject, Evaluatable] = Inherited. You can create a custom palette:

CreatePalette @ Column[
  Button[
     StringForm["Evaluatable -> ``", #],
     CurrentValue[SelectedCells@InputNotebook[], Evaluatable] = #
  ] & /@ {False, Inherited}
]

Or you can use notebook actions analogously to https://mathematica.stackexchange.com/a/184568/5478

|improve this answer|||||
$\endgroup$
  • 1
    $\begingroup$ CurrentValue can be used to set all cells at once, so: CurrentValue[SelectedCells @ InputNotebook[], Evaluatable] = False is simpler. $\endgroup$ – Carl Woll Mar 17 '19 at 23:05
  • $\begingroup$ @CarlWoll right, thanks, I forgot about that feature. $\endgroup$ – Kuba Mar 18 '19 at 9:59

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.