/MathEditor

An editor for math equations for iOS

Primary LanguageObjective-CMIT LicenseMIT

MathEditor

CI Status Version License Platform

MathEditor is a WYSIWYG editor for math formulas on iOS. It provides a UIView which edits math while it is being rendered. For rendering math it uses the iosMath library to get LaTeX style typesetting.

A math keyboard is included with the editor. However you can supply your own keyboard or use the system default keyboard as well. The math keyboard is optimized to easily enter certain components like fractions, exponents and square roots.

Example

There is a sample app included in this project that shows how to use the math editor as well as code for automatically resizing the editor as the text in it changes. To run the same app, clone the repository, and run pod install from the Example directory first. Then run the MathEditor_Example app.

Requirements

MathEditor works on iOS 8+ and requires ARC to build. It depends on the following Cocoapod:

Additionaly, it depends on the following Apple frameworks:

  • Foundation.framework
  • UIKit.framework

Installation

MathEditor is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MathEditor"

Usage

The library provides a class MTEditableMathLabel which is a UIView that supports editing math equations. Simply add it to your storyboard or create it programmatically.

#import "MTEditableMathLabel.h"

MTEditableMathLabel* label = [[MTEditableMathLabel alloc] initWithFrame:...]
label.delegate = self;

Keyboard

To use the provided keyboard, set:

label.keyboard = [MTMathKeyboardRootView sharedInstance];

You can set any keyboard you want to use. A keyboard needs to be a UIView and implement the MTMathKeyboard interface.

To use the default system keyboard, set keyboard = nil. (This is the default.)

License

MathEditor is available under the MIT license. See the LICENSE file for more info.