When using the InlineMathCell one types Ctrl+9 within the text cell, and gets a slot for starting typing the InlineMathCell part. When typing the content of the InlineMathCell is slightly highlighted by a light pink color. As soon as the typing goes outside of the InlineMathCell, the highlighting disappears, and the InlineMathCell background looks white.

My question is: How can I change the highlighting color of an InlineMathCell to make it more visible?

Reaction to the statement that this question already has an asnwer: NO IT HAD NOT BEFORE THE PRESENT ANSWER OF SILVIA. See the discussion below.

  • $\begingroup$ @Silvia seems, He is not searching for background color, but hilighting color, that's also the op's previous question. $\endgroup$ Jun 17 '13 at 10:29
  • $\begingroup$ @HyperGroups IMO, with the method in the post I linked, there is no difference between adjusting the Background, the FontColor, the FontFamily or any other style things. $\endgroup$
    – Silvia
    Jun 17 '13 at 10:34
  • $\begingroup$ @Silvia Hilighting color is something temporary, and its style will disappear after ending the inline cell. Maybe should use CellEventActions in stylesheet. I've tried a little, but still not succesful for only inline cell. $\endgroup$ Jun 17 '13 at 10:40
  • 1
    $\begingroup$ @HyperGroups Ahh... I see your point. Sorry I misundertood OP's question. It can't be un-voted, but other folks would vote to leave it open. $\endgroup$
    – Silvia
    Jun 17 '13 at 10:43
  • $\begingroup$ @MichaelE2 I think it's not exactly the same problem. I think what OP wants is a temporary style which applies to a inline cell only when the cursor is in it. And when the cursor is out of it, its style should automatically fall back to "InlineCell". Please see the video in my answer for more precise what I mean. $\endgroup$
    – Silvia
    Jun 18 '13 at 19:25

Sorry I voted as duplicate because I misunderstood the question.

If you want to tune the style of inline cells, you can adjust the "InlineCell" style.

If you want to tune the style of inline cells that presents when editing the cell, there is a similar style called "InlineCellEditing".

An example used by myself:

 FontColor->RGBColor[0.5019607843137255, 0., 0.5019607843137255],
 Background->RGBColor[0.964706, 0.929412, 0.839216]]


According to OP's comment, I made a video to demonstrate how to setup the style (please choose 720p quality for detail view):

customize stylesheet

  • $\begingroup$ I think I would upvote if I knew how stylesheets worked :). $\endgroup$ Jun 17 '13 at 11:07
  • $\begingroup$ @JacobAkkerboom Stylesheets are great tools. Maybe you would be interested in stylesheet. :) $\endgroup$
    – Silvia
    Jun 17 '13 at 11:11
  • $\begingroup$ I'll keep that in mind, but I suppose I could invest more 5-10 minutes looking at the relevant doc pages also :). I guess I'm not one for style, Raw Inputform appeals to me :P. $\endgroup$ Jun 17 '13 at 11:18
  • 1
    $\begingroup$ @JacobAkkerboom Yes the official documentations are definitely the best place to start. $\endgroup$
    – Silvia
    Jun 17 '13 at 11:36
  • $\begingroup$ @Silvia Thank you. This looks like a very reasonable solution. However, I made a StyleSheet on the basis of the JournalArticle, in which I have inserted the cell from above, and though it should work, it does not. $\endgroup$ Jun 18 '13 at 7:58

I came up with this, not so good, hope for someone will develop this.

CellPrint@Cell["This is one InlineFourmula Style Cell", "InlineFormula", CellEventActions -> 
"MouseMoved" :> (SelectionMove[InputNotebook[], All, ButtonCell];
 SetOptions[NotebookSelection[InputNotebook[]], Background -> LightGreen, FontColor -> Red]),
"ReturnKeyDown" :> (SelectionMove[InputNotebook[], All, ButtonCell]; 
SetOptions[NotebookSelection[InputNotebook[]], Background -> Inherited, 
FontColor -> Green, FontSize -> 25])}

And this StyleData in one stylesheet only take effect for InlineFormula style cell but not InlineFormula style inline cell What a pity.

CellEventActions->{"MouseMoved" :> SetOptions[
  InputNotebook[]], Background -> Green], "ReturnKeyDown" :> SetOptions[
  InputNotebook[]], Background -> LightRed]},
Background->RGBColor[0, 1, 0]]

ReturnKey will change the background color temporarily

enter image description here


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.