Style

Style[expr, options]
displays with expr formatted using the specified option settings.

Style[expr, "style"]
uses the option settings for the specified style in the current notebook.

Style[expr, color]
displays using the specified color.

Style[expr, Bold]
displays with fonts made bold.

Style[expr, Italic]
displays with fonts made italic.

Style[expr, Underlined]
displays with fonts underlined.

Style[expr, Larger]
displays with fonts made larger.

Style[expr, Smaller]
displays with fonts made smaller.

Style[expr, n]
displays with font size n.

Style[expr, Tiny], Style[expr, Small], etc.
display with fonts that are tiny, small, etc.

Details and OptionsDetails and Options

  • Style can be used in both ordinary expressions and graphics.
  • Style[expr, spec1, spec2, ...] allows the to be any list or sequence of the following:
  • opt1->val1,...explicit options
    "style"a named style from the current stylesheets
    color directive color (Red, RGBColor[...], ...)]
    graphics directive (Thickness[...], ...)
    Boldtext bold (FontWeight->"Bold")
    Italictext italic (FontSlant->"Italic")
    Underlinedtext underlined
    Largertext larger
    Smallertext smaller
    n (any number) text with font size n (FontSize->n)
    Tiny, Small, etc. text with absolute size
  • Style can use any option listed in the Option Inspector in the notebook front end.
  • Style can use any graphics directive or list of graphics directives.
  • In Style[expr, spec1, spec2, ...], explicit settings given in the always override settings defined by named styles in the , regardless of the order in which they occur.
  • For explicit settings, the first occurrence of a setting for a given option will be the one used.
  • Directives such as Red or Bold are treated as equivalent to their corresponding option settings.
  • A few common explicit options include:
  • Backgroundbackground color
    Editablewhether the contents are editable
    FontFamilyfont family
    Hyphenationwhether to hyphenate in text
    Magnificationmagnification
    Selectablewhether the contents are selectable
  • A few common named styles include:
  • "Button"display like text in a system button
    "Graphics"display like graphics
    "Input"display like Mathematica input
    "Label"display as a sans serif label
    "Menu"display like a system menu item
    "Output"display like Mathematica output
    "Panel"display like text in a system panel
    "PopupMenu"display like a system popup menu
    "Section"display as a section heading
    "SmallText"display like small text
    "Subsection"display as a subsection heading
    "Text"display like ordinary text
    "Title"display like a title
  • When Style objects are nested, the specifications of the innermost one control the display of a particular expression.

ExamplesExamplesopen allclose all

Basic Examples (3)Basic Examples (3)

Use red font color:

In[1]:=
Click for copyable input
Out[1]=

Specify various properties of fonts:

In[2]:=
Click for copyable input
Out[2]=

Use a predefined style:

In[1]:=
Click for copyable input
Out[1]=

Specify the style of an individual graphic object:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
New in 6
New to Mathematica? Find your learning path »
Have a question? Ask support »