FLUTTER ECOSYSTEM

djade007/latext

一個使用 flutter_math 庫高效顯示科學 LaTeX 方程式之 Flutter 套件,無需依賴 WebView 或 JavaScript。

latext 專案封面
Stars
36
Forks
16
最近推送(UTC)
2025年5月23日
專案狀態
未封存
Afeez Olajide GitHub avatar
GITHUB User

Afeez Olajide ↗

London, United Kingdom官方網站 ↗
語言DartHTMLSwiftKotlinObjective-C

此儲存庫發佈的套件

使用的依賴

依賴清單 4 項

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

展開 / 收合專案 README

latext

Render scientific LaTeX equations using the LaTexT library.

  • Mathematics / Maths Equations (Algebra, Calculus, Geometry, Geometry etc...)
  • Physics Equations
  • Signal Processing Equations
  • Chemistry Equations
  • Statistics / Stats Equations
  • Inherit text style from parent widgets

LaTeX rendering is done using flutter_math_fork and using RichText.

latext is working on Android, iOS, the Web and the Desktop platform.

What's the difference to flutter_math_fork library?

flutter_math_fork is simply taking any input for Math rendering. We split up into Text and Math parts. You can use a separator (eg. the common "$" or "$$"). Content between these separators is rendered as math while anything outside of these separators is rendered as normal Flutter Text. This makes Text containing only some single formula parts much easier.

Use this package as a library

Add this to your package's pubspec.yaml file:

dependencies:
  latext: ^0.4.1

You can install packages from the command line with Flutter:

flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Now in your Dart code, you can use:

import 'package:latext/latext.dart';

...

// A static LaTeX block which may not change on `setState()`
return LaTexT(laTeXCode: Text("\\alpha", style: Theme.of(context)
                      .textTheme
                      .bodyText1
                      .copyWith(color: Colors.red)))

// A dynamic LaTeX block which is rebuilt on `setState()` (less efficient but required sometimes)
return Builder(builder: (context) => LaTexT(laTeXCode: Text("\\alpha", style: Theme.of(context)
                      .textTheme
                      .bodyText1
                      .copyWith(color: Colors.red))))

This package was adapted from KaTexFlutter.