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
Copy file name to clipboardExpand all lines: README.md
+11-5Lines changed: 11 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,19 +21,20 @@ A SwiftUI view that renders LaTeX equations.
21
21
-[Equation Number Start](#equation-number-start)
22
22
-[Equation Number Offset](#equation-number-offset)
23
23
-[Unencode HTML](#🔗-unencode-html)
24
-
-[TeX Options](#♾️-tex-options(deprecated))
25
24
-[Caching](#🗄️-caching)
26
25
-[Preloading](#🏃♀️-preloading)
27
26
28
27
## ℹ️ About
29
28
30
-
`LaTexSwiftUI` is a package that exposes a view named `LaTeX` that can parse and render TeX and LaTeX equations that contain math-mode marcos.
29
+
`LaTexSwiftUI` is a package that exposes a view named `LaTeX` that can parse and render TeX and LaTeX equations which contain math-mode marcos.
31
30
32
31
The view utilizes the [MathJaxSwift](https://www.github.com/colinc86/MathJaxSwift) package to render equations with [MathJax](https://www.mathjax.org). Thus, the limitations of the view are heavily influenced by the [limitations](https://docs.mathjax.org/en/v2.7-latest/tex.html#differences) of MathJax.
33
32
34
33
It will
35
34
- render TeX and LaTeX equations (math-mode macros),
36
-
- and render the `\text{}` macro within equations.
35
+
- render the `\text{}` macro within equations,
36
+
- attempt to render block equations as a Tex or LaTeX engine would,
37
+
- and number block equations (if desired).
37
38
38
39
It won't
39
40
- render TeX and LaTeX documents (text-mode macros, with the exception of the rule above).
SVGs and images are rendered and cached on demand, but there may be situations where you want to preload the data so that there is minimal lag when the view appears.
250
251
252
+
SVGs and images are rendered as a result of the view's environment, so it is important to call the `preload` method last in the view's modifier chain if you use it.
253
+
251
254
```swift
252
255
VStack {
253
256
ForEach(expressions, id: \.self) { expression in
254
257
LaTeX(expression)
258
+
.font(.caption2)
259
+
.foregroundColor(.green)
260
+
.unencoded()
261
+
.errorMode(.error)
262
+
.processEscapes()
255
263
.preload()
256
264
}
257
265
}
258
266
```
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