Search packages, repositories and app categories

Package detailsv0.3.4

flutter_markdown_latex

A extension to render LaTeX in markdown for package flutter_markdown.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
5.3K
Likes
33
Pub points
150

Install package

flutter pub add flutter_markdown_latex

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter package that extends flutter_markdown to support rendering LaTeX expressions within Markdown text. It enables seamless integration of mathematical notation and formulas in rich text content, making it ideal for educational apps, documentation, or technical blogs. The package leverages existing Flutter Markdown rendering while adding LaTeX parsing and display capabilities through compatible backends. It works across all major platforms including mobile, web, and desktop.

Use cases

  • Rendering math equations in app documentation
  • Creating educational apps with mathematical content
  • Displaying scientific formulas in markdown-based articles
  • Integrating LaTeX into Flutter-powered blogs
  • Supporting technical writing with complex notation

Key features

  • Extends flutter_markdown with LaTeX support
  • Cross-platform compatibility
  • Simple integration via pub add
  • Supports inline and block LaTeX
  • Uses standard LaTeX syntax

Suitable for

  • Educational app developers
  • Technical writers using Markdown
  • STEM content creators
  • Flutter apps requiring math rendering
  • Documentation-focused projects

Considerations

  • Requires additional dependencies for LaTeX rendering
  • Performance may vary with complex formulas
  • Limited to supported LaTeX subsets
  • May need custom styling for rendered math
  • Not suitable for real-time editing

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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()],
  ),
),

Categories

Dependencies

Dependency list 3 items

Source repository

Projects using this package