Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the equation background color in text style

In Mathematica when your writing to a Text styled cell, if you create an formatted equation, for example pressing "x ctrl_ a", the background color changes while the equation is selected. Does anyone know what this equation format area is called, and specifically how to change the background color when the equation is selected.

like image 208
dmikalova Avatar asked Oct 26 '11 01:10

dmikalova


People also ask

How do you change the equation style in Word?

To change a paragraph style, select an equation or part of it which you want to change, right-click in it and choose Paragraph... in the popup menu. Then change the settings like a usual paragraph in Word 2016.


2 Answers

In general, if you press Cmd-Shift-E when you're in the cell, it shows you the underlying low-level syntax that makes up the pretty formatting that you see. In my case, for x_a foo bar, where x_a is typeset as a subscript, it shows:

 Cell[TextData[{
 Cell[BoxData[
  FormBox[
   SubscriptBox["x", "a"], TraditionalForm]]],
 " foo bar "
}], "Text",
 CellChangeTimes->{{3.528581300759695*^9, 3.5285813422683*^9}, {
  3.528581510346758*^9, 3.5285815118015013`*^9}}]

Now, to access the information you want, open up the stylesheet Core.nb and look at Styles for Mathematica System-specific Elements > FormatType Styles > InlineCellEditing. Use the above key combination to see the underlying code, which shows:

Cell[StyleData["InlineCellEditing"],
 StyleMenuListing->None,
 Background->RGBColor[0.964706, 0.929412, 0.839216]]

This is the background color that is used. To confirm:

Graphics[{RGBColor[0.964706, 0.929412, 0.839216], Disk[]}]

enter image description here

Yep! To change, you simply need to create your own stylesheet with an altered definition and use that as the default for the notebook.


Example:

To create a custom style definition for just this notebook, go to Format > Edit Stylesheet and in the new window that says Private style definitions for <filename.nb>, hit enter to start a new cell, use the key combo above and replace the text in there with the above (with RGB values changed to what you want) and then press the same combo to exit the CellExpression mode. So for example:

Cell[StyleData["InlineCellEditing"],
 StyleMenuListing->None,
 Background->RGBColor[0.3, 0.9, 0.8]]

gives me a aqua-greenish background:

enter image description here

You can then save this style notebook and reuse it if you wish.

like image 54
abcd Avatar answered Oct 03 '22 03:10

abcd


Instead of using the menu Format > Edit Stylesheet, you can modify the notebook's style definitions directly. For example, just run the following code:

SetOptions[EvaluationNotebook[], 
 StyleDefinitions -> 
  Notebook[{
    Cell[StyleData[StyleDefinitions -> "Default.nb"]], 
    Cell[StyleData["InlineCellEditing"], 
         Background -> RGBColor[0.9, 0.6, 0.6]]}]]

Which sets the stylesheet to the default one with the single modification to the inline cells.

like image 45
Simon Avatar answered Oct 03 '22 02:10

Simon