搜尋套件、儲存庫與 APP 分類

套件詳情v0.3.4

flutter_markdown_latex

一個用於 flutter_markdown 套件的擴展,可呈現 Markdown 中的 LaTeX。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
5330
喜歡數
33
Pub 分數
150

安裝套件

flutter pub add flutter_markdown_latex

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個擴展 flutter_markdown 的 Flutter 套件,支援在 Markdown 文字中呈現 LaTeX 表達式。它能無縫整合數學符號與公式至豐富文字內容中,非常適合教育應用程式、文件或技術部落格。此套件利用現有的 Flutter Markdown 渲染功能,透過相容的後端新增 LaTeX 解析與顯示功能。可在所有主要平台(包含行動裝置、網頁與桌面)上運作。

適用情境

  • 在應用程式文件中渲染數學方程式
  • 建立包含數學內容的教育類應用程式
  • 在基於 Markdown 的文章中顯示科學公式
  • 將 LaTeX 集成到 Flutter 支援的部落格中
  • 使用複雜符號支援技術寫作

主要特色

  • 擴展 flutter_markdown 以支援 LaTeX
  • 跨平台相容性
  • 透過 pub add 的簡單整合
  • 支援內聯與區塊式 LaTeX
  • 使用標準 LaTeX 語法

適合對象

  • 教育類應用開發者
  • 使用 Markdown 的技術撰寫者
  • STEM內容創作者
  • 需要數學渲染的Flutter應用
  • 以文件為導向的專案

使用建議

  • LaTeX 渲染需要額外的依賴項
  • 效能可能會因複雜公式而異
  • 僅限支援的 LaTeX 子集
  • 可能需要為渲染的數學公式自定義樣式
  • 不適用於即時編輯

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Flutter Markdown Latex

Coverage Status Pub Version

This extension is created to enhance the functionality of the flutter_markdown package by adding support for rendering LaTeX in markdown. The rendering of LaTeX is achieved through the utilization of the flutter_math_fork package.

Rendering Samples

This is inline latex: $f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x}$

This is block level latex:

$$
c = \pm\sqrt{a^2 + b^2}
$$

This is inline latex with displayMode: $$f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x}$$

The relationship between the height and the side length of an equilateral triangle is:

\[ \text{Height} = \frac{\sqrt{3}}{2} \times \text{Side Length} \]

\[ \text{X} = \frac{1}{2} \times \text{Y} \times \text{Z} = \frac{1}{2} \times 9 \times \frac{\sqrt{3}}{2} \times 9 = \frac{81\sqrt{3}}{4} \]

The basic form of the Taylor series is:

\[f(x) = f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \frac{f'''(a)}{3!}(x-a)^3 + \cdots\]

where \(f(x)\) is the function to be expanded, \(a\) is the expansion point, \(f'(a)\), \(f''(a)\), \(f'''(a)\), etc., are the first, second, third, and so on derivatives of the function at point \(a\), and \(n!\) denotes the factorial of \(n\).

In particular, when \(a=0\), this expansion is called the Maclaurin series.

Example

Getting Started

Add dependency

Add flutter_markdown_latex to your pubspec.yaml dependencies.

Import it
import 'package:flutter_markdown_latex/flutter_markdown_latex.dart';
Render it
// with default text style
MarkdownBody(
  selectable: true,
  data: 'latex: \$c = \\pm\\sqrt{a^2 + b^2}\$',
  builders: {
    'latex': LatexElementBuilder(),
  },
  extensionSet: md.ExtensionSet(
    [LatexBlockSyntax()],
    [LatexInlineSyntax()],
  ),
),

// with custom text style
MarkdownBody(
  selectable: true,
  data: 'latex: \$c = \\pm\\sqrt{a^2 + b^2}\$',
  builders: {
    'latex': LatexElementBuilder(
      textStyle: const TextStyle(color: Colors.blue),
      textScaleFactor: 1.2,
    ),
  },
  extensionSet: md.ExtensionSet(
    [LatexBlockSyntax()],
    [LatexInlineSyntax()],
  ),
),

所屬分類

依賴

依賴清單 3 項

原始碼儲存庫

使用此套件的專案