Styling
The functions in this section produce a visual difference that is not material to the interpretation of an expression such as text color and size or other typographic variations.
They are inert and the value of a ["Function", _expr_] expression is expr.
Delimiter(expr)
Delimiter(expr, delim)
Visually group expressions with an open delimiter, a close delimiter and separators between elements of the expression.
When serializing to LaTeX, render expr wrapped in delimiters.
The Delimiter function is inert and the value of a ["Delimiter", _expr_] expression is expr.
expr is a function expression, usually a ["Sequence"]. It should
not be a symbol or a number.
delim is an optional string:
- when it is a single character it is a separator
- when it is two characters, the first is the opening delimiter and the second is the closing delimiter
- when it is three characters, the first is the opening delimiter, the second is the separator, and the third is the closing delimiter
The delimiters are rendered to LaTeX.
The open and close delimiters are a single character, one of: ()[]{}<>|‖⌈⌉⌊⌋⌜⌝⌞⌟⎰⎱". The open and close delimiters do not have to match.
For example, "')]'" is a valid delimiter.
If an open or close delimiter is ., it is ignored.
The separator delimiter is also a single character, one of ,;.&:|- or U+00B7 (middle dot), U+2022 (bullet) or U+2026 (ellipsis).
If no delim is provided, a default delimiter is used based on the type of expr:
["Sequence"]->(,)["Tuple"],["Single"],["Pair"],["Triple"]->(,)["List"]->[,]["Set"]->{,}
Spacing(width)
When serializing to LaTeX, widthis the dimension of the spacing, in 1/18 em.
The Spacing function is inert and the value of a ["Spacing", _expr_] expression is expr.
Annotated(expr:expression, dictionary) -> expression
Annotated(expr, attributes) is an expression that behaves exactly like expr,
but carries visual or semantic metadata as an attribute dictionary.
The attributes have no effect on evaluation. This function is inert — it evaluates to its first argument.
The attributes dictionary may include:
- Visual style hints (e.g.
weight: "bold",color: "blue") - Semantic metadata (e.g.
tooltip,language,link)
Use Annotated when you want to attach presentational or semantic
information to an expression without affecting its evaluation or identity.
This is useful for rendering, tooltips, highlighting, etc.
The following keys are applicable to math expressions:
mathStyle="compact"or"normal". The"compact"style is used for inline math expressions, while the"normal"style is used for display math expressions.scriptLevel=0,1, or-1,+1. The script level is used to determine the size of the expression in relation to the surrounding text. A script level of0is normal size,1is smaller, and2is even smaller.
The following keys are applicable to text content:
weighta string, one of"normal","bold","bolder","light"stylea string, one of"normal","italic","oblique"languagea string indicating the language of the expression, e.g."en","fr","es"etc.
The following keys are applicable to both math expressions and text content:
colora color name or hex codebackgroundColora color name or hex code for the background colortooltipa string to be displayed as a tooltip when the expression is hovered overlinka URL to be followed when the expression is clickedcssClassa string indicating the CSS class to be applied to the expressioncssIda string indicating the CSS id of the expression
The keys in the dictionary include:
stylea string, one of"normal","italic","oblique"sizea number from1to10where5is normal sizefonta string indicating the font familyfontSizea number indicating the font size in pixelsfontWeighta string indicating the font weight, e.g."normal","bold","bolder","lighter"fontStylea string indicating the font style, e.g."normal","italic","oblique"textDecorationa string indicating the text decoration, e.g."none","underline","line-through"textAligna string indicating the text alignment, e.g."left","center","right"textTransforma string indicating the text transformation, e.g."none","uppercase","lowercase"textIndenta number indicating the text indentation in pixelslineHeighta number indicating the line height in pixelsletterSpacinga number indicating the letter spacing in pixelswordSpacinga number indicating the word spacing in pixelsbackgroundColora color name or hex code for the background colorbordera string indicating the border style, e.g."none","solid","dashed","dotted"borderColora color name or hex code for the border colorborderWidtha number indicating the border width in pixelspaddinga number indicating the padding in pixelsmargina number indicating the margin in pixelstextShadowa string indicating the text shadow, e.g."2px 2px 2px rgba(0,0,0,0.5)"boxShadowa string indicating the box shadow, e.g."2px 2px 5px rgba(0,0,0,0.5)"opacitya number from0to1indicating the opacity of the expressiontransforma string indicating the CSS transform, e.g."rotate(45deg)","scale(1.5)","translateX(10px)"transitiona string indicating the CSS transition, e.g."all 0.3s ease-in-out"cursora string indicating the cursor style, e.g."pointer","default","text"displaya string indicating the CSS display property, e.g."inline","block","flex","grid"visibilitya string indicating the CSS visibility property, e.g."visible","hidden","collapse"zIndexa number indicating the z-index of the expressionpositiona string indicating the CSS position property, e.g."static","relative","absolute","fixed"floata string indicating the CSS float property, e.g."left","right","none"cleara string indicating the CSS clear property, e.g."left","right","both","none"overflowa string indicating the CSS overflow property, e.g."visible","hidden","scroll","auto"overflowXa string indicating the CSS overflow-x property, e.g."visible","hidden","scroll","auto"overflowYa string indicating the CSS overflow-y property, e.g."visible","hidden","scroll","auto"whiteSpacea string indicating the CSS white-space property, e.g."normal","nowrap","pre",textOverflowa string indicating the CSS text-overflow property, e.g."ellipsis","clip"directiona string indicating the text direction, e.g."ltr"(left-to-right) or"rtl"(right-to-left)langa string indicating the language of the expression, e.g."en"(English),"fr"(French),"es"(Spanish)rolea string indicating the ARIA role of the expression, e.g."button","link","textbox"aria-labela string providing an accessible label for the expressionaria-labelledbya string providing an accessible label by referencing another element's IDaria-describedbya string providing an accessible description by referencing another element's IDaria-hiddena boolean indicating whether the expression is hidden from assistive technologiesaria-livea string indicating the ARIA live region, e.g."off","polite","assertive"aria-atomica boolean indicating whether assistive technologies should treat the expression as a wholearia-relevanta string indicating what changes in the expression are relevant to assistive technologies, e.g. `"additions"aria-controlsa string providing the ID of another element that the expression controlsaria-expandeda boolean indicating whether the expression is expanded or collapsedaria-presseda boolean indicating whether the expression is pressed (for toggle buttons)aria-selecteda boolean indicating whether the expression is selectedaria-checkeda boolean indicating whether the expression is checked (for checkboxes or radio buttons)aria-valuenowa number indicating the current value of the expression (for sliders or progress bars)aria-valuetexta string providing a text representation of the current value of the expressionaria-valuemina number indicating the minimum value of the expression (for sliders or progress bars)aria-valuemaxa number indicating the maximum value of the expression (for sliders or progress bars)aria-keyshortcutsa
The Annotated function is inert and the value of a ["Annotated", expr] expression is expr.