You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an error occurs while parsing the input the view will display the original LaTeX. You can change this behavior by modifying the view's `errorMode`.
123
127
128
+
> Note: when the `rendered` mode is used, MathJax is instructed to load the `noerrors` and `noundefined` packages. In the other two modes, `original` and `error`, these packages are not loaded by MathJax and errors are either displayed in the view, or caught and replaced with the original text.
129
+
124
130
```swift
125
131
// Display the original text instead of the equation
126
132
LaTeX("$\\asdf$")
@@ -163,6 +169,41 @@ LaTeX("The quadratic formula is $$x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}$$ and it h
The `LaTeX` view can do simple numbering of block equations with the `blockViews` block mode.
175
+
176
+
##### Equation Number Mode
177
+
178
+
Use the `equationNumberMode` modifier to change between `left`, `right` and `none`.
179
+
180
+
##### Equation Number Start
181
+
182
+
The default starting number is `1`, but if you need to start at a different value, you can specify it with the `equationNumberStart` modifier.
183
+
184
+
##### Equation Number Offset
185
+
186
+
To change the left or right offset of the equation number, use the `equationNumberOffset` modifier.
187
+
188
+
```swift
189
+
// Don't number block equations (default)
190
+
LaTeX("$$a + b = c$$")
191
+
.equationNumberMode(.none)
192
+
193
+
// Add left numbers and a leading offset
194
+
LaTeX("$$d + e = f$$")
195
+
.equationNumberMode(.left)
196
+
.equationNumberOffset(10)
197
+
198
+
// Add right numbers, a leading offset, and start at 2
199
+
LaTeX("$$h + i = j$$ $$k + l = m$$")
200
+
.equationNumberMode(.right)
201
+
.equationNumberStart(2)
202
+
.equationNumberOffset(20)
203
+
```
204
+
205
+
> <imgsrc="./assets/images/numbers.png">
206
+
166
207
#### 🔗 Unencode HTML
167
208
168
209
Input may contain HTML entities such as `<` which will not be parsed by LaTeX as anything meaningful. In this case, you may use the `unencoded` modifier.
For more control over the MathJax rendering, you can pass a `TeXInputProcessorOptions` object to the view.
184
225
@@ -215,3 +256,5 @@ VStack {
215
256
}
216
257
}
217
258
```
259
+
260
+
Keep in mind that SVG data and images are rendered as a result of the view's environment, so it is important to call the `preload` method using the same values that will be used when drawing the view.
0 commit comments