在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):NanoMichael/AndroidLaTeXMath开源软件地址(OpenSource Url):https://github.com/NanoMichael/AndroidLaTeXMath开源编程语言(OpenSource Language):Java 57.9%开源软件介绍(OpenSource Introduction):Library for displaying LaTeX formulas on Android. It use cLaTeXMath to parse and render LaTeX code. The picture below demonstrate the demo application. InstallationLibrary is available in jcenter repository, add this script to your build.gradle file to install: implementation 'io.nano:android-tex:1.0.0' ProGuardAdd the following rule to your proguard config file:
How to useFirst, initialize the library: // ... code inside an Activity or Application
@override
public void onCreate() {
// ... some other code
// Initialize the LaTeX engine. Call of this function will copy the
// "TeX resources" from apk into the data files directory of the
// host application, and parse the "TeX resources", it may takes a
// long time, you may call it from a background thread.
if (!LaTeX.isInitialized()) {
LaTeX.instance().init(getApplicationContext());
}
} Then, parse the given LaTeX code: String code = "\\int_{now}^{\\infty} \\text{Keep trying}";
TeXRender r = LaTeX.instance().parse(
code, // LaTeX code to parse
720, // logical width of the graphics context (in pixel)
20, // font size
10, // space between 2 lines (in pixel)
Color.DKGRAY // foreground color
); Last, just draw it: @override
protected void onDraw(Canvas canvas) {
Graphics2D g2 = new Graphics2D();
g2.setCanvas(canvas);
// draw the formula on the coordinate (10, 10)
r.draw(g2, 10, 10);
} Very simple. For more details, please check out the demo app of this project. Build by yourselfFirst make sure you have a NDK that the version must be
Update the latest git submodule init --recursive
git submodule update --remote Now everything is OK, just build it. LicenseThis project is under the Apache-2.0
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论