34
$\begingroup$

This question came to mind because of this answer to a recent question.

Under Style, the Mathematica Documentation Center says the following about named styles.

A few common named styles include: "Button", "Graphics", ..., "Title"

Altogether it lists 13 named styles, but the phrase "a few of" implies there are more. Other cell styles such as "SubTitle" and "SubSubSection" come to mind. But strings other than those naming cell styles evidently qualify as named styles. In the referenced answer, Mr.Wizard uses "TI" as a named style for the "Times Italic" font.

Style["The quick brown fox ...", "TI"]

TI.png

By trial and error, I have found these addition named styles:

"TR"   (Times Roman -- plain Times)
"TB"   (Times Bold)
"TBI"  (Times Bold Italic)
"SR"   (Sans serif Roman -- plain sans serif)
"SB"   (Sans serif Bold)
"SO"   (Sans serif Oblique)
"SBO"  (Sans serif Bold Oblique)

I wonder what other named styles exist, other than cell styles, that Mathematica will accept in a Style expression. I further wonder what sort of spelunking in Mathematica would turn them up.

$\endgroup$
5
  • $\begingroup$ Related: forums.wolfram.com/mathgroup/archive/2008/Jun/msg00353.html $\endgroup$
    – Michael E2
    Commented Jul 31, 2013 at 2:22
  • $\begingroup$ As per @MichaelE2 link the available built-in style names are specified in the default and the core stylesheets. $\endgroup$ Commented Jul 31, 2013 at 2:34
  • $\begingroup$ @MichaelE2. That link seems to answe my first question. Thanks. $\endgroup$
    – m_goldberg
    Commented Jul 31, 2013 at 2:55
  • $\begingroup$ Note that the function used no longer works (V8 and later, at least). $\endgroup$
    – Michael E2
    Commented Jul 31, 2013 at 2:59
  • $\begingroup$ @m_goldberg, more generally, what are all the named options for all built in symbols? $\endgroup$ Commented Jan 7, 2015 at 19:24

2 Answers 2

36
$\begingroup$
nb2 = NotebookOpen @ FileNameJoin[
  {$InstallationDirectory, "SystemFiles", "FrontEnd", "StyleSheets", "Core.nb"}];

Note that some of the named styles in the core stylesheet styles are empty, i.e. the style name is defined but no styles set:

Cell[StyleData["style"]]

For example (with V8):

Union[Cases[NotebookGet[nb2],StyleData[x_, ___] :> x, \[Infinity]]] // Length   
(* 526 *)

Union[Cases[NotebookGet[nb2],Cell[StyleData[x_, ___], __] :> x, \[Infinity]]] // Length    
(* 477 *)

Those style names with some style settings defined are (note the repeated All at the start of the output list due to the style environment names. You can modify if you wanted to use this programmatically in some way):

styles=Union[Cases[NotebookGet[nb2], Cell[StyleData[x_,___], __] :> x, \[Infinity]]]

