Function Repository Resource:

StyleInheritanceSummary

Source Notebook

View the style inheritance of a named style

Contributed by: Kevin Daily

ResourceFunction["StyleInheritanceSummary"][style]

displays an interface for the style style in the current ScreenStyleEnvironment for the current notebook.

ResourceFunction["StyleInheritanceSummary"][style, env]

displays an interface in the ScreenStyleEnvironment env.

ResourceFunction["StyleInheritanceSummary"][style, env, nb]

displays an interface starting from the NotebookObject nb.

Details and Options

If a NotebookObject is not provided then the information is determined starting from the EvaluationNotebook[].
The third argument can be a Notebook expression, NotebookObject, File, file path (String), or a FrontEnd`FileName expression.
If the third argument is a Notebook expression, then it is disconnected from the file system. In this case, any referenced stylesheets must be on the StyleSheetPath else the function will return a Failure expression.
If the third argument is a String and FileExistsQ is False, then ResourceFunction["StyleInheritanceSummary"] searches StyleSheetPath using the input.
ResourceFunction["StyleInheritanceSummary"] takes the following options:
"Strict"Falseif True, only include the specific StyleData input and don't include other scopes in the inheritance
When resolving StyleData["Style", "Env"] there are additional StyleData that contribute to the full set of resolved options. Such contributions include StyleData["Style"], StyleData["Notebook"], and StyleData[All, "Env"]. If "Strict" True then only the specified StyleData is returned and any additional contributions are ignored.
The created interface does not include options coming from the following:
Wider scopese.g. $DefaultFrontEnd,$FrontEnd,$FrontEndSession
Narrower scopese.g. StandardForm,TraditionalForm,InputForm
Evaluation environmente.g. "DockedCell","InlineCell"
Private stylesheets are automatically included at the start of the inheritance chain.
A child stylesheet can inherit from a parent stylesheet if the child contains cell expressions of the form Cell[StyleData[StyleDefinitions parent]] where parent can be any stylesheet such as "Default.nb" or "Core.nb". When searching for parent, the FrontEnd first searches the NotebookDirectory[] of the child stylesheet before searching StyleSheetPath.
ResourceFunction["StyleInheritanceSummary"] provides similar information as CurrentValue[{StyleDefinitions,style}], CurrentValue[{StyleDefinitions,{style,env}}], and CurrentValue[nb,{StyleDefinitions,{style,env}}], respectively.
ResourceFunction["StyleInheritanceSummary"] includes additional details explaining how the results are gathered along with the stylesheet inheritance order.
ResourceFunction["StyleInheritanceSummary"] always opens a new window:
The title bar indicates the StyleData being investigated and the starting NotebookObject.
The provided information is organized into three separate interfaces:
"Stylesheet Inheritance Graph" shows the connectivity between the stylesheets in the inheritance:
The DirectedGraph uses the stylesheet names as vertices. The DirectedEdge points from the child stylesheet to the parent stylesheet that the child stylesheet inherits from.
A stylesheet can inherit from multiple parents. In that case the Graph displays multiple edges with the top-most parent displayed to the left.
Only the stylesheet names are displayed. A Tooltip provides the full path to the stylesheet file.
If the starting stylesheet is a private stylesheet then it is labeled as "Private".
If the starting stylesheet's name cannot be determind then it labeled generically as "Stylesheet".
"Determined Options Summary" shows similar information as returned by CurrentValue[{StyleDefinitions,style}]:
Options coming from All and "Notebook" are suppressed by default which follows the behavior of CurrentValue[{StyleDefinitions,style}].
The options are organized in alphabetical order by option name.
The button "Copy table data to clipboard" extracts the resolved options as they are currently displayed.
"Options Inheritance" is the default interface.
The top of the "Options Inheritance" interface provides controls to modify the information displayed in the summary table:
The styles All and "Notebook" are hidden by default to follow the behavior of CurrentValue[{StyleDefinitions,style}].
The steps of the inheritance algorithm are hidden by default to reduce the size of the table.
If showing the inheritance steps then the table is read from the bottom to the top:
There may be multiple StyleData in the inheritance algorithm. The active StyleData is highlighted in GrayLevel[0.8] while the individual steps above it are highlighted in GrayLevel[0.94].
Specific options can be suppressed to reduce the size of the summary table:
A specific scope can be suppressed.
To see a single option, first press the "All" button to hide all options, then press the specific option to display.
The "Clear" button returns the summary table to displaying all options.
The summary table area displays the gathered results:
The button "Copy table data to clipboard" extracts the summary table's data as it is currently displayed.
Any suppressed options and scopes are not copied to the clipboard.
The inheritance algorithm steps are never included in the copied data.
The summary table is organized into two columns, "Stylesheet and StyleData" on the left and "Options" on the right.
If including the inheritance algorithm steps then they span the table as a single column.
The options are in alphabetical order by option name.
Dynamic option values and colors display in InputForm.
A legend describes why some options are highlighted in the summary table:
PinkThe exact option value is duplicated.
OrangeThe option is the same except RuleDelayed is replaced by Rule.
YellowThe option value uses Association inheritance and cannot be fully resolved.
Darker[Yellow]The option value uses Association inheritance and is overridden by a List.
Lighter[Blue,0.7]The option value is overridden.

Examples

Basic Examples (3) 

Examine the inheritance of the style "Title" within this Function Repository Item notebook:

In[1]:=
ResourceFunction["StyleInheritanceSummary"]["Title"]
Out[1]=

Examine the inheritance of the style "Title" within this Function Repository Item notebook in the "SlideShow" environment:

In[2]:=
ResourceFunction["StyleInheritanceSummary"]["Title", "SlideShow"]
Out[2]=

Examine the inheritance of the style "Title" within a notebook in the "Printout" environment:

In[3]:=
nb = NotebookPut[
   Notebook[{Cell["TitleCell", "Title"]}, Initialization :> (CurrentValue[EvaluationNotebook[], ScreenStyleEnvironment] = "Printout")]];
ResourceFunction["StyleInheritanceSummary"]["Title", "Printout", nb]
Out[4]=

Options (2) 

Strict (2) 

"Strict"False returns data because it also searches for StyleData["Title"] with no environment:

There is no data when using "Strict"True because only StyleData["Title","Working"] is searched for and it doesn't exist in the stylesheet:

Publisher

Kevin Daily

Version History

  • 2.0.0 – 01 March 2023
  • 1.0.0 – 16 September 2022

Related Resources

License Information