Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
iced_math
Native LaTeX math widget for Iced 0.14. Pure Rust, zero JavaScript runtime.
Status
Pre-1.0 — API may change. v0.3 supports a Tier 1 LaTeX subset (~60 commands), including matrices, named operators, and accents.
Installation
[]
= "0.3"
# iced_math renders through iced's `svg` widget, so your iced dependency must
# enable a renderer (`wgpu` and/or `tiny-skia`) plus the `svg` feature.
= { = "0.14", = ["wgpu", "tiny-skia", "svg"] }
Quickstart
inline and block are generic over Message, Theme, and Renderer. The
compiler infers those from the surrounding Element type, so bind each call to a
typed Element (or annotate the let) — a bare call inside column![ … ] has
nothing to infer from and will fail with a "type annotations needed" error.
use column;
use Element;
If you can't bind to a typed Element, use the turbofish instead:
A full runnable demo lives in examples/viewer.rs (the example enables iced's
wgpu/tiny-skia renderer as a dev-dependency):
Without Iced (raw SVG)
The MathRenderer builder produces standalone SVG bytes — useful for docs,
export tools, server rendering, or tests — with no Iced dependency at the call site:
let svg: = new
.font_size
.display_style
.color
.to_svg
.expect;
write.unwrap;
Stable API
For the 0.x series the supported public API is: inline, block,
MathRenderer, Color, and Error. Everything else is internal and may change
between minor versions.
Supported LaTeX (v0.3)
- Atoms: letters, digits, basic operators (
+,−,×,÷,=,<,>,≤,≥) - Greek:
\alpha…\omega,\Gamma…\Omega - Super/subscripts:
x^2,a_i,x^{n+1},a_i^j - Fractions:
\frac{a}{b}(and\dfrac,\tfrac) - Square roots:
\sqrt{x},\sqrt[n]{x} - Large operators with limits:
\sum,\int,\prod(display style places limits above/below) - Named operators:
\sin,\cos,\log, … (upright, tight-set) and limit operators\lim,\max,\min,\sup,\inf, … (subscript stacks underneath in display style) - Accents:
\hat,\bar,\vec,\tilde,\dot,\ddot,\check,\breve,\acute,\grave(centered over the body) - Matrices:
matrix,pmatrix,bmatrix,vmatrix,Bmatrix,Vmatrix, pluscases,aligned, andarray(per-column alignment, axis-centered) - Binomials:
\binom{n}{k}(ruleless stack in parentheses; also\dbinom,\tbinom) - Math alphabets:
\mathbb,\mathcal,\mathfrak,\mathbf,\mathsf,\mathtt,\mathit(Unicode math-alphanumeric remapping; characters without a styled glyph fall back to the plain form) - Delimiters:
\left( … \right),\left[ … \right]with auto-sizing variants
Not yet supported (deferred to later releases)
Roughly ordered by planned priority:
- Multi-line display environments (
align,gather,multline) and\hline/column separators inarray GlyphAssemblyfor extra-tall delimiters —\left( … \right)won't grow past the largest single glyph- Unary vs. binary
-/+disambiguation — a leading unary minus gets binary spacing - Sizing modes (
\scriptstyle,\displaystyleoverrides)
How it works
LaTeX source
↓ pulldown-latex
event stream
↓ parse::to_ir
IR (Node tree)
↓ boxer::layout
positioned Box tree (TeX-style boxes via OpenType MATH table)
↓ svg::emit
SVG bytes
↓ iced::widget::svg
Element<Message, Theme, Renderer>
Font: bundled Latin Modern Math (GFL license).
Error handling
Parse failures render the source as red monospace text — never panic, always render something.
License
Code: MIT OR Apache-2.0. Font: GUST Font License (see assets/FONT-LICENSE.txt).