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.
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[]}]
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:
You can then save this style notebook and reuse it if you wish.
KeyEventTranslations.tr
? Nearly all the hacks I've seen recommend editing the system file, whereas it is easily overwritten in an upgrade. –
Monotype KeyEventTranslations.tr
is in $UserBaseDirectory\SystemFiles\FrontEnd\TextResources\Windows ; it is however a complete copy of the system file, rather than one containing only the customizations. If you find a way to do the latter, please let me know –
Lemma $UserBaseDirectory\...
file that includes only your changes –
Monotype $UserBaseDirectory\...
for mma8, but I only remembered that it was overwritten, and had forgotten the fact that I changed it in the main dir back then. Thanks, that resolves my question :) –
Monotype 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.
© 2022 - 2024 — McMap. All rights reserved.