Message Boards Message Boards

0
|
3465 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Question about combining styles and stylesheets

I have a custom stylesheet I call MyStyle and I am looking at some of the built-in stylesheets such as ReverseColor. So with a fresh notebook inheriting the ReverseColor stylesheet, I want to add in my MyStyle stylesheet so that it would be inherited too. So I copied and pasted Cell[StyleData[StyleDefinitions -> "MyStyle.nb"]] into the private stylesheet of this notebook. However, the changes did not apply. But if I copy and paste all of the individual styles from MyStyle into this private stylesheet, the changes take place. So that made me think that you can not inherit base definitions from more than one stylesheet. However, I have a notebook called "Sample Lab Exercise" (downloaded it from a Wolfram rep a few years ago) and noticed its private stylesheet is inheriting from "Default.nb" and "StyleMenuClear.nb" and has other individual styles below. Moreover, the edits from the second inherited stylesheet (StyleMenuClear) are taking effect.

So is there something special about the way StyleMenuClear.nb is put together (it seems to just add MenuSortingValue->None to several styles) or is there something I have to do in order to inherit base definitions from more than one stylesheet?

I also experimented and I see that if I start a default notebook and in the private stylesheet add Cell[StyleData["Text"],FontFamily->"Times"] and then in a second cell some other modification of the style Text, only the first one applies. So that made think that if you want to edit a style, you need to see if it has already been edited earlier and then add that edit to that cell (I am not sure if it matters whether an earlier occurrence of that style is explicitly listed or if it is being inherited from another stylesheet). Is that correct? If so, then I don't understand how Mathematica treats edits to styles such as Text (or any other already defined style) since they are already have definitions or edits in Default.nb and Core.nb or other stylesheet the notebook is inheriting base definitions from.

I found an old discussion at Style sheet primer. If this is mostly up to date, this answers part of my question. Further experimenting in stylesheets seems to suggest some different behavior in MenuSortingValue and MenuCommandKey than other options to StyleData. The documentation center for MenuSortingValue says that when it is applied to a StyleData cell it is not inherited by styles which inherit from that style, unlike most other StyleData options. I don't understand that statement, but perhaps that is the key to what inspired this question. What I have found is that if you have say have multiple definitions of say a Text cell in the stylesheet, then the first one is only applied; unless that first one is MenuSortingValue or MenuCommandKey. If those are last, they are still applied and the first definition is not. Perhaps this is an example of what the documentation center explains, although I am only guessing here.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract