typst_library/math/
underover.rs

1use crate::foundations::{elem, Content};
2use crate::math::Mathy;
3
4/// A horizontal line under content.
5///
6/// ```example
7/// $ underline(1 + 2 + ... + 5) $
8/// ```
9#[elem(Mathy)]
10pub struct UnderlineElem {
11    /// The content above the line.
12    #[required]
13    pub body: Content,
14}
15
16/// A horizontal line over content.
17///
18/// ```example
19/// $ overline(1 + 2 + ... + 5) $
20/// ```
21#[elem(Mathy)]
22pub struct OverlineElem {
23    /// The content below the line.
24    #[required]
25    pub body: Content,
26}
27
28/// A horizontal brace under content, with an optional annotation below.
29///
30/// ```example
31/// $ underbrace(1 + 2 + ... + 5, "numbers") $
32/// ```
33#[elem(Mathy)]
34pub struct UnderbraceElem {
35    /// The content above the brace.
36    #[required]
37    pub body: Content,
38
39    /// The optional content below the brace.
40    #[positional]
41    pub annotation: Option<Content>,
42}
43
44/// A horizontal brace over content, with an optional annotation above.
45///
46/// ```example
47/// $ overbrace(1 + 2 + ... + 5, "numbers") $
48/// ```
49#[elem(Mathy)]
50pub struct OverbraceElem {
51    /// The content below the brace.
52    #[required]
53    pub body: Content,
54
55    /// The optional content above the brace.
56    #[positional]
57    pub annotation: Option<Content>,
58}
59
60/// A horizontal bracket under content, with an optional annotation below.
61///
62/// ```example
63/// $ underbracket(1 + 2 + ... + 5, "numbers") $
64/// ```
65#[elem(Mathy)]
66pub struct UnderbracketElem {
67    /// The content above the bracket.
68    #[required]
69    pub body: Content,
70
71    /// The optional content below the bracket.
72    #[positional]
73    pub annotation: Option<Content>,
74}
75
76/// A horizontal bracket over content, with an optional annotation above.
77///
78/// ```example
79/// $ overbracket(1 + 2 + ... + 5, "numbers") $
80/// ```
81#[elem(Mathy)]
82pub struct OverbracketElem {
83    /// The content below the bracket.
84    #[required]
85    pub body: Content,
86
87    /// The optional content above the bracket.
88    #[positional]
89    pub annotation: Option<Content>,
90}
91
92/// A horizontal parenthesis under content, with an optional annotation below.
93///
94/// ```example
95/// $ underparen(1 + 2 + ... + 5, "numbers") $
96/// ```
97#[elem(Mathy)]
98pub struct UnderparenElem {
99    /// The content above the parenthesis.
100    #[required]
101    pub body: Content,
102
103    /// The optional content below the parenthesis.
104    #[positional]
105    pub annotation: Option<Content>,
106}
107
108/// A horizontal parenthesis over content, with an optional annotation above.
109///
110/// ```example
111/// $ overparen(1 + 2 + ... + 5, "numbers") $
112/// ```
113#[elem(Mathy)]
114pub struct OverparenElem {
115    /// The content below the parenthesis.
116    #[required]
117    pub body: Content,
118
119    /// The optional content above the parenthesis.
120    #[positional]
121    pub annotation: Option<Content>,
122}
123
124/// A horizontal tortoise shell bracket under content, with an optional
125/// annotation below.
126///
127/// ```example
128/// $ undershell(1 + 2 + ... + 5, "numbers") $
129/// ```
130#[elem(Mathy)]
131pub struct UndershellElem {
132    /// The content above the tortoise shell bracket.
133    #[required]
134    pub body: Content,
135
136    /// The optional content below the tortoise shell bracket.
137    #[positional]
138    pub annotation: Option<Content>,
139}
140
141/// A horizontal tortoise shell bracket over content, with an optional
142/// annotation above.
143///
144/// ```example
145/// $ overshell(1 + 2 + ... + 5, "numbers") $
146/// ```
147#[elem(Mathy)]
148pub struct OvershellElem {
149    /// The content below the tortoise shell bracket.
150    #[required]
151    pub body: Content,
152
153    /// The optional content above the tortoise shell bracket.
154    #[positional]
155    pub annotation: Option<Content>,
156}