- Let's create a stylesheet:
NotebookPut@
Notebook[{
Cell[StyleData[StyleDefinitions -> "Default.nb"]],
Cell[StyleData["myStyle"]],
Cell[StyleData["myStyle2", StyleDefinitions -> StyleData["myStyle"]]]
}]
- Now let's add a
FontSize -> 30spec for our first style andFontSize ->Inheritedfor the last one.
- This
FontSize->Inheritedis not necessary, theFontSizeofmyStyle2will be 30 anyway, since there isStyleDefinitions -> StyleData["myStyle"]( Ref)
- But let's replace
Inheritedwith(Inherited + 0):
It immediately changed the size! That means, it inherits from somewhere else now...
Q1: Can this be explained with documentation?
Of course 0 makes no sense but my goal is to have e.g. Inherited + 5 so when I change myStyle I won't have to change anything in dependent styles.
Q2: So I would gladly upvote any answer that will tell me how to achieve this behaviour within one stylesheet.
I tried FontSize :> (CurrentValue[{StyleDefinitions, "myStyle", FontSize}] + 1) but to no avail.
key words: cascading styles style inheritance
loose thoughs:
I'm afraid it may be tough since e.g. SubitemParagraph isn't inheriting CellMargins to align with SubItem but has it hardcoded to be the same. :-(
One possible solution would be to be able to create FrontEnd`CurrentValue["myStyleFontSize"] = 15 so that I can set myStyle and myStyle2 FontSizes with reference to it like FontSize :> CurrentValue["myStyleFontSize"]. There are similar solutions in e.g. Core.nb with "MenuFontSize" but it's not the solution "within one stylesheet".






