3
$\begingroup$

Occasionally I make cells not evaluatable. Is there any way to have some sort of visible indication (automatic) that reminds me if a cell is not evaluatable.

One example of why I do this is that we have multiple environments: Production, UAT, and Development. I use different cells for each one, and only set the one I need to be evaluatable. Another example would be having test data that I need, for some of the time, but not for other times. I have, on occasion, run something with the wrong cell set up as evaluatable. I thought it might be helpful if there was a visual indicator, without having to lookup the cell properties, to remind me which cell is evaluatable.

$\endgroup$
  • 1
    $\begingroup$ I suppose you mean some visible indication more obvious than the little horizontal bar added to the cell bracket (just below the top triangle) when you remove the Editable property ? $\endgroup$ – High Performance Mark Aug 12 at 18:48
5
$\begingroup$

Here's another stylesheet way:

Cell[
 StyleData["Input"],
 CellBracketOptions ->
  {
   "Color" ->
    FEPrivate`If[
     FEPrivate`SameQ[
      FrontEnd`CurrentValue[FrontEnd`EvaluationCell[], Evaluatable],
      True
      ],
     GrayLevel[.7],
     GrayLevel[.9]
     ]
   }
 ]

This makes the cell bracket very light if it can't be evaluated:

enter image description here

You could also make it darker or thicker or whatever you want. Check

Options[EvaluationCell[], CellBracketOptions]

to see what you can play with

$\endgroup$
4
$\begingroup$

You can make the cell appearance depend dynamically on it option values. For example, edit the stylesheet and add the options to the "Input" style:

Cell[StyleData["Input"], 
 CellDingbat -> 
  Dynamic[If[CurrentValue[EvaluationCell[], Evaluatable], None, 
    StyleBox["Ø", FontColor -> GrayLevel[0.7]]]]]

Mathematica graphics

[You can see a little horizontal tick on the non-executable cell bracket, but I can't usually see those things anymore in the notebook, at least not reliably. Thanks @ HighPerformanceMark.]

$\endgroup$
  • $\begingroup$ I'm having trouble getting this to work. First, the only way I know how to edit a style sheet, using the menu, I change options in the options inspector. So, I entered your code into a cell and executed it. Then when making a cell not evaluatable I did get that little line in the bracket. But changing the GrayLevel didn't make a difference. I also did not see the "Ø". I'm probably not applying your advice properly. $\endgroup$ – Mitchell Kaplan Aug 13 at 18:34
  • $\begingroup$ @MitchellKaplan You can do it with the OptionInspector. It should look like this: i.stack.imgur.com/ISG10.png -- Or you can select the "Input" style in the stylesheet, execute the menu command Cell > Show Expression, and edit the text so that it looks like this: i.stack.imgur.com/ZG4av.png $\endgroup$ – Michael E2 Aug 13 at 19:08
  • $\begingroup$ You can also go to Edit Stylesheet in the Format menu and copy that Cell expression in. $\endgroup$ – b3m2a1 Aug 13 at 19:36

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.