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


1 Answer 1


Both DifferentialRoot and DifferenceRoot use the same template for their box structure, which is named "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 /. 
       "HolonomicDisplay"}]) /. (Background -> _) -> (Background -> Yellow);

  StyleDefinitions -> 
   Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], 
      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 /. 
       "HolonomicDisplay"}]) /. (Background -> _) -> (Background -> Yellow);
  • $\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$ Dec 20, 2022 at 0:34
  • $\begingroup$ You even defined the difference root with the same y[2+n] !. $\endgroup$ 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$
    – Domen
    Dec 20, 2022 at 0:36
  • $\begingroup$ Thanks I am bad with stylesheet designing so that code is very useful to me. $\endgroup$ Dec 20, 2022 at 0:37
  • $\begingroup$ I forgot to accept sorry. $\endgroup$ Dec 24, 2022 at 3:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.