Documentation

fracElement
Question mark

A mathematical fraction.

Example

$ 1/2 < (x+1)/2 $
$ ((x+1)) / 2 = frac(a, b) $
Preview

Syntax

This function also has dedicated syntax: Use a slash to turn neighbouring expressions into a fraction. Multiple atoms can be grouped into a single expression using round grouping parentheses. Such parentheses are removed from the output, but you can nest multiple to force them.

Parameters
Question mark

num
content
Required Positional
Question mark

The fraction's numerator.

denom
content
Required Positional
Question mark

The fraction's denominator.

style
str
Settable
Question mark

How the fraction should be laid out.

View example: Styles
$ frac(x, y, style: "vertical") $
$ frac(x, y, style: "skewed") $
$ frac(x, y, style: "horizontal") $
Preview
View example: Setting the default
#set math.frac(style: "skewed")
$ a / b $
Preview
View example: Handling of grouping parentheses
// Grouping parentheses are removed.
#set math.frac(style: "vertical")
$ (a + b) / b $

// Grouping parentheses are removed.
#set math.frac(style: "skewed")
$ (a + b) / b $

// Grouping parentheses are retained.
#set math.frac(style: "horizontal")
$ (a + b) / b $
Preview
VariantDetails
"vertical"

Stacked numerator and denominator with a bar.

"skewed"

Numerator and denominator separated by a slash.

"horizontal"

Numerator and denominator placed inline and parentheses are not absorbed.

Default: "vertical"