A UIView that renders TeX expressions with KaTeX.
Branch: master
Clone or download
ianarawjo Update README.md
Swapped bold titles for h3.
Latest commit 8e038bf Oct 15, 2014
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example/KaTeX-Example
katex Delete .DS_Store Oct 13, 2014
LICENSE
README.md Update README.md Oct 15, 2014
UIKatexView.h Added framewidth constructor to UIKatexView. Oct 13, 2014
UIKatexView.m Added framewidth constructor to UIKatexView. Oct 13, 2014

README.md

KaTeX-iOS

A UIView that renders TeX expressions with KaTeX.

###Adding:

  1. Copy UIKatexView.m and .h into your project.
  2. Copy "katex" folder into your project directory (or wherever you want the library). Then drag the folder into XCode, making sure to set "Copy Folder References for Any Added Folders" and uncheck "Copy items into..." (f you've copied the folder)
  3. See example project's ViewController.m for usage examples.

###Usage:

Initialize using [UIKatexView katexView:tex center:cgpoint]. TeX expressions can be either:

  • Pure expression (no $ signs!)
  • Mixture of expression and text (HTML). Wrap a math expression in $ signs.
  • You can also set a custom delimiter in place of the $ sign, using katexView:center:delimiter:. Check the other constructors in UIKatexView.h for more details.

###Example text (NSStrings):

  • I heard that $c = \\sqrt{a^2 - b^2}$ but I don't believe it.
  • What is $n$ if $n \\cdot 4$ gives $8$?
  • Remember that $\\displaystyle \\sum_{i=0}^n{i} = \\frac{(n)(n+1)}{2}$. Plugging in...
  • \\displaystyle f(x) = \\int_{-\\infty}^\\infty \\hat f(\\xi)\\,e^{2 \\pi i \\xi x} \\,d\\xi

Remember that '' character has to be escaped when used in an NSString.

####Credits:

KaTeX (http://khan.github.io/KaTeX/)

UIKatexView by Ian Arawjo.