I need to set StyleDefinitions
for a notebook in such manner so I can provide references to multiple stylesheets:
SetOptions[
EvaluationNotebook[],
StyleDefinitions->Notebook[{
Cell[StyleData[StyleDefinitions->"Stylesheet1.nb"]],
Cell[StyleData[StyleDefinitions->"Stylesheet2.nb"]]
}]
]
This code won't work. Only the first one will be taken into account.
Requirements:
I can't use explicit
StyleDefinitions
. So importing + merging those styles won't help me because there are going to be many notebooks depending on them and I don't want to update all of them when I change any stylesheet.I can't use common setup that stylesheets are joined step by step. E.g.
EvaluationNotebook[]
style points to"Stylesheet1"
which contains reference to"Stylesheet2"
etc.It won't work because I want sometimes to replace
"Stylesheet2"
with"Stylesheet2b"
etc. Would have to have"Stylesheet1"
and"Stylesheet1a"
to keep the whole chain. At the end I'd have to have multiple "top level" stylesheets for all those possible combinations.
Toys:
{style1, style2} = Notebook[{Cell[StyleData["Input"], #]}] & /@ {
CellFrame -> True,
CellFrameColor -> RGBColor[1, 0, 0]};
{path1, path2, path3} = FileNameJoin[{$TemporaryDirectory, #}] & /@
{"Style1.nb", "Style2.nb", "Style3.nb"};
MapThread[ Export, { {path1, path2}, {style1, style2} } ]
Additional stylesheet created as described in 2.:
Export[
path3,
Insert[
style1,
Cell[StyleData[StyleDefinitions -> path2]],
{1, 1}]
]
And I would like
CreateDocument[{Cell[BoxData[RowBox[{"1", "+", "1"}]], "Input"]},
StyleDefinitions -> Notebook[{
Cell[StyleData[StyleDefinitions->path1]],
Cell[StyleData[StyleDefinitions->path2]]
}]
]
gets red frame too, just like:
CreateDocument[{Cell[BoxData[RowBox[{"1", "+", "1"}]], "Input"]},
StyleDefinitions -> path3
]
StyleDefinitions
? $\endgroup$StyleData[name, StyleDefinitions->None]
. So, let's assume you have multiple stylesheets which inherit from Core.nb. Each one of them defines a new "Input" style. Some re-root "Input" and others don't. What to do? Also, the multiple inheritance problem introduces serious performance issues...(continued) $\endgroup$FontColor
differently, it is no longer acceptable for me to just take the first one. I must figure out where the information came from for each style. If both stylesheets inherit from Default.nb, but only the second stylesheet overrides Default.nb's version of FontColor, then I must choose the second. If only the first overrides, then I must choose the first. This necessity to not just track option settings, but the precise provenance of each and every option setting is expensive...(continued) $\endgroup$StyleData[StyleDefinition->...]
cells to mix in new styles. So if, in your example,"StyleSheet2.nb"
has styles which don't exist in"StyleSheet1.nb"
, then they will be amalgamated together in your new stylesheet. So it does do something, just not what you were hoping for. Sorry for the multiple commenting, but I don't feel like I'm actually answering your question. Unless you'd accept "no" as an answer. :) $\endgroup$