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
@@ -186,24 +189,26 @@ The default starting number is `1`, but if you need to start at a different valu
186
189
187
190
To change the left or right offset of the equation number, use the `equationNumberOffset` modifier.
188
191
189
-
```swift
190
-
// Don't number block equations (default)
191
-
LaTeX("$$a + b = c$$")
192
-
.equationNumberMode(.none)
192
+
##### Format Equation Number
193
+
194
+
You can set a closure on the view to do your own custom formatting. The `formatEquationNumber` modifier takes a closure that is passed the equation number and returns a string.
193
195
194
-
// Add left numbers and a leading offset
195
-
LaTeX("$$d + e = f$$")
196
-
.equationNumberMode(.left)
196
+
```swift
197
+
LaTeX("$$E = mc^2$$")
198
+
.equationNumberMode(.right)
197
199
.equationNumberOffset(10)
200
+
.padding([.bottom])
198
201
199
-
// Add right numbers, a leading offset, and start at 2
|`empty`| Yes | The view remains empty until its finished rendering. |
235
+
|`original`| Yes | The view displays the input text until its finished rendering. |
236
+
|`progress`| Yes | The view displays a progress view until its finished rendering. |
237
+
|`wait`| No |*(default)* The view blocks the main queue until its finished rendering. |
238
+
239
+
The `wait` style is the default style, and loads the view synchronously on the main queue. To get better performance and move SVG rendering off of the main queue, use any of the other three styles.
240
+
241
+
#### 🪩 Animated
242
+
243
+
The `animated` modifier applies to the view when using the asynchronous rendering styles `empty`, `original`, or `progress`.
244
+
245
+
```swift
246
+
LaTeX(input)
247
+
.renderingStyle(.original)
248
+
.animated()
249
+
```
250
+
251
+
> In the above example, the input text will be displayed until the SVGs have been rendered at which point the rendered views will animate in to view.
252
+
223
253
### 🗄️ Caching
224
254
225
255
`LaTeXSwiftUI` caches its SVG responses from MathJax and the images rendered as a result of the view's environment. If you want to control the cache, then you can access the static `dataCache` and `imageCache` properties.
0 commit comments