开源软件名称(OpenSource Name):kostub/iosMath开源软件地址(OpenSource Url):https://github.com/kostub/iosMath开源编程语言(OpenSource Language):Objective-C 97.9%开源软件介绍(OpenSource Introduction):iosMath
It is similar to MathJax or
KaTeX for the web but for native iOS or MacOS
applications without having to use a ExamplesHere are screenshots of some formulae that you could render with this library: The EXAMPLES.md file contains more examples. Requirements
Additionally for iOS it requires:
Additionally for MacOS it requires:
InstallationCocoapodsiosMath is available through CocoaPods. To install it:
Static libraryYou can also add iosMath as a static library to your project or workspace.
UsageThe library provides a class #import "MTMathUILabel.h"
MTMathUILabel* label = [[MTMathUILabel alloc] init];
label.latex = @"x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}";
Adding Included FeaturesThis is a list of formula types that the library currently supports:
ExampleThere is a sample app included in this project that shows how to use the
app and the different equations that you can render. To run the sample
app, clone the repository, and run Advanced configuration
Math modeYou can change the mode of the label.labelMode = kMTMathUILabelModeText; Text AlignmentThe default alignment of the equations is left. This can be changed to center or right as follows: label.textAlignment = kMTTextAlignmentCenter; Font sizeThe default font-size is 20pt. You can change it as follows: label.fontSize = 30; FontThe default font is Latin Modern Math. This can be changed as: label.font = [[MTFontManager fontManager] termesFontWithSize:20]; This project has 3 fonts bundled with it, but you can use any OTF math font. ColorThe default color of the rendered equation is black. You can change it to any other color as follows: label.textColor = [UIColor redColor]; It is also possible to set different colors for different parts of the
equation. Just access the Custom CommandsYou can define your own commands that are not already predefined. This is similar to macros is LaTeX. To define your own command use: [MTMathAtomFactory addLatexSymbol:@"lcm"
value:[MTMathAtomFactory operatorWithName:@"lcm" limits:NO]]; This creates a Content InsetsThe If you need to set it you can do as follows: label.contentInsets = UIEdgeInsetsMake(0, 10, 0, 20); Error handlingIf the LaTeX text given to This error can be programmatically retrieved as label.displayErrorInline = NO; Future EnhancementsNote this is not a complete implementation of LaTeX math mode. There are some important pieces that are missing and will be included in future updates. This includes:
Related ProjectsFor people looking for things beyond just rendering math, there are two related projects:
LicenseiosMath is available under the MIT license. See the LICENSE file for more info. FontsThis distribution contains the following fonts. These fonts are licensed as follows:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论