{"id":1392,"url":"https://github.com/kostub/iosMath","last_synced_at":"2025-08-02T04:31:00.735Z","repository":{"id":8489859,"uuid":"58586655","full_name":"kostub/iosMath","owner":"kostub","description":"Beautiful math equation rendering on iOS and MacOS","archived":false,"fork":false,"pushed_at":"2024-06-16T10:45:00.000Z","size":11994,"stargazers_count":1431,"open_issues_count":102,"forks_count":248,"subscribers_count":42,"default_branch":"master","last_synced_at":"2025-08-01T14:51:41.216Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kostub.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-11T22:22:36.000Z","updated_at":"2025-07-21T03:35:46.000Z","dependencies_parsed_at":"2025-01-02T00:06:47.053Z","dependency_job_id":"ebadd768-7b8f-4b7b-b16a-1a32a3ceca44","html_url":"https://github.com/kostub/iosMath","commit_stats":{"total_commits":203,"total_committers":23,"mean_commits":8.826086956521738,"dds":"0.15270935960591137","last_synced_commit":"90dc42ca71f2d15822ee5762d6dea943d2a31929"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/kostub/iosMath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostub%2FiosMath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostub%2FiosMath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostub%2FiosMath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostub%2FiosMath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kostub","download_url":"https://codeload.github.com/kostub/iosMath/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostub%2FiosMath/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334610,"owners_count":24233793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:15:45.391Z","updated_at":"2025-08-02T04:31:00.308Z","avatar_url":"https://github.com/kostub.png","language":"Objective-C","funding_links":[],"categories":["Math","Objective-C  Stars 1000以内排名整理","Objective-C"],"sub_categories":["Other Hardware","Other free courses"],"readme":"# iosMath\n\n[![Build Status](http://img.shields.io/travis/kostub/iosMath.svg?style=flat)](https://travis-ci.org/kostub/iosMath)\n[![Version](https://img.shields.io/cocoapods/v/iosMath.svg?style=flat)](http://cocoapods.org/pods/iosMath)\n[![License](https://img.shields.io/cocoapods/l/iosMath.svg?style=flat)](http://cocoapods.org/pods/iosMath)\n[![Platform](https://img.shields.io/cocoapods/p/iosMath.svg?style=flat)](http://cocoapods.org/pods/iosMath)\n\n`iosMath` is a library for displaying beautifully rendered math equations\nin iOS and MacOS applications. It typesets formulae written using the LaTeX in\na `UILabel` equivalent class. It uses the same typesetting rules as LaTeX and\nso the equations are rendered exactly as LaTeX would render them.\n\nIt is similar to [MathJax](https://www.mathjax.org) or\n[KaTeX](https://github.com/Khan/KaTeX) for the web but for native iOS or MacOS\napplications without having to use a `UIWebView` and Javascript. More\nimportantly, it is significantly faster than using a `UIWebView`.\n\n## Examples\nHere are screenshots of some formulae that you could render with this\nlibrary:\n\n![Quadratic Formula](img/quadratic.png) \n\n![Calculus](img/calculus.png)\n\n![AM-GM](img/amgm.png)\n\n![Ramanujan Identity](img/ramanujan.png)\n\nThe [EXAMPLES.md](./EXAMPLES.md) file contains more examples.\n \n## Requirements\n`iosMath` works on iOS 6+ or MacOS 10.8+ and requires ARC to build. It depends\non the following Apple frameworks:\n\n* Foundation.framework\n* CoreGraphics.framework\n* QuartzCore.framework\n* CoreText.framework\n\nAdditionally for iOS it requires:\n* UIKit.framework\n\nAdditionally for MacOS it requires:\n* AppKit.framework\n\n## Installation\n\n### Cocoapods\n\niosMath is available through [CocoaPods](http://cocoapods.org). To install\nit:\n\n1. Add a entry for iosMath to your Podfile: `pod 'iosMath'`.\n2. Install the pod by running `pod install`.\n\n### Static library\n\nYou can also add iosMath as a static library to your project or\nworkspace.\n\n1. Download the [latest code version](https://github.com/kostub/iosMath/downloads) or add the\nrepository as a git submodule to your git-tracked project.\n2. Open your project in Xcode, then drag and drop\n   `iosMath.xcodeproj` onto your project or workspace (use the\n\"Product Navigator view\").\n3. Select your target and go to the Build phases tab. In the Link Binary\n   With Libraries section select the add button. On the sheet find and\nadd `libIosMath.a`. You might also need to add `iosMath` to\nthe Target Dependencies list.\n4. Add the `MathFontBundle` to the list of `Copy Bundle Resources`.\n5. Include IosMath wherever you need it with `#import \u003cIosMath/IosMath.h\u003e`.\n\n## Usage\n\nThe library provides a class `MTMathUILabel` which is a `UIView` that\nsupports rendering math equations. To display an equation simply create\nan `MTMathUILabel` as follows:\n\n```objective-c\n#import \"MTMathUILabel.h\"\n\nMTMathUILabel* label = [[MTMathUILabel alloc] init];\nlabel.latex = @\"x = \\\\frac{-b \\\\pm \\\\sqrt{b^2-4ac}}{2a}\";\n\n```\nAdding `MTMathUILabel` as a sub-view of your `UIView` as will render the\nquadratic formula example shown above.\n\n### Included Features\nThis is a list of formula types that the library currently supports:\n\n* Simple algebraic equations\n* Fractions and continued fractions\n* Exponents and subscripts\n* Trigonometric formulae\n* Square roots and n-th roots\n* Calculus symbos - limits, derivatives, integrals\n* Big operators (e.g. product, sum)\n* Big delimiters (using \\\\left and \\\\right)\n* Greek alphabet\n* Combinatorics (\\\\binom, \\\\choose etc.)\n* Geometry symbols (e.g. angle, congruence etc.)\n* Ratios, proportions, percents\n* Math spacing\n* Overline and underline\n* Math accents\n* Matrices\n* Equation alignment\n* Change bold, roman, caligraphic and other font styles (\\\\bf, \\\\text, etc.)\n* Most commonly used math symbols\n* Colors\n\n### Example\n\nThere is a sample app included in this project that shows how to use the\napp and the different equations that you can render. To run the sample\napp, clone the repository, and run `pod install` first. Then on iOS run the\n__iosMathExample__ app. For MacOS run the __MacOSMath__ app.\n\n### Advanced configuration\n\n`MTMathUILabel` supports some advanced configuration options:\n\n##### Math mode\n\nYou can change the mode of the `MTMathUILabel` between Display Mode\n(equivalent to `$$` or `\\[` in LaTeX) and Text Mode (equivalent to `$`\nor `\\(` in LaTeX). The default style is Display. To switch to Text\nsimply:\n\n```objective-c\nlabel.labelMode = kMTMathUILabelModeText;\n```\n\n##### Text Alignment\nThe default alignment of the equations is left. This can be changed to\ncenter or right as follows:\n\n```objective-c\nlabel.textAlignment = kMTTextAlignmentCenter;\n```\n\n##### Font size\nThe default font-size is 20pt. You can change it as follows:\n\n```objective-c\nlabel.fontSize = 30;\n```\n##### Font\nThe default font is *Latin Modern Math*. This can be changed as:\n\n```objective-c\nlabel.font = [[MTFontManager fontManager] termesFontWithSize:20];\n```\n\nThis project has 3 fonts bundled with it, but you can use any OTF math\nfont.\n\n##### Color\nThe default color of the rendered equation is black. You can change\nit to any other color as follows:\n\n```objective-c\nlabel.textColor = [UIColor redColor];\n```\n\nIt is also possible to set different colors for different parts of the\nequation. Just access the `displayList` field and set the `textColor`\non the underlying displays that you want to change the color of. \n\n##### Custom Commands\nYou can define your own commands that are not already predefined. This is\nsimilar to macros is LaTeX. To define your own command use:\n\n```objective-c\n[MTMathAtomFactory addLatexSymbol:@\"lcm\"\n                            value:[MTMathAtomFactory operatorWithName:@\"lcm\" limits:NO]];\n```\n\nThis creates a `\\lcm` command that can be used in the LaTeX.\n\n##### Content Insets\nThe `MTMathUILabel` has `contentInsets` for finer control of placement of the\nequation in relation to the view.\n\nIf you need to set it you can do as follows:\n\n```objective-c\nlabel.contentInsets = UIEdgeInsetsMake(0, 10, 0, 20);\n```\n\n##### Error handling\n\nIf the LaTeX text given to `MTMathUILabel` is\ninvalid or if it contains commands that aren't currently supported then\nan error message will be displayed instead of the label.\n\nThis error can be programmatically retrieved as `label.error`. If you\nprefer not to display anything then set:\n\n```objective-c\nlabel.displayErrorInline = NO;\n```\n\n## Future Enhancements\n\nNote this is not a complete implementation of LaTeX math mode. There are\nsome important pieces that are missing and will be included in future\nupdates. This includes:\n\n* Support for explicit big delimiters (bigl, bigr etc.)\n* Addition of missing plain TeX commands \n\n## Related Projects\n\nFor people looking for things beyond just rendering math, there are two\nrelated projects:\n\n* [MathEditor](https://github.com/kostub/MathEditor): A WYSIWYG editor\n  for math equations on iOS.\n* [MathSolver](https://github.com/kostub/MathSolver): A library for\n  solving math equations.\n\n## License\n\niosMath is available under the MIT license. See the [LICENSE](./LICENSE)\nfile for more info.\n\n### Fonts\nThis distribution contains the following fonts. These fonts are\nlicensed as follows:\n* Latin Modern Math: \n    [GUST Font License](./fonts/GUST-FONT-LICENSE.txt)\n* Tex Gyre Termes:\n    [GUST Font License](./fonts/GUST-FONT-LICENSE.txt)\n* [XITS Math](https://github.com/khaledhosny/xits-math):\n    [Open Font License](./fonts/OFL.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkostub%2FiosMath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkostub%2FiosMath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkostub%2FiosMath/lists"}