(* {"Abs", "ActionMenu", "ActionMenuLabel", "AddOnsLink", \
"AddOnsLinkText", "AiryAi", "AiryAiPrime", "AiryBi", "AiryBiPrime", \
"AngerJ", "AngerJ2", "AppellF1", "ArithmeticGeometricMean", "Assert", \
"AugmentedSymmetricPolynomial", "AugmentedSymmetricPolynomialList", \
"BarnesG", "BellB", "BellB2", "BernoulliB", "BernoulliB2", \
"BernsteinBasis", "BesselI", "BesselJ", "BesselJZero", "BesselK", \
"BesselY", "BesselYZero", "Beta", "Beta3", "Beta4", \
"BetaRegularized", "BetaRegularized4", "BF", "Binomial", "Bra", \
"BraKet", "BSplineBasis", "BSplineBasis3", "BSplineBasis4", "Button", \
"CalculateInput", "CalculatePrompt", "CardinalBSplineBasis", \
"CarmichaelLambda", "CatalanNumber", "Ceiling", "CellExpression", \
"CellInsertionMenu", "CellInsertionMenuShortcut", "CellLabel", \
"CentralMoment", "CentralMomentList", "ChampernowneNumber", \
"Citation", "Code", "Column", "CompatibilityControls", \
"CompatibilityDocked1", "CompatibilityDocked2", "CompatibilityInput", \
"CompatibilityInputTop", "CompatibilityText", "CompatibilityTextTop", \
"ConditionedIntegrate", "ConditionedLimit", "ConditionedList", \
"ConditionedListWithAttributes", "ConditionedMax", "ConditionedMin", \
"ConditionedProduct", "ConditionedSet", \
"ConditionedSetWithAttributes", "ConditionedSum", "Conjugate", \
"ConjugateTranspose", "ControlStyle", "CoordinateTooltipLabel", \
"CopyEvaluate", "CopyEvaluateCell", "CoshIntegral", "CosIntegral", \
"Cumulant", "CumulantList", "Cyclotomic", "DawsonF", "DedekindEta", \
"DemosLink", "Deploy", "Det", "DialogStyle", "DialogText", \
"DifferenceDelta2", "DifferenceDelta3", "DifferenceDelta4", \
"DiracDeltaSeq", "DirichletCharacter", "DirichletL", \
"DiscreteDeltaSeq", "DiscreteRatio2", "DiscreteRatio3", \
"DiscreteRatio4", "DiscreteShift2", "DiscreteShift3", \
"DiscreteShift4", "DivisorSigma", "DockedCell", "DockedTitleCell", \
"DomainIntegrate", "DomainProduct", "DomainSum", "EllipticE", \
"EllipticE2", "EllipticF", "EllipticK", "EllipticNomeQ", \
"EllipticPi", "EllipticPi3", "EllipticTheta", "EllipticThetaPrime", \
"EulerE", "EulerE2", "EulerPhi", "Evaluate", "EvaluateCell", \
"EvaluationMarker", "ExpIntegralE", "ExpIntegralEi", \
"FactorialMoment", "FactorialMomentList", "FactorialPower", \
"FactorialPower3", "Fibonacci", "Fibonacci2", "FieldHintStyle", \
"Floor", "Footer", "FooterSection", "FooterSubsection", \
"FooterTitle", "FrameLabel", "FresnelC", "FresnelS", \
"FunctionTemplate", "FunctionTemplateArgument", \
"FunctionTemplateHighlight", "Gamma", "Gamma2", "Gamma3", \
"GammaRegularized", "GammaRegularized3", "GeneralizedPlaceholder", \
"GenericButton", "GenericLink", "GettingStartedLink", "Graphics", \
"Graphics3D", "Grid", "Gudermannian", "HankelH1", "HankelH2", \
"HarmonicNumber", "HarmonicNumber2", "Haversine", "Header", \
"HeaderSection", "HeaderSubsection", "HeaderTitle", \
"HeavisideLambdaSeq", "HeavisidePiSeq", "HeavisideThetaSeq", \
"HideContentsInPrint", "HistoryCurrentPage", "HurwitzLerchPhi", \
"HurwitzZeta", "Hypergeometric0F1", "Hypergeometric0F1Regularized", \
"Hypergeometric1F1", "Hypergeometric1F1Regularized", \
"Hypergeometric2F1", "Hypergeometric2F1Regularized", \
"HypergeometricU", "Hyperlink", "HyperlinkActive", "ImageGraphics", \
"Inert", "InfoCell", "InfoGrid", "InfoHeading", "InformationCell", \
"InformationLink", "InformationLinkLF", "InlineCell", \
"InlineCellEditing", "InlineOutput", "Input", "InputField", \
"InputForm", "InputOnly", "InsetString", "IntervalClosed", \
"IntervalClosedOpen", "IntervalOpen", "IntervalOpenClosed", \
"Inverse", "InverseBetaRegularized", "InverseBetaRegularized4", \
"InverseEllipticNomeQ", "InverseGammaRegularized", \
"InverseGammaRegularized3", "InverseGudermannian", \
"InverseHaversine", "InverseJacobiCD", "InverseJacobiCN", \
"InverseJacobiCS", "InverseJacobiDC", "InverseJacobiDN", \
"InverseJacobiDS", "InverseJacobiNC", "InverseJacobiND", \
"InverseJacobiNS", "InverseJacobiSC", "InverseJacobiSD", \
"InverseJacobiSN", "InverseWeierstrassP", "InverseWeierstrassP4", \
"IT", "ItemizedPicture", "JacobiAmplitude", "JacobiCD", "JacobiCN", \
"JacobiCS", "JacobiDC", "JacobiDN", "JacobiDS", "JacobiNC", \
"JacobiND", "JacobiNS", "JacobiSC", "JacobiSD", "JacobiSN", \
"JacobiSymbol", "JacobiZeta", "KelvinBei", "KelvinBei2", "KelvinBer", \
"KelvinBer2", "KelvinKei", "KelvinKei2", "KelvinKer", "KelvinKer2", \
"Ket", "KleinInvariantJ", "KroneckerDeltaSeq", "KroneckerSymbol", \
"Label", "Large", "LegendreP", "LegendreP3", "LegendreP4", \
"LegendreQ", "LegendreQ3", "LegendreQ4", "LerchPhi", "Link", \
"LiouvilleLambda", "ListGraphic", "LocatorPane", "LogGamma", \
"LogIntegral", "LucasL", "LucasL2", "MainBookLink", "MainBookLinkMR", \
"MangoldtLambda", "Manipulate", "ManipulateLabel", "Manipulator", \
"MasterIndexLink", "MathCaption", "MathieuCharacteristicA", \
"MathieuCharacteristicB", "MB", "MBO", "Medium", "Menu", "MenuLabel", 
 "MenuViewLabel", "Message", "MessageLink", "MessagesWindow", \
"MixedFraction", "MO", "Mod", "ModularLambda", "MoebiusMu", "Moment", \
"MomentList", "MR", "MSG", "NetworkEdge", "NetworkGraphics", \
"NetworkVertex", "NevilleThetaC", "NevilleThetaD", "NevilleThetaN", \
"NevilleThetaS", "NorlundB", "NorlundB3", "Norm", "Norm2", \
"NotationMadeBoxesTag", "NotationPatternTag", "NotationTemplateTag", \
"Notebook", "NotebookLink", "NotebookLinkMR", "Notes", "ObjectName", \
"OpenCloseItemizedPicture", "OtherInformationLink", \
"OtherInformationLinkMR", "Output", "OutputForm", "PageBreak", \
"PageLink", "PageNumber", "Pane", "Panel", "PanelLabel", \
"PaneSelector", "ParabolicCylinderD", "PartitionsP", "PartitionsQ", \
"Paste", "Picture", "PictureGroup", "Piecewise", "Placeholder", \
"PluginEmbeddedContent", "PluginEmbeddedWindow", "PluginInfoText", \
"PluginInitWindow", "PluginMainErrorText", "PluginSubErrorText", \
"PluginWindow", "Pochhammer", "PolyGamma", "PolyGamma2", "PolyLog", \
"PolyLog3", "PolynomialMod", "PopupMenu", "PopupMenuLabel", \
"PowerMod", "PowerSymmetricPolynomial", \
"PowerSymmetricPolynomialList", "PreviousNext", "PrimaryPlaceholder", \
"Prime", "PrimeNu", "PrimeOmega", "PrimePi", "PrimeZetaP", "Print", \
"PrintTemporary", "PrintUsage", "QBinomial", "QFactorial", "QGamma", \
"QHypergeometricPFQSeq", "QPochhammer", "QPochhammer1", \
"QPochhammer2", "QPolyGamma", "QPolyGamma3", "RamanujanTau", \
"Reference", "ReferenceMarker", "Residue", "RiemannR", \
"RiemannSiegelTheta", "RiemannSiegelZ", "RM", "RowDefault", \
"RowNoSeparators", "RowWithSeparator", "RowWithSeparators", "SB", \
"SBO", "SelectionPlaceholder", "SinhIntegral", "SinIntegral", \
"SlideHyperlink", "SlidePreviousNextLink", "SlideShowCanvas", \
"SlideShowNavigationBar", "SlideShowNavigationBar2", \
"SlideShowPaletteButton", "SlideShowPaletteTitle", \
"SlideShowSection", "SlideTOC", "SlideTOCLink", "Small", "SO", \
"Sound", "SphericalBesselJ", "SphericalBesselY", "SphericalHankelH1", \
"SphericalHankelH2", "SpheroidalEigenvalue", "SpheroidalPS", \
"SpheroidalPSPrime", "SpheroidalQS", "SpheroidalQSPrime", \
"SpheroidalS1", "SpheroidalS1Prime", "SpheroidalS2", \
"SpheroidalS2Prime", "SquaresR", "SR", "StandardForm", \
"StieltjesGamma", "StieltjesGamma2", "StirlingS1", "StirlingS2", \
"StruveH", "StruveL", "Subsuperscript", "Superscript", \
"TableViewGrid", "TableViewItem", "TableViewItem2", \
"TableViewItemExpression", "TableViewItemExpression2", \
"TableViewLabel", "TableViewPlaceholder", "TableViewStringBoxes", \
"TabView", "TabViewLabel", "TB", "TBI", \
"TemplateBoxErrorDisplayArgumentStyle", \
"TemplateBoxErrorDisplayStyle", "TemplateDockedCell", \
"TemplateHeaderCell", "TemplateLink", "TemplateVariable", "TextForm", \
"TextStyleInputField", "TextStyling", "TI", "TooltipLabel", \
"TourLink", "TR", "TraditionalForm", "Transpose", "UnitBoxSeq", \
"UnitStepSeq", "UnitTriangleSeq", "UnmatchedBracket", "Usage", \
"WeberE", "WeberE2", "WeierstrassP", "WeierstrassPPrime", \
"WeierstrassSigma", "WeierstrassZeta", "WhittakerM", "WhittakerW", \
"WolframAlphaLong", "WolframAlphaShort", "WolframAlphaShortInput", \
"Zeta", "Zeta2", "ZetaZero", All} *)

