feat: initial commit
This commit is contained in:
commit
b802ff49ab
454 files changed
+52429
No files matched your search
@@ -0,0 +1,43 @@
|
||||
# Accent
|
||||
|
||||
# math.accent
|
||||
|
||||
Attaches an accent to a base.
|
||||
|
||||
## Example
|
||||
|
||||
```typst
|
||||
$grave(a) = accent(a, `)$ \
|
||||
$arrow(a) = accent(a, arrow)$ \
|
||||
$tilde(a) = accent(a, \u{0303})$
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.accent(
|
||||
base,
|
||||
accent,
|
||||
size: relative,
|
||||
dotless: bool
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- base:
|
||||
- description: The base to which the accent is applied. May consist of multiple letters. ```typst $arrow(A B C)$ ```
|
||||
- type: content
|
||||
- default: None
|
||||
- accent:
|
||||
- description: The accent to apply to the base. Supported accents include: | Accent | Name | Codepoint | | --- | --- | --- | | Grave | `grave` | ``` | | Acute | `acute` | `´` | | Circumflex | `hat` | `^` | | Tilde | `tilde` | `~` | | Macron | `macron` | `¯` | | Dash | `dash` | `‾` | | Breve | `breve` | `˘` | | Dot | `dot` | `.` | | Double dot, Diaeresis | `dot.double`, `diaer` | `¨` | | Triple dot | `dot.triple` | `⃛` | | Quadruple dot | `dot.quad` | `⃜` | | Circle | `circle` | `∘` | | Double acute | `acute.double` | `˝` | | Caron | `caron` | `ˇ` | | Right arrow | `arrow`, `->` | `→` | | Left arrow | `arrow.l`, `<-` | `←` | | Left/Right arrow | `arrow.l.r` | `↔` | | Right harpoon | `harpoon` | `⇀` | | Left harpoon | `harpoon.lt` | `↼` |
|
||||
- type: str | content
|
||||
- default: None
|
||||
- size:
|
||||
- description: The size of the accent, relative to the width of the base. ```typst $dash(A, size: #150%)$ ```
|
||||
- type: relative
|
||||
- default: 100 % + 0pt
|
||||
- dotless:
|
||||
- description: Whether to remove the dot on top of lowercase i and j when adding a top accent. This enables the `dtls` OpenType feature. ```typst $hat(dotless: #false, i)$ ```
|
||||
- type: bool
|
||||
- default: true
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
# Attach
|
||||
|
||||
Subscript, superscripts, and limits.
|
||||
|
||||
Attachments can be displayed either as sub/superscripts, or limits. Typst automatically decides which is more suitable depending on the base, but you can also control this manually with the `scripts` and `limits` functions.
|
||||
|
||||
If you want the base to stretch to fit long top and bottom attachments (for example, an arrow with text above it), use the [`stretch`](/docs/reference/math/stretch/) function.
|
||||
|
||||
## Example
|
||||
|
||||
```typst
|
||||
$ sum_(i=0)^n a_i = 2^(1+i) $
|
||||
```
|
||||
|
||||
## Syntax
|
||||
|
||||
This function also has dedicated syntax for attachments after the base: Use the underscore (`_`) to indicate a subscript i.e. bottom attachment and the hat (`^`) to indicate a superscript i.e. top attachment.
|
||||
|
||||
# math.attach
|
||||
|
||||
A base with optional attachments.
|
||||
|
||||
```typst
|
||||
$ attach(
|
||||
Pi, t: alpha, b: beta,
|
||||
tl: 1, tr: 2+3, bl: 4+5, br: 6,
|
||||
) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.attach(
|
||||
base,
|
||||
t: none | content,
|
||||
b: none | content,
|
||||
tl: none | content,
|
||||
bl: none | content,
|
||||
tr: none | content,
|
||||
br: none | content
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- base:
|
||||
- description: The base to which things are attached.
|
||||
- type: content
|
||||
- default: None
|
||||
- t:
|
||||
- description: The top attachment, smartly positioned at top-right or above the base. You can wrap the base in `limits()` or `scripts()` to override the smart positioning.
|
||||
- type: none | content
|
||||
- default: none
|
||||
- b:
|
||||
- description: The bottom attachment, smartly positioned at the bottom-right or below the base. You can wrap the base in `limits()` or `scripts()` to override the smart positioning.
|
||||
- type: none | content
|
||||
- default: none
|
||||
- tl:
|
||||
- description: The top-left attachment (before the base).
|
||||
- type: none | content
|
||||
- default: none
|
||||
- bl:
|
||||
- description: The bottom-left attachment (before base).
|
||||
- type: none | content
|
||||
- default: none
|
||||
- tr:
|
||||
- description: The top-right attachment (after the base).
|
||||
- type: none | content
|
||||
- default: none
|
||||
- br:
|
||||
- description: The bottom-right attachment (after the base).
|
||||
- type: none | content
|
||||
- default: none
|
||||
|
||||
# math.scripts
|
||||
|
||||
Forces a base to display attachments as scripts.
|
||||
|
||||
```typst
|
||||
$ scripts(sum)_1^2 != sum_1^2 $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.scripts(
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The base to attach the scripts to.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.limits
|
||||
|
||||
Forces a base to display attachments as limits.
|
||||
|
||||
```typst
|
||||
$ limits(A)_1^2 != A_1^2 $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.limits(
|
||||
body,
|
||||
inline: bool
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The base to attach the limits to.
|
||||
- type: content
|
||||
- default: None
|
||||
- inline:
|
||||
- description: Whether to also force limits in inline equations. When applying limits globally (e.g., through a show rule), it is typically a good idea to disable this.
|
||||
- type: bool
|
||||
- default: true
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
# Binomial
|
||||
|
||||
# math.binom
|
||||
|
||||
A binomial expression.
|
||||
|
||||
## Example
|
||||
|
||||
```typst
|
||||
$ binom(n, k) $
|
||||
$ binom(n, k_1, k_2, k_3, ..., k_m) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.binom(
|
||||
upper,
|
||||
lower
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- upper:
|
||||
- description: The binomial\'s upper index.
|
||||
- type: content
|
||||
- default: None
|
||||
- lower:
|
||||
- description: The binomial\'s lower index.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
# Cancel
|
||||
|
||||
# math.cancel
|
||||
|
||||
Displays a diagonal line over a part of an equation.
|
||||
|
||||
This is commonly used to show the elimination of a term.
|
||||
|
||||
## Example
|
||||
|
||||
```typst
|
||||
Here, we can simplify:
|
||||
$ (a dot b dot cancel(x)) /
|
||||
cancel(x) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.cancel(
|
||||
body,
|
||||
length: relative,
|
||||
inverted: bool,
|
||||
cross: bool,
|
||||
angle: auto | angle | function,
|
||||
stroke: length | color | gradient | stroke | tiling | dictionary
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content over which the line should be placed.
|
||||
- type: content
|
||||
- default: None
|
||||
- length:
|
||||
- description: The length of the line, relative to the length of the diagonal spanning the whole element being "cancelled". A value of `100%` would then have the line span precisely the element\'s diagonal. ```typst $ a + cancel(x, length: #200%) - cancel(x, length: #200%) $ ```
|
||||
- type: relative
|
||||
- default: 100 % + 3pt
|
||||
- inverted:
|
||||
- description: Whether the cancel line should be inverted (flipped along the y-axis). For the default angle setting, inverted means the cancel line points to the top left instead of top right. ```typst $ (a cancel((b + c), inverted: #true)) / cancel(b + c, inverted: #true) $ ```
|
||||
- type: bool
|
||||
- default: false
|
||||
- cross:
|
||||
- description: Whether two opposing cancel lines should be drawn, forming a cross over the element. Overrides `inverted`. ```typst $ cancel(Pi, cross: #true) $ ```
|
||||
- type: bool
|
||||
- default: false
|
||||
- angle:
|
||||
- description: How much to rotate the cancel line. - If given an angle, the line is rotated by that angle clockwise with respect to the y-axis. - If `auto`, the line assumes the default angle; that is, along the rising diagonal of the content box. - If given a function `angle => angle`, the line is rotated, with respect to the y-axis, by the angle returned by that function. The function receives the default angle as its input. ```typst $ cancel(Pi) cancel(Pi, angle: #0deg) cancel(Pi, angle: #45deg) cancel(Pi, angle: #90deg) cancel(1/(1+x), angle: #(a => a + 45deg)) cancel(1/(1+x), angle: #(a => a + 90deg)) $ ```
|
||||
- type: auto | angle | function
|
||||
- default: auto
|
||||
- stroke:
|
||||
- description: How to [stroke](/docs/reference/visualize/stroke/) the cancel line. ```typst $ cancel( sum x, stroke: #( paint: red, thickness: 1.5pt, dash: "dashed", ), ) $ ```
|
||||
- type: length | color | gradient | stroke | tiling | dictionary
|
||||
- default: 0.5pt
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# Cases
|
||||
|
||||
# math.cases
|
||||
|
||||
A case distinction.
|
||||
|
||||
Content across different branches can be aligned with the `&` symbol.
|
||||
|
||||
## Example
|
||||
|
||||
```typst
|
||||
$ f(x, y) := cases(
|
||||
1 "if" (x dot y)/2 <= 0,
|
||||
2 "if" x "is even",
|
||||
3 "if" x in NN,
|
||||
4 "else",
|
||||
) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.cases(
|
||||
delim: none | str | array | symbol,
|
||||
reverse: bool,
|
||||
gap: relative,
|
||||
children
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- delim:
|
||||
- description: The delimiter to use. Can be a single character specifying the left delimiter, in which case the right delimiter is inferred. Otherwise, can be an array containing a left and a right delimiter. ```typst #set math.cases(delim: "[") $ x = cases(1, 2) $ ```
|
||||
- type: none | str | array | symbol
|
||||
- default: ("{", "}")
|
||||
- reverse:
|
||||
- description: Whether the direction of cases should be reversed. ```typst #set math.cases(reverse: true) $ cases(1, 2) = x $ ```
|
||||
- type: bool
|
||||
- default: false
|
||||
- gap:
|
||||
- description: The gap between branches. ```typst #set math.cases(gap: 1em) $ x = cases(1, 2) $ ```
|
||||
- type: relative
|
||||
- default: 0 % + 0.2em
|
||||
- children:
|
||||
- description: The branches of the case distinction.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# Class
|
||||
|
||||
# math.class
|
||||
|
||||
Forced use of a certain math class.
|
||||
|
||||
This is useful to treat certain symbols as if they were of a different class, e.g. to make a symbol behave like a relation. The class of a symbol defines the way it is laid out, including spacing around it, and how its scripts are attached by default. Note that the latter can always be overridden using [`limits`](/docs/reference/math/attach/#functions-limits) and [`scripts`](/docs/reference/math/attach/#functions-scripts).
|
||||
|
||||
## Example
|
||||
|
||||
```typst
|
||||
#let loves = math.class(
|
||||
"relation",
|
||||
sym.suit.heart,
|
||||
)
|
||||
|
||||
$x loves y and y loves 5$
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.class(
|
||||
class,
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- class:
|
||||
- description: The class to apply to the content.
|
||||
- type: str
|
||||
- default: None
|
||||
- body:
|
||||
- description: The content to which the class is applied.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
# Equation
|
||||
|
||||
# math.equation
|
||||
|
||||
A mathematical equation.
|
||||
|
||||
Can be displayed inline with text or as a separate block. An equation becomes block-level through the presence of whitespace after the opening dollar sign and whitespace before the closing dollar sign.
|
||||
|
||||
## Example
|
||||
|
||||
```typst
|
||||
#set text(font: "New Computer Modern")
|
||||
|
||||
Let $a$, $b$, and $c$ be the side
|
||||
lengths of right-angled triangle.
|
||||
Then, we know that:
|
||||
$ a^2 + b^2 = c^2 $
|
||||
|
||||
Prove by induction:
|
||||
$ sum_(k=1)^n k = (n(n+1)) / 2 $
|
||||
```
|
||||
|
||||
By default, block-level equations will not break across pages. This can be changed through `show math.equation: set block(breakable: true)`.
|
||||
|
||||
## Syntax
|
||||
|
||||
This function also has dedicated syntax: Write mathematical markup within dollar signs to create an equation. Starting and ending the equation with whitespace lifts it into a separate block that is centered horizontally. For more details about math syntax, see the [main math page](/docs/reference/math/).
|
||||
|
||||
```typst
|
||||
#math.equation(
|
||||
block: bool,
|
||||
numbering: none | str | function,
|
||||
number-align: alignment,
|
||||
supplement: none | auto | content | function,
|
||||
alt: none | str,
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- block:
|
||||
- description: Whether the equation is displayed as a separate block.
|
||||
- type: bool
|
||||
- default: false
|
||||
- numbering:
|
||||
- description: How to number block-level equations. Accepts a [numbering pattern or function](/docs/reference/model/numbering/) taking a single number. ```typst #set math.equation(numbering: "(1)") We define: $ phi.alt := (1 + sqrt(5)) / 2 $ <ratio> With @ratio, we get: $ F_n = floor(1 / sqrt(5) phi.alt^n) $ ```
|
||||
- type: none | str | function
|
||||
- default: none
|
||||
- number-align:
|
||||
- description: The alignment of the equation numbering. By default, the alignment is `end + horizon`. For the horizontal component, you can use `right`, `left`, or `start` and `end` of the text direction; for the vertical component, you can use `top`, `horizon`, or `bottom`. ```typst #set math.equation(numbering: "(1)", number-align: bottom) We can calculate: $ E &= sqrt(m_0^2 + p^2) \\ &approx 125 "GeV" $ ```
|
||||
- type: alignment
|
||||
- default: end + horizon
|
||||
- supplement:
|
||||
- description: A supplement for the equation. For references to equations, this is added before the referenced number. If a function is specified, it is passed the referenced equation and should return content. ```typst #set math.equation(numbering: "(1)", supplement: [Eq.]) We define: $ phi.alt := (1 + sqrt(5)) / 2 $ <ratio> With @ratio, we get: $ F_n = floor(1 / sqrt(5) phi.alt^n) $ ```
|
||||
- type: none | auto | content | function
|
||||
- default: auto
|
||||
- alt:
|
||||
- description: An alternative description of the mathematical equation. This should describe the full equation in natural language and will be made available to Assistive Technology. You can learn more in the [Textual Representations section of the Accessibility Guide](/docs/guides/accessibility/#textual-representations). ```typst #math.equation( alt: "integral from 1 to infinity of a x squared plus b with respect to x", block: true, $ integral_1^oo a x^2 + b dif x $, ) ```
|
||||
- type: none | str
|
||||
- default: none
|
||||
- body:
|
||||
- description: The contents of the equation.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Fraction
|
||||
|
||||
# math.frac
|
||||
|
||||
A mathematical fraction.
|
||||
|
||||
## Example
|
||||
|
||||
```typst
|
||||
$ 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.
|
||||
|
||||
```typst
|
||||
#math.frac(
|
||||
num,
|
||||
denom,
|
||||
style: str
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- num:
|
||||
- description: The fraction\'s numerator.
|
||||
- type: content
|
||||
- default: None
|
||||
- denom:
|
||||
- description: The fraction\'s denominator.
|
||||
- type: content
|
||||
- default: None
|
||||
- style:
|
||||
- description: How the fraction should be laid out. ```typst $ frac(x, y, style: "vertical") $ $ frac(x, y, style: "skewed") $ $ frac(x, y, style: "horizontal") $ ``` ```typst #set math.frac(style: "skewed") $ a / b $ ``` ```typst // 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 $ ``` ```typst // This changes the style for inline equations only. #show math.equation.where(block: false): set math.frac(style: "horizontal") This $(x-y)/z = 3$ is inline math, and this is block math: $ (x-y)/z = 3 $ ```
|
||||
- type: str
|
||||
- default: "vertical"
|
||||
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
# Math
|
||||
|
||||
Typst has special [syntax](/docs/reference/syntax/#math) and library functions to typeset mathematical formulas. Math formulas can be displayed inline with text or as separate blocks. They will be typeset into their own block if they start and end with at least one space (e.g. `$ x^2 $`).
|
||||
|
||||
## Variables
|
||||
|
||||
In math, single letters are always displayed as is. Multiple letters, however, are interpreted as variables and functions. To display multiple letters verbatim, you can place them into quotes and to access single letter variables, you can use the [hash syntax](/docs/reference/scripting/#expressions).
|
||||
|
||||
```typst
|
||||
$ A = pi r^2 $
|
||||
$ "area" = pi dot "radius"^2 $
|
||||
$ cal(A) :=
|
||||
{ x in RR | x "is natural" } $
|
||||
#let x = 5
|
||||
$ #x < 17 $
|
||||
```
|
||||
|
||||
## Symbols
|
||||
|
||||
Math mode makes a wide selection of [symbols](/docs/reference/symbols/sym/) like `pi`, `dot`, or `RR` available. Many mathematical symbols are available in different variants. You can select between different variants by applying [modifiers](/docs/reference/foundations/symbol/) to the symbol. Typst further recognizes a number of shorthand sequences like `=>` that approximate a symbol. When such a shorthand exists, the symbol's documentation lists it.
|
||||
|
||||
```typst
|
||||
$ x < y => x gt.eq.not y $
|
||||
```
|
||||
|
||||
## Line Breaks
|
||||
|
||||
Formulas can also contain line breaks. Each line can contain one or multiple _alignment points_ (`&`) which are then aligned.
|
||||
|
||||
```typst
|
||||
$ sum_(k=0)^n k
|
||||
&= 1 + ... + n \
|
||||
&= (n(n+1)) / 2 $
|
||||
```
|
||||
|
||||
## Function calls
|
||||
|
||||
Math mode supports special function calls without the hash prefix. In these "math calls", the argument list works a little differently than in code:
|
||||
|
||||
- Within them, Typst is still in "math mode". Thus, you can write math directly into them, but need to use hash syntax to pass code expressions (except for strings, which are available in the math syntax).
|
||||
- They support positional and named arguments, as well as argument spreading.
|
||||
- They don't support trailing content blocks.
|
||||
- They provide additional syntax for 2-dimensional argument lists. The semicolon (`;`) merges preceding arguments separated by commas into an array argument.
|
||||
|
||||
```typst
|
||||
$ frac(a^2, 2) $
|
||||
$ vec(1, 2, delim: "[") $
|
||||
$ mat(1, 2; 3, 4) $
|
||||
$ mat(..#range(1, 5).chunks(2)) $
|
||||
$ lim_x =
|
||||
op("lim", limits: #true)_x $
|
||||
```
|
||||
|
||||
To write a verbatim comma or semicolon in a math call, escape it with a backslash. The colon on the other hand is only recognized in a special way if directly preceded by an identifier, so to display it verbatim in those cases, you can just insert a space before it.
|
||||
|
||||
Functions calls preceded by a hash are normal code function calls and not affected by these rules.
|
||||
|
||||
## Alignment
|
||||
|
||||
When equations include multiple _alignment points_ (`&`), this creates blocks of alternatingly right- and left-aligned columns. In the example below, the expression `(3x + y) / 7` is right-aligned and `= 9` is left-aligned. The word "given" is also left-aligned because `&&` creates two alignment points in a row, alternating the alignment twice. `& &` and `&&` behave exactly the same way. Meanwhile, "multiply by 7" is right-aligned because just one `&` precedes it. Each alignment point simply alternates between right-aligned/left-aligned.
|
||||
|
||||
```typst
|
||||
$ (3x + y) / 7 &= 9 && "given" \
|
||||
3x + y &= 63 & "multiply by 7" \
|
||||
3x &= 63 - y && "subtract y" \
|
||||
x &= 21 - y/3 & "divide by 3" $
|
||||
```
|
||||
|
||||
## Math fonts
|
||||
|
||||
You can set the math font by with a [show-set rule](/docs/reference/styling/#show-rules) as demonstrated below. Note that only special OpenType math fonts are suitable for typesetting maths.
|
||||
|
||||
```typst
|
||||
#show math.equation: set text(font: "Fira Math")
|
||||
$ sum_(i in NN) 1 + i $
|
||||
```
|
||||
|
||||
## Math module
|
||||
|
||||
All math functions are part of the `math` [module](/docs/reference/scripting/#modules), which is available by default in equations. Outside of equations, they can be accessed with the `math.` prefix.
|
||||
|
||||
## Accessibility
|
||||
|
||||
To make math accessible, you must provide alternative descriptions of equations in natural language using the [`alt` parameter of `math.equation`](/docs/reference/math/equation/#parameters-alt). For more information, see the [Textual Representations section of the Accessibility Guide](/docs/guides/accessibility/#textual-representations).
|
||||
|
||||
```typst
|
||||
#math.equation(
|
||||
alt: "d S equals delta q divided by T",
|
||||
block: true,
|
||||
$ dif S = (delta q) / T $,
|
||||
)
|
||||
```
|
||||
|
||||
In the future, Typst will automatically make equations without alternative descriptions accessible in HTML and PDF 2.0 export.
|
||||
|
||||
## Definitions
|
||||
|
||||
| Name | Description |
|
||||
| --- | --- |
|
||||
| [`accent`](/reference/math/accent/) | Attaches an accent to a base. |
|
||||
| [`attach`](/reference/math/attach/) | Subscript, superscripts, and limits. |
|
||||
| [`binom`](/reference/math/binom/) | A binomial expression. |
|
||||
| [`cancel`](/reference/math/cancel/) | Displays a diagonal line over a part of an equation. |
|
||||
| [`cases`](/reference/math/cases/) | A case distinction. |
|
||||
| [`class`](/reference/math/class/) | Forced use of a certain math class. |
|
||||
| [`equation`](/reference/math/equation/) | A mathematical equation. |
|
||||
| [`frac`](/reference/math/frac/) | A mathematical fraction. |
|
||||
| [`lr`](/reference/math/lr/) | Delimiter matching. |
|
||||
| [`mat`](/reference/math/mat/) | A matrix. |
|
||||
| [`op`](/reference/math/op/) | A text operator in an equation. |
|
||||
| [`primes`](/reference/math/primes/) | Grouped primes. |
|
||||
| [`roots`](/reference/math/roots/) | Square and non-square roots. |
|
||||
| [`sizes`](/reference/math/sizes/) | Forced size styles for expressions within formulas. |
|
||||
| [`stretch`](/reference/math/stretch/) | Stretches a glyph. |
|
||||
| [`styles`](/reference/math/styles/) | Alternate letterforms within formulas. |
|
||||
| [`underover`](/reference/math/underover/) | Delimiters above or below parts of an equation. |
|
||||
| [`variants`](/reference/math/variants/) | Alternate typefaces within formulas. |
|
||||
| [`vec`](/reference/math/vec/) | A column vector. |
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
# Left/Right
|
||||
|
||||
Delimiter matching.
|
||||
|
||||
The `lr` function allows you to match two delimiters and scale them with the content they contain. While this also happens automatically for delimiters that match syntactically, `lr` allows you to match two arbitrary delimiters and control their size exactly. Apart from the `lr` function, Typst provides a few more functions that create delimiter pairings for absolute, ceiled, and floored values as well as norms.
|
||||
|
||||
To prevent a delimiter from being matched by Typst, and thus auto-scaled, escape it with a backslash. To instead disable auto-scaling completely, use `set math.lr(size: 1em)`.
|
||||
|
||||
## Example
|
||||
|
||||
```typst
|
||||
$ [a, b/2] $
|
||||
$ lr(]sum_(x=1)^n], size: #50%) x $
|
||||
$ abs((x + y) / 2) $
|
||||
$ \{ (x / y) \} $
|
||||
#set math.lr(size: 1em)
|
||||
$ { (a / b), a, b in (0; 1/2] } $
|
||||
```
|
||||
|
||||
# math.lr
|
||||
|
||||
Scales delimiters.
|
||||
|
||||
While matched delimiters scale by default, this can be used to scale unmatched delimiters and to control the delimiter scaling more precisely.
|
||||
|
||||
```typst
|
||||
#math.lr(
|
||||
size: relative,
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- size:
|
||||
- description: The size of the brackets, relative to the height of the wrapped content.
|
||||
- type: relative
|
||||
- default: 100 % + 0pt
|
||||
- body:
|
||||
- description: The delimited content, including the delimiters.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.mid
|
||||
|
||||
Scales delimiters vertically to the nearest surrounding `lr()` group.
|
||||
|
||||
```typst
|
||||
$ { x mid(|) sum_(i=1)^n w_i|f_i (x)| < 1 } $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.mid(
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to be scaled.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.abs
|
||||
|
||||
Takes the absolute value of an expression.
|
||||
|
||||
```typst
|
||||
$ abs(x/2) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.abs(
|
||||
size: relative,
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- size:
|
||||
- description: The size of the brackets, relative to the height of the wrapped content.
|
||||
- type: relative
|
||||
- default: None
|
||||
- body:
|
||||
- description: The expression to take the absolute value of.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.norm
|
||||
|
||||
Takes the norm of an expression.
|
||||
|
||||
```typst
|
||||
$ norm(x/2) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.norm(
|
||||
size: relative,
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- size:
|
||||
- description: The size of the brackets, relative to the height of the wrapped content.
|
||||
- type: relative
|
||||
- default: None
|
||||
- body:
|
||||
- description: The expression to take the norm of.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.floor
|
||||
|
||||
Floors an expression.
|
||||
|
||||
```typst
|
||||
$ floor(x/2) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.floor(
|
||||
size: relative,
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- size:
|
||||
- description: The size of the brackets, relative to the height of the wrapped content.
|
||||
- type: relative
|
||||
- default: None
|
||||
- body:
|
||||
- description: The expression to floor.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.ceil
|
||||
|
||||
Ceils an expression.
|
||||
|
||||
```typst
|
||||
$ ceil(x/2) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.ceil(
|
||||
size: relative,
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- size:
|
||||
- description: The size of the brackets, relative to the height of the wrapped content.
|
||||
- type: relative
|
||||
- default: None
|
||||
- body:
|
||||
- description: The expression to ceil.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.round
|
||||
|
||||
Rounds an expression.
|
||||
|
||||
```typst
|
||||
$ round(x/2) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.round(
|
||||
size: relative,
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- size:
|
||||
- description: The size of the brackets, relative to the height of the wrapped content.
|
||||
- type: relative
|
||||
- default: None
|
||||
- body:
|
||||
- description: The expression to round.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
# Matrix
|
||||
|
||||
# math.mat
|
||||
|
||||
A matrix.
|
||||
|
||||
The elements of a row should be separated by commas, while the rows themselves should be separated by semicolons. The semicolon syntax merges preceding arguments separated by commas into an array. You can also use this special syntax of math function calls to define custom functions that take 2D data.
|
||||
|
||||
Content in cells can be aligned with the [`align`](/docs/reference/math/mat/#parameters-align) parameter, or content in cells that are in the same row can be aligned with the `&` symbol.
|
||||
|
||||
## Example
|
||||
|
||||
```typst
|
||||
$ mat(
|
||||
1, 2, ..., 10;
|
||||
2, 2, ..., 10;
|
||||
dots.v, dots.v, dots.down, dots.v;
|
||||
10, 10, ..., 10;
|
||||
) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.mat(
|
||||
delim: none | str | array | symbol,
|
||||
align: alignment,
|
||||
augment: none | int | dictionary,
|
||||
gap: relative,
|
||||
row-gap: relative,
|
||||
column-gap: relative,
|
||||
rows
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- delim:
|
||||
- description: The delimiter to use. Can be a single character specifying the left delimiter, in which case the right delimiter is inferred. Otherwise, can be an array containing a left and a right delimiter. ```typst #set math.mat(delim: "[") $ mat(1, 2; 3, 4) $ ```
|
||||
- type: none | str | array | symbol
|
||||
- default: ("(", ")")
|
||||
- align:
|
||||
- description: The horizontal alignment that each cell should have. ```typst #set math.mat(align: right) $ mat(-1, 1, 1; 1, -1, 1; 1, 1, -1) $ ```
|
||||
- type: alignment
|
||||
- default: center
|
||||
- augment:
|
||||
- description: Draws augmentation lines in a matrix. - `none`: No lines are drawn. - A single number: A vertical augmentation line is drawn after the specified column number. Negative numbers start from the end. - A dictionary: With a dictionary, multiple augmentation lines can be drawn both horizontally and vertically. Additionally, the style of the lines can be set. The dictionary can contain the following keys: - `hline`: The offsets at which horizontal lines should be drawn. For example, an offset of `2` would result in a horizontal line being drawn after the second row of the matrix. Accepts either an integer for a single line, or an array of integers for multiple lines. Like for a single number, negative numbers start from the end. - `vline`: The offsets at which vertical lines should be drawn. For example, an offset of `2` would result in a vertical line being drawn after the second column of the matrix. Accepts either an integer for a single line, or an array of integers for multiple lines. Like for a single number, negative numbers start from the end. - `stroke`: How to [stroke](/docs/reference/visualize/stroke/) the line. If set to `auto`, takes on a thickness of 0.05 em and square line caps. ```typst $ mat(1, 0, 1; 0, 1, 2; augment: #2) $ // Equivalent to: $ mat(1, 0, 1; 0, 1, 2; augment: #(-1)) $ ``` ```typst $ mat(0, 0, 0; 1, 1, 1; augment: #(hline: 1, stroke: 2pt + green)) $ ```
|
||||
- type: none | int | dictionary
|
||||
- default: none
|
||||
- gap:
|
||||
- description: The gap between rows and columns. This is a shorthand to set `row-gap` and `column-gap` to the same value. ```typst #set math.mat(gap: 1em) $ mat(1, 2; 3, 4) $ ```
|
||||
- type: relative
|
||||
- default: 0 % + 0pt
|
||||
- row-gap:
|
||||
- description: The gap between rows. ```typst #set math.mat(row-gap: 1em) $ mat(1, 2; 3, 4) $ ```
|
||||
- type: relative
|
||||
- default: 0 % + 0.2em
|
||||
- column-gap:
|
||||
- description: The gap between columns. ```typst #set math.mat(column-gap: 1em) $ mat(1, 2; 3, 4) $ ```
|
||||
- type: relative
|
||||
- default: 0 % + 0.5em
|
||||
- rows:
|
||||
- description: An array of arrays with the rows of the matrix. ```typst #let data = ((1, 2, 3), (4, 5, 6)) #let matrix = math.mat(..data) $ v := matrix $ ```
|
||||
- type: array
|
||||
- default: None
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# Text Operator
|
||||
|
||||
# math.op
|
||||
|
||||
A text operator in an equation.
|
||||
|
||||
## Example
|
||||
|
||||
```typst
|
||||
$ tan x = (sin x)/(cos x) $
|
||||
$ op("custom",
|
||||
limits: #true)_(n->oo) n $
|
||||
```
|
||||
|
||||
## Predefined Operators
|
||||
|
||||
Typst predefines the operators `arccos`, `arcsin`, `arctan`, `arg`, `cos`, `cosh`, `cot`, `coth`, `csc`, `csch`, `ctg`, `deg`, `det`, `dim`, `exp`, `gcd`, `lcm`, `hom`, `id`, `im`, `inf`, `ker`, `lg`, `lim`, `liminf`, `limsup`, `ln`, `log`, `max`, `min`, `mod`, `Pr`, `sec`, `sech`, `sin`, `sinc`, `sinh`, `sup`, `tan`, `tanh`, `tg` and `tr`.
|
||||
|
||||
```typst
|
||||
#math.op(
|
||||
text,
|
||||
limits: bool
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- text:
|
||||
- description: The operator\'s text.
|
||||
- type: content
|
||||
- default: None
|
||||
- limits:
|
||||
- description: Whether the operator should show attachments as limits in display mode.
|
||||
- type: bool
|
||||
- default: false
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# Primes
|
||||
|
||||
# math.primes
|
||||
|
||||
Grouped primes.
|
||||
|
||||
```typst
|
||||
$ a'''_b = a^'''_b $
|
||||
```
|
||||
|
||||
## Syntax
|
||||
|
||||
This function has dedicated syntax: use apostrophes instead of primes. They will automatically attach to the previous element, moving superscripts to the next level.
|
||||
|
||||
```typst
|
||||
#math.primes(
|
||||
count
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- count:
|
||||
- description: The number of grouped primes.
|
||||
- type: int
|
||||
- default: None
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
# Roots
|
||||
|
||||
Square and non-square roots.
|
||||
|
||||
## Example
|
||||
|
||||
```typst
|
||||
$ sqrt(3 - 2 sqrt(2)) = sqrt(2) - 1 $
|
||||
$ root(3, x) $
|
||||
```
|
||||
|
||||
# math.root
|
||||
|
||||
A general root.
|
||||
|
||||
```typst
|
||||
$ root(3, x) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.root(
|
||||
index,
|
||||
radicand
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- index:
|
||||
- description: Which root of the radicand to take.
|
||||
- type: none | content
|
||||
- default: none
|
||||
- radicand:
|
||||
- description: The expression to take the root of.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.sqrt
|
||||
|
||||
A square root.
|
||||
|
||||
```typst
|
||||
$ sqrt(3 - 2 sqrt(2)) = sqrt(2) - 1 $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.sqrt(
|
||||
radicand
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- radicand:
|
||||
- description: The expression to take the square root of.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
# Sizes
|
||||
|
||||
Forced size styles for expressions within formulas.
|
||||
|
||||
These functions allow manual configuration of the size of equation elements to make them look as in a display/inline equation or as if used in a root or sub/superscripts.
|
||||
|
||||
# math.display
|
||||
|
||||
Forced display style in math.
|
||||
|
||||
This is the normal size for block equations.
|
||||
|
||||
```typst
|
||||
$sum_i x_i/2 = display(sum_i x_i/2)$
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.display(
|
||||
body,
|
||||
cramped: bool
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to size.
|
||||
- type: content
|
||||
- default: None
|
||||
- cramped:
|
||||
- description: Whether to impose a height restriction for exponents, like regular sub- and superscripts do.
|
||||
- type: bool
|
||||
- default: false
|
||||
|
||||
# math.inline
|
||||
|
||||
Forced inline (text) style in math.
|
||||
|
||||
This is the normal size for inline equations.
|
||||
|
||||
```typst
|
||||
$ sum_i x_i/2
|
||||
= inline(sum_i x_i/2) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.inline(
|
||||
body,
|
||||
cramped: bool
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to size.
|
||||
- type: content
|
||||
- default: None
|
||||
- cramped:
|
||||
- description: Whether to impose a height restriction for exponents, like regular sub- and superscripts do.
|
||||
- type: bool
|
||||
- default: false
|
||||
|
||||
# math.script
|
||||
|
||||
Forced script style in math.
|
||||
|
||||
This is the smaller size used in powers or sub- or superscripts.
|
||||
|
||||
```typst
|
||||
$sum_i x_i/2 = script(sum_i x_i/2)$
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.script(
|
||||
body,
|
||||
cramped: bool
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to size.
|
||||
- type: content
|
||||
- default: None
|
||||
- cramped:
|
||||
- description: Whether to impose a height restriction for exponents, like regular sub- and superscripts do.
|
||||
- type: bool
|
||||
- default: true
|
||||
|
||||
# math.sscript
|
||||
|
||||
Forced second script style in math.
|
||||
|
||||
This is the smallest size, used in second-level sub- and superscripts (script of the script).
|
||||
|
||||
```typst
|
||||
$sum_i x_i/2 = sscript(sum_i x_i/2)$
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.sscript(
|
||||
body,
|
||||
cramped: bool
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to size.
|
||||
- type: content
|
||||
- default: None
|
||||
- cramped:
|
||||
- description: Whether to impose a height restriction for exponents, like regular sub- and superscripts do.
|
||||
- type: bool
|
||||
- default: true
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
# Stretch
|
||||
|
||||
# math.stretch
|
||||
|
||||
Stretches a glyph.
|
||||
|
||||
This function can also be used to automatically stretch the base of an attachment, so that it fits the top and bottom attachments.
|
||||
|
||||
Note that only some glyphs can be stretched, and which ones can depend on the math font being used. However, most math fonts are the same in this regard.
|
||||
|
||||
```typst
|
||||
$ H stretch(=)^"define" U + p V $
|
||||
$ f : X stretch(->>, size: #150%)_"surjective" Y $
|
||||
$ x stretch(harpoons.ltrb, size: #3em) y
|
||||
stretch(\[, size: #150%) z $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.stretch(
|
||||
body,
|
||||
size: relative
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The glyph to stretch.
|
||||
- type: content
|
||||
- default: None
|
||||
- size:
|
||||
- description: The size to stretch to, relative to the maximum size of the glyph and its attachments.
|
||||
- type: relative
|
||||
- default: 100 % + 0pt
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
# Styles
|
||||
|
||||
Alternate letterforms within formulas.
|
||||
|
||||
These functions are distinct from the [`text`](/docs/reference/text/text/) function because math fonts contain multiple variants of each letter.
|
||||
|
||||
# math.upright
|
||||
|
||||
Upright (non-italic) font style in math.
|
||||
|
||||
```typst
|
||||
$ upright(A) != A $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.upright(
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to style.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.italic
|
||||
|
||||
Italic font style in math.
|
||||
|
||||
For roman letters and greek lowercase letters, this is already the default.
|
||||
|
||||
```typst
|
||||
#math.italic(
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to style.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.bold
|
||||
|
||||
Bold font style in math.
|
||||
|
||||
```typst
|
||||
$ bold(A) := B^+ $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.bold(
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to style.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
|
||||
@@ -0,0 +1,257 @@
|
||||
# Under/Over
|
||||
|
||||
Delimiters above or below parts of an equation.
|
||||
|
||||
The braces and brackets further allow you to add an optional annotation below or above themselves.
|
||||
|
||||
# math.underline
|
||||
|
||||
A horizontal line under content.
|
||||
|
||||
```typst
|
||||
$ underline(1 + 2 + ... + 5) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.underline(
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content above the line.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.overline
|
||||
|
||||
A horizontal line over content.
|
||||
|
||||
```typst
|
||||
$ overline(1 + 2 + ... + 5) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.overline(
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content below the line.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.underbrace
|
||||
|
||||
A horizontal brace under content, with an optional annotation below.
|
||||
|
||||
```typst
|
||||
$ underbrace(0 + 1 + dots.c + n, n + 1 "numbers") $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.underbrace(
|
||||
body,
|
||||
annotation
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content above the brace.
|
||||
- type: content
|
||||
- default: None
|
||||
- annotation:
|
||||
- description: The optional content below the brace.
|
||||
- type: none | content
|
||||
- default: none
|
||||
|
||||
# math.overbrace
|
||||
|
||||
A horizontal brace over content, with an optional annotation above.
|
||||
|
||||
```typst
|
||||
$ overbrace(0 + 1 + dots.c + n, n + 1 "numbers") $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.overbrace(
|
||||
body,
|
||||
annotation
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content below the brace.
|
||||
- type: content
|
||||
- default: None
|
||||
- annotation:
|
||||
- description: The optional content above the brace.
|
||||
- type: none | content
|
||||
- default: none
|
||||
|
||||
# math.underbracket
|
||||
|
||||
A horizontal bracket under content, with an optional annotation below.
|
||||
|
||||
```typst
|
||||
$ underbracket(0 + 1 + dots.c + n, n + 1 "numbers") $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.underbracket(
|
||||
body,
|
||||
annotation
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content above the bracket.
|
||||
- type: content
|
||||
- default: None
|
||||
- annotation:
|
||||
- description: The optional content below the bracket.
|
||||
- type: none | content
|
||||
- default: none
|
||||
|
||||
# math.overbracket
|
||||
|
||||
A horizontal bracket over content, with an optional annotation above.
|
||||
|
||||
```typst
|
||||
$ overbracket(0 + 1 + dots.c + n, n + 1 "numbers") $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.overbracket(
|
||||
body,
|
||||
annotation
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content below the bracket.
|
||||
- type: content
|
||||
- default: None
|
||||
- annotation:
|
||||
- description: The optional content above the bracket.
|
||||
- type: none | content
|
||||
- default: none
|
||||
|
||||
# math.underparen
|
||||
|
||||
A horizontal parenthesis under content, with an optional annotation below.
|
||||
|
||||
```typst
|
||||
$ underparen(0 + 1 + dots.c + n, n + 1 "numbers") $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.underparen(
|
||||
body,
|
||||
annotation
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content above the parenthesis.
|
||||
- type: content
|
||||
- default: None
|
||||
- annotation:
|
||||
- description: The optional content below the parenthesis.
|
||||
- type: none | content
|
||||
- default: none
|
||||
|
||||
# math.overparen
|
||||
|
||||
A horizontal parenthesis over content, with an optional annotation above.
|
||||
|
||||
```typst
|
||||
$ overparen(0 + 1 + dots.c + n, n + 1 "numbers") $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.overparen(
|
||||
body,
|
||||
annotation
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content below the parenthesis.
|
||||
- type: content
|
||||
- default: None
|
||||
- annotation:
|
||||
- description: The optional content above the parenthesis.
|
||||
- type: none | content
|
||||
- default: none
|
||||
|
||||
# math.undershell
|
||||
|
||||
A horizontal tortoise shell bracket under content, with an optional annotation below.
|
||||
|
||||
```typst
|
||||
$ undershell(0 + 1 + dots.c + n, n + 1 "numbers") $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.undershell(
|
||||
body,
|
||||
annotation
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content above the tortoise shell bracket.
|
||||
- type: content
|
||||
- default: None
|
||||
- annotation:
|
||||
- description: The optional content below the tortoise shell bracket.
|
||||
- type: none | content
|
||||
- default: none
|
||||
|
||||
# math.overshell
|
||||
|
||||
A horizontal tortoise shell bracket over content, with an optional annotation above.
|
||||
|
||||
```typst
|
||||
$ overshell(0 + 1 + dots.c + n, n + 1 "numbers") $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.overshell(
|
||||
body,
|
||||
annotation
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content below the tortoise shell bracket.
|
||||
- type: content
|
||||
- default: None
|
||||
- annotation:
|
||||
- description: The optional content above the tortoise shell bracket.
|
||||
- type: none | content
|
||||
- default: none
|
||||
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
# Variants
|
||||
|
||||
Alternate typefaces within formulas.
|
||||
|
||||
These functions are distinct from the [`text`](/docs/reference/text/text/) function because math fonts contain multiple variants of each letter.
|
||||
|
||||
# math.serif
|
||||
|
||||
Serif (roman) font style in math.
|
||||
|
||||
This is already the default.
|
||||
|
||||
```typst
|
||||
#math.serif(
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to style.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.sans
|
||||
|
||||
Sans-serif font style in math.
|
||||
|
||||
```typst
|
||||
$ sans(A B C) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.sans(
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to style.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.frak
|
||||
|
||||
Fraktur font style in math.
|
||||
|
||||
```typst
|
||||
$ frak(P) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.frak(
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to style.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.mono
|
||||
|
||||
Monospace font style in math.
|
||||
|
||||
```typst
|
||||
$ mono(x + y = z) $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.mono(
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to style.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.bb
|
||||
|
||||
Blackboard bold (double-struck) font style in math.
|
||||
|
||||
For uppercase latin letters, blackboard bold is additionally available through [symbols](/docs/reference/symbols/sym/) of the form `NN` and `RR`.
|
||||
|
||||
```typst
|
||||
$ bb(b) $
|
||||
$ bb(N) = NN $
|
||||
$ f: NN -> RR $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.bb(
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to style.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.cal
|
||||
|
||||
Calligraphic (chancery) font style in math.
|
||||
|
||||
```typst
|
||||
Let $cal(P)$ be the set of ...
|
||||
```
|
||||
|
||||
This is the default calligraphic/script style for most math fonts. See [`scr`](/docs/reference/math/variants/#functions-scr) for more on how to get the other style (roundhand).
|
||||
|
||||
```typst
|
||||
#math.cal(
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to style.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
# math.scr
|
||||
|
||||
Script (roundhand) font style in math.
|
||||
|
||||
```typst
|
||||
$scr(L)$ is not the set of linear
|
||||
maps $cal(L)$.
|
||||
```
|
||||
|
||||
There are two ways that fonts can support differentiating `cal` and `scr`. The first is using Unicode variation sequences. This works out of the box in Typst, however only a few math fonts currently support this.
|
||||
|
||||
The other way is using [font features](/docs/reference/text/text/#parameters-features). For example, the roundhand style might be available in a font through the _stylistic set 1_ (`ss01`) feature. To use it in Typst, you could then define your own version of `scr` like in the example below.
|
||||
|
||||
```typst
|
||||
#let scr(it) = text(
|
||||
stylistic-set: 1,
|
||||
$cal(it)$,
|
||||
)
|
||||
|
||||
We establish $cal(P) != scr(P)$.
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.scr(
|
||||
body
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- body:
|
||||
- description: The content to style.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
# Vector
|
||||
|
||||
# math.vec
|
||||
|
||||
A column vector.
|
||||
|
||||
Content in the vector's elements can be aligned with the [`align`](/docs/reference/math/vec/#parameters-align) parameter, or the `&` symbol.
|
||||
|
||||
This function is for typesetting vector components. To typeset a symbol that represents a vector, [`arrow`](/docs/reference/math/accent/) and [`bold`](/docs/reference/math/styles/#functions-bold) are commonly used.
|
||||
|
||||
## Example
|
||||
|
||||
```typst
|
||||
$ vec(a, b, c) dot vec(1, 2, 3)
|
||||
= a + 2b + 3c $
|
||||
```
|
||||
|
||||
```typst
|
||||
#math.vec(
|
||||
delim: none | str | array | symbol,
|
||||
align: alignment,
|
||||
gap: relative,
|
||||
children
|
||||
) -> content
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- delim:
|
||||
- description: The delimiter to use. Can be a single character specifying the left delimiter, in which case the right delimiter is inferred. Otherwise, can be an array containing a left and a right delimiter. ```typst #set math.vec(delim: "[") $ vec(1, 2) $ ```
|
||||
- type: none | str | array | symbol
|
||||
- default: ("(", ")")
|
||||
- align:
|
||||
- description: The horizontal alignment that each element should have. ```typst #set math.vec(align: right) $ vec(-1, 1, -1) $ ```
|
||||
- type: alignment
|
||||
- default: center
|
||||
- gap:
|
||||
- description: The gap between elements. ```typst #set math.vec(gap: 1em) $ vec(1, 2) $ ```
|
||||
- type: relative
|
||||
- default: 0 % + 0.2em
|
||||
- children:
|
||||
- description: The elements of the vector.
|
||||
- type: content
|
||||
- default: None
|
||||
|
||||
|
||||
Reference in new issue
Block a user