iOSLaTeX
iOSLaTeX provides a LaTeXRenderer which loads a minified version of MathJax in a WkWebView to render LaTeX into native UIImage objects.
Usage
LaTeXImageView is a subclass of UIImageView
which uses a LaTeXRenderer
object instance to render LaTeX text. It can be added programatically or through the Storyboard. Simply set the latex
property on the object and it will handle the rest. You can also use render(_ laTeX:, completion:)
.
LaTeXRenderer provides an easy to use render(_ laTeX:, completion:)
function which can be used to render LaTeX. Note that LaTeXRenderer needs to be initialized with a parent view present in the view hierarchy else LaTeX rendering will be slow or timeout.
If you have multiple LaTeXImageView
objects in one controller (e.g. in a table view), you can declare a global LaTeXRenderer
for that controller and inject it into the LaTeXImageView
objects.
See example project for example code
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Installation
iOSLaTeX is available through CocoaPods. To install it, simply add the following line to your Podfile:
Swift 3
pod 'iOSLaTeX', '~> 0.2'
Swift 4
pod 'iOSLaTeX', '~> 0.3'
Author
shujew, [email protected]
License
iOSLaTeX is available under the MIT license. See the LICENSE file for more info.