5
$\begingroup$

Intro

Styles can inherit from other styles: base one style on another?

And for example WolframAlphaLong is inheriting from Input style.

However, if you modify Input in your private stylesheet, this change won't be reflected in WolframAlphaLong.

Question

What is a generic or fast way to make them respecting those changes?

Example

CellPrint[Cell["integrate x", "WolframAlphaLong"]]


SetOptions[
   EvaluationNotebook[],
   StyleDefinitions -> Notebook[{
     Cell[StyleData[StyleDefinitions -> "Default.nb"]],
     Cell[StyleData["Input"], FontSize -> 25]
   }]
]

enter image description here

As you can see, "integrate x" has old font size setting.

$\endgroup$

1 Answer 1

3
$\begingroup$

In this particular case it seems to be inheriting its font characteristics from TextForm because of FormatType->TextForm in its style definition.

CellPrint[Cell["integrate x", "WolframAlphaLong"]]

SetOptions[EvaluationNotebook[], StyleDefinitions -> Notebook[{
    Cell[StyleData[StyleDefinitions -> "Default.nb"]],
    Cell[StyleData["Input"], Black, 12],
    Cell[StyleData["TextForm"], Red, 18]
    }]]

enter image description here

$\endgroup$
2
  • $\begingroup$ If you copy WALong definition from Default.nb and put at the bottom of your private stylesheet, then WALong will inherit Input changes. It wwould be nice to have that done automatically. FormatType is what contributes to the given style too but TextForm doesn't have any FontSize specs in Default.nb. The problem is, I want to change Input and I can't use that method because not every style that Inherits from Input have a TextForm FormatType, likewise those styles that don't (have Input parent) may have TextForm and I don't want them to be updated. $\endgroup$
    – Kuba
    Feb 25, 2016 at 5:26
  • $\begingroup$ It is something important here though, your answer shows that while StyleDefinitions -> StyleData["Input"]-like parents are resolved for each stylesheet for current "styles stack" while FormatType inheritance is resolved at the end, at a notebook level probably. Whatever that means :) $\endgroup$
    – Kuba
    Feb 25, 2016 at 5:29

Your Answer

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

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