And to see which of these built-in named styles might be visually useful:

Grid[{Style["The quick brown fox ...", #], Style[#, #]} & /@ 
  Cases[styles, _String], Alignment -> {{Right, Left}, Center}]

enter image description here

$\endgroup$
5
  • 1
    $\begingroup$ I had just thought of doing this when your answer showed up. I was trying to find a built-in function. (+1) $\endgroup$
    – Michael E2
    Commented Jul 31, 2013 at 2:59
  • $\begingroup$ Note that StyleData can take a StyleDefinitions option, which your pattern doesn't account for. So there are even more styles... $\endgroup$ Commented Jul 31, 2013 at 4:22
  • $\begingroup$ @BrettChampion good point. I'll make the changes $\endgroup$ Commented Jul 31, 2013 at 4:43
  • $\begingroup$ +1 but why not use FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "StyleSheets", "Core.nb"}] in the first section? $\endgroup$
    – Mr.Wizard
    Commented Jan 6, 2015 at 9:36
  • $\begingroup$ @Mr.Wizard do not recall. I use FileNameJoin regularly now but maybe I wasn't aware of it then $\endgroup$ Commented Jan 6, 2015 at 21:13
28
$\begingroup$

Version 10 introduced some undocumented functionality that makes it easier to explore the style hierarchy. As usual, "undocumented" === "buyer beware".

