3
$\begingroup$

Question:

Differential root reduce uses the font color of the stylesheet and a default white background. How to change the color of the background ?


Why :

I am using a dark style sheet where text is written in white on a black background. However, the white font and white background of the output makes it illegible like in the image below:

enter image description here

$\endgroup$

1 Answer 1

6
$\begingroup$

Both DifferentialRoot and DifferenceRoot use the same template for their box structure, which is named "HolonomicDisplay".

HolonomicDisplay

Therefore, the styling is set by the stylesheet, which you can access with CurrentValue[{StyleDefinitions, "HolonomicDisplay"}], and also change in the usual manner of changing stylesheet. You can also set it programatically:

displayFunction = (TemplateBoxOptionsDisplayFunction /. CurrentValue[{StyleDefinitions, "HolonomicDisplay"}]) /. (Background -> _) -> (Background -> Yellow); SetOptions[SelectedNotebook[], StyleDefinitions -> Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], Cell[StyleData["HolonomicDisplay"], TemplateBoxOptions -> {InterpretationFunction -> (#2 &), DisplayFunction -> displayFunction}]}]]; 

enter image description here

Version 13.1+

It seems that TemplateBoxOptionsDisplayFunction was changed to TemplateBoxOptions in 13.1. Therefore, you should instead use:

displayFunction = (TemplateBoxOptions /. CurrentValue[{StyleDefinitions, "HolonomicDisplay"}]) /. (Background -> _) -> (Background -> Yellow); 
$\endgroup$
12
  • $\begingroup$ I wish I could press the up vote button again to give more than +1. That is an amazing answer. Lesson learned: use ToBoxes when you want to fiddle with Mathematica designs. $\endgroup$ Commented Dec 20, 2022 at 0:34
  • $\begingroup$ You even defined the difference root with the same y[2+n] !. $\endgroup$ Commented Dec 20, 2022 at 0:35
  • 1
    $\begingroup$ Oh, actually I just copied the first occurence of DifferenceRoot from the documentation! Didn't even notice it was the same as yours :-) $\endgroup$ Commented Dec 20, 2022 at 0:36
  • $\begingroup$ Thanks I am bad with stylesheet designing so that code is very useful to me. $\endgroup$ Commented Dec 20, 2022 at 0:37
  • $\begingroup$ I forgot to accept sorry. $\endgroup$ Commented Dec 24, 2022 at 3:21

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.