Latex
latex是目前比较全面用于将数学,物理,化学公式转换成格式化字符的形式,现在也是各大主流教育类app的主要数据存储形式.
Katex
Katex是基于js实现的渲染Latex代码的库,据称是目前渲染效率最好,性能最优的公式渲染引擎.
MathKit
基于Katex渲染库,并用YYText进行异步排版,完美实现了理科公式非数据化数据的处理以及视图展示.MathKit github链接
MathKit强在哪?
- 强劲的渲染性能
- 非常简单的代码
- 快速集成
- 极少的依赖库
- 一个类,一个属性,一句话解决理科公式渲染
如何使用
#import "MathSubjectView.h"
NSString*str =@"4.这个大家知道是什么吗?请写出答案吧";
MathSubjectView*subject = [[MathSubjectViewalloc]initWithFrame:CGRectMake(10,100,self.view.bounds.size.width-20,0)];
subject.font= [UIFontsystemFontOfSize:12];
subject.testStr= str;
[self.viewaddSubview:subject];
举个例子
链接地址:https://github.com/CodingSha/SPMathKit
GitHub介绍
MathKit
What MathKit can do?
It will render you your math, physics, chemistry or any science formula,Geometric graphics and pictures, as well as general text.
MathKit used by the rendering engine from the current fastest performance of the best JavaScript mathematical formula rendering engine
MathKit the mathematical formula derived from the code is very simple and very easy to store the
Latex code
Based on this, we believe that it will become the most popular science formula and graphics rendering Library
Why you need MathKit?
- Strong rendering performance
- Very simple code
- Fast integration
- Minimal dependency Library
Usage
- Download all the files in the MathKit subdirectory.
- Add the source files to your Xcode project.
- Link with required frameworks:
- CoreText
- UIKit
- SDWebImage
- YYText
- Import
MathSubjectView.h
. - Initialization of an instance object, and give the
testStr
attribute assignment, where the object will be copied to the mixture of arbitrary science formulas and pictures of the string.
Note: Here's the formula in the string need to use a tag similar towrapped up, and the picture will need to use a tag similar to
wrapped up, so as to be recognized - Add the instance object to your view.
If you still do not know how to use it, then download the code to see it, the package has my prepared sample demo.