frac
ElementElementElement functions can be customized with set
and show
rules.
Element
Element functions can be customized with
set
and show
rules.A mathematical fraction.
Example
$ 1/2 < (x+1)/2 $
$ ((x+1)) / 2 = frac(a, b) $

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.
ParameterParameterParameters are input values for functions. Specify them in parentheses after the function name.
Parameter
Parameters are input values for functions. Specify them in parentheses after the function name.
num
RequiredRequiredRequired parameters must be specified when calling the function.PositionalPositionalPositional parameters can be set by specifying them in order, omitting the parameter name.
Required
Required
Required parameters must be specified when calling the function.
Positional
Positional
Positional parameters can be set by specifying them in order, omitting the parameter name.
The fraction's numerator.
denom
RequiredRequiredRequired parameters must be specified when calling the function.PositionalPositionalPositional parameters can be set by specifying them in order, omitting the parameter name.
Required
Required
Required parameters must be specified when calling the function.
Positional
Positional
Positional parameters can be set by specifying them in order, omitting the parameter name.
The fraction's denominator.
style
SettableSettableSettable parameters can be set using the set
rule, changing the default value used thereafter.
Settable
Settable
Settable parameters can be set using the
set
rule, changing the default value used thereafter.How the fraction should be laid out.
Available string values:
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 value: "vertical"
Show example
#set math.frac(style: "skewed")
$ a / b $
$ frac(x, y, style: "vertical") $