We start by evaluating:

StyleManager`OpenStyleManager

This does nothing other than trigger the auto-loading of certain symbols. We'll come back to a more interesting use of this symbol later.

Now, we can get a list of all styles accessible from a given notebook like this:

NotebookTools`StylesheetsDump`stylesInAllStylesheets[EvaluationNotebook[]] //
  Sort // Column

(*
  StyleData["Abs"]
  StyleData["ActionMenu"]
  StyleData["ActionMenuLabel"]
  StyleData["AddOnsLink"]
  <<749 more elements>>
  StyleData["Zeta2"]
  StyleData["ZetaZero"]
*)

We can find the style rule hierarchy that applies to any given style like this:

NotebookTools`StylesheetsDump`buildStyleData[StyleData["Input"]]

style data dump

A more readable presentation of this data can be obtained as well:

NotebookTools`StylesheetsDump`buildStyleData[StyleData["Input"]] //
  NotebookTools`StylesheetsDump`showStyleData

formatted style data

There is a dialog box that can be used to explore all of this data interactively (which appears to be a work in progress):

StyleManager`OpenStyleManager[]

style manager screenshot

This information is current as of Mathematica version 10.0.2, but could change at any time.

$\endgroup$
3
  • 5
    $\begingroup$ Great find!! :) $\endgroup$
    – Rojo
    Commented Jan 8, 2015 at 1:41
  • $\begingroup$ Is this still available in version 11.3? Or was it replaced with something similar/better? $\endgroup$ Commented Jan 17, 2021 at 5:39
  • $\begingroup$ @mmaSpectator Yes, this still works in 11.3 and also up to the current version (12.2). I am not aware of an official replacement. $\endgroup$
    – WReach
    Commented Jan 17, 2021 at 5:52

Your Answer

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

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