{"id":35731756,"url":"https://github.com/huarangmeng/latex","last_synced_at":"2026-04-14T11:01:01.560Z","repository":{"id":332412260,"uuid":"1126649323","full_name":"huarangmeng/latex","owner":"huarangmeng","description":"Compose Latex","archived":false,"fork":false,"pushed_at":"2026-04-13T08:21:13.000Z","size":2717,"stargazers_count":79,"open_issues_count":0,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-13T10:28:29.423Z","etag":null,"topics":["android","compose","compose-multiplatform","desktop","ios","js","jvm","kotlin","kotlin-library","kotlin-multiplatform","latex","wasm"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huarangmeng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-02T10:25:02.000Z","updated_at":"2026-04-13T08:20:29.000Z","dependencies_parsed_at":"2026-03-08T17:01:19.960Z","dependency_job_id":null,"html_url":"https://github.com/huarangmeng/latex","commit_stats":null,"previous_names":["huarangmeng/latex"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/huarangmeng/latex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huarangmeng%2Flatex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huarangmeng%2Flatex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huarangmeng%2Flatex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huarangmeng%2Flatex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huarangmeng","download_url":"https://codeload.github.com/huarangmeng/latex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huarangmeng%2Flatex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31793225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","compose","compose-multiplatform","desktop","ios","js","jvm","kotlin","kotlin-library","kotlin-multiplatform","latex","wasm"],"created_at":"2026-01-06T11:23:23.805Z","updated_at":"2026-04-14T11:01:01.553Z","avatar_url":"https://github.com/huarangmeng.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kotlin Multiplatform LaTeX Rendering Library\n\n[![Kotlin](https://img.shields.io/badge/Kotlin-2.3.0-blue.svg)](https://kotlinlang.org)\n[![Compose Multiplatform](https://img.shields.io/badge/Compose%20Multiplatform-1.10.0-brightgreen.svg)](https://www.jetbrains.com/lp/compose-multiplatform/)\n[![Android API](https://img.shields.io/badge/Android%20API-23%2B-brightgreen.svg)](https://android-arsenal.com/api?level=24)\n[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)\n[![Maven Central](https://img.shields.io/maven-central/v/io.github.huarangmeng/latex-base?filter=!*-kt*)](https://central.sonatype.com/search?q=io.github.huarangmeng.latex)\n\nA high-performance LaTeX mathematical formula parsing and rendering library developed based on Kotlin Multiplatform (KMP). It supports consistent rendering effects on Android, iOS, Desktop (JVM), and Web (Wasm/JS) platforms.\n\n[中文版本](./README_zh.md)\n\n## 🌟 Key Features\n\n- **High-Performance Parsing**: AST-based recursive descent parser with support for incremental updates.\n- **Multi-platform Consistency**: Uses Compose Multiplatform for consistent rendering on Android, iOS, Desktop (JVM), and Web (Wasm/JS).\n- **Automatic Line Breaking**: Smart line wrapping for long formulas at logical breakpoints (operators, relations).\n- **Image Export**: Export rendered formulas as PNG/JPEG/WEBP images with configurable resolution scaling.\n- **Pre-measurement API**: Synchronous pre-measurement of formula dimensions (width/height/baseline) for Compose `InlineTextContent` inline math embedding.\n- **Accessibility**: Built-in screen reader support with MathSpeak-style formula descriptions (MathSpeak).\n- **LaTeX → MathML**: Convert LaTeX AST to Presentation MathML output.\n- **Formula Highlight**: Highlight sub-expressions within formulas via `HighlightConfig`.\n- **Animation**: Animated formula transitions (crossfade / slide / fade+slide).\n- **WYSIWYG Editor** *(Experimental)*: Built-in LaTeX editor with cursor positioning, tap-to-place, and real-time rendered preview.\n- **Structured Diagnostics**: `parseWithDiagnostics()` provides 8-category structured diagnostics with severity filtering.\n- **RTL Support**: Complete right-to-left text direction support (`\\RLE`, `\\LRE`, RTL/LTR environments, nesting).\n\n## 📐 Supported LaTeX Features (372+)\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eMath Formulas\u003c/b\u003e — fractions, roots, binomials\u003c/summary\u003e\n\n`\\frac`, `\\dfrac`, `\\tfrac`, `\\cfrac`, `\\binom`, `\\tbinom`, `\\dbinom`, `\\sqrt`, `\\sqrt[n]{x}`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eSymbols (130+)\u003c/b\u003e — Greek letters, operators, arrows, AMS symbols\u003c/summary\u003e\n\n- **Greek letters**: all lowercase (α–ω), uppercase (Γ–Ω), and variants (ε/ϵ, θ/ϑ, φ/ϕ, etc.)\n- **Operators**: `+`, `-`, `\\times`, `\\div`, `\\pm`, `\\mp`, `\\cdot`, `\\oplus`, `\\otimes`, …\n- **Relations**: `=`, `\\neq`, `\u003c`, `\u003e`, `\\leq`, `\\geq`, `\\approx`, `\\equiv`, `\\sim`, `\\ll`, `\\gg`, …\n- **Set theory**: `\\in`, `\\notin`, `\\subset`, `\\cup`, `\\cap`, `\\emptyset`, `\\mathbb{R}`, …\n- **Logic**: `\\land`, `\\lor`, `\\neg`, `\\Rightarrow`, `\\Leftrightarrow`, `\\forall`, `\\exists`\n- **Arrows**: `\\to`, `\\rightarrow`, `\\leftarrow`, `\\leftrightarrow`, `\\Rightarrow`, `\\hookrightarrow`, harpoons, …\n- **Ellipsis**: `\\ldots`, `\\cdots`, `\\vdots`, `\\ddots`, `\\dots` (auto-adaptive)\n- **Negation**: `\\not=`, `\\not\\in`, `\\nleq`, `\\ngeq`, `\\ncong`, `\\nmid`, … (30+ AMS negated relations)\n- **AMS extras**: `\\checkmark`, `\\complement`, `\\blacksquare`, `\\aleph`, `\\measuredangle`, geometric symbols, double-headed arrows, …\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eLarge Operators (28)\u003c/b\u003e — sums, integrals, limits, modular arithmetic\u003c/summary\u003e\n\n- **Sums/Integrals**: `\\sum`, `\\prod`, `\\int`, `\\oint`, `\\iint`, `\\iiint`, `\\bigcup`, `\\bigcap`, `\\bigvee`, `\\bigwedge`, `\\coprod`, `\\bigoplus`, `\\bigotimes`, `\\bigsqcup`, `\\bigodot`, `\\biguplus`\n- **Limits**: `\\lim`, `\\max`, `\\min`, `\\sup`, `\\inf`, `\\limsup`, `\\liminf`\n- **Custom operators**: `\\operatorname{name}`, `\\DeclareMathOperator{\\Tr}{Tr}`, `\\mathop{content}`\n- **Multi-line subscripts**: `\\substack{cond1 \\\\ cond2}`\n- **Modular arithmetic**: `\\bmod` (binary), `\\pmod{n}` (parenthesized), `\\mod` (wide spacing)\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eMatrices (8)\u003c/b\u003e — all standard matrix environments\u003c/summary\u003e\n\n`matrix`, `pmatrix`, `bmatrix`, `Bmatrix`, `vmatrix`, `Vmatrix`, `smallmatrix`, `array`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eDelimiters\u003c/b\u003e — auto-scaling \u0026 manual sizing\u003c/summary\u003e\n\n- **Auto-scaling**: `\\left( \\right)`, `\\left[ \\right]`, `\\left\\{ \\right\\}`, `\\left| \\right|`, `\\langle`, `\\rangle`, `\\lfloor`, `\\rfloor`, `\\lceil`, `\\rceil`, `\\lvert`, `\\rvert`, `\\lVert`, `\\rVert`\n- **Asymmetric**: `\\left. \\right|` (evaluation bar), `\\left\\{ \\right.` (piecewise)\n- **Manual sizing**: `\\big`, `\\Big`, `\\bigg`, `\\Bigg` with `\\bigl`, `\\bigr`, `\\bigm` variants\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eAccents \u0026 Decorations (35)\u003c/b\u003e — accents, cancels, extensible arrows, stacking, bracket annotations\u003c/summary\u003e\n\n- **Accents**: `\\hat`, `\\tilde`, `\\bar`, `\\overline`, `\\underline`, `\\dot`, `\\ddot`, `\\dddot`, `\\grave`, `\\acute`, `\\check`, `\\breve`, `\\ring`/`\\mathring`, `\\vec`, `\\widehat`\n- **Brace annotations**: `\\overbrace{...}^{text}`, `\\underbrace{...}_{text}`, `\\overbracket{...}`, `\\underbracket{...}`\n- **Arrow decorations**: `\\overrightarrow`, `\\overleftarrow`\n- **Cancel lines**: `\\cancel`, `\\bcancel` (reverse), `\\xcancel` (cross)\n- **Extensible arrows**: `\\xrightarrow`, `\\xleftarrow`, `\\xhookrightarrow`, `\\xhookleftarrow`, `\\xRightarrow`, `\\xLeftarrow`, `\\xLeftrightarrow`, `\\xmapsto`\n- **Stacking**: `\\overset`, `\\underset`, `\\stackrel`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eFont Styles (17)\u003c/b\u003e\u003c/summary\u003e\n\n`\\mathbf`, `\\mathit`, `\\mathrm`, `\\mathsf`, `\\mathtt`, `\\mathbb`, `\\mathfrak`, `\\mathcal`, `\\mathscr`, `\\boldsymbol`, `\\bm`, `\\text`, `\\mbox`, `\\symbf`, `\\symit`, `\\symsf`, `\\symrm`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eMath Mode Switching\u003c/b\u003e\u003c/summary\u003e\n\n`\\displaystyle`, `\\textstyle`, `\\scriptstyle`, `\\scriptscriptstyle`, `$...$` (inline), `$$...$$` (display)\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eEnvironments (21)\u003c/b\u003e — alignment, piecewise, matrices, tables\u003c/summary\u003e\n\n- **Equation environments**: `equation(*)`, `displaymath`\n- **Alignment environments**: `align(*)`, `aligned`, `flalign(*)`, `alignat(*)`\n- **Centering environments**: `gather(*)`, `gathered`\n- **Piecewise functions**: `cases`, `dcases` (displaystyle), `rcases` (right brace)\n- **Multi-line/splitting**: `split`, `multline(*)`\n- **Others**: `eqnarray(*)`, `subequations`, `tabular` (l/c/r column alignment)\n- **Auto-numbering**: Supports `\\tag`/`\\tag*`, `\\label`/`\\ref`/`\\eqref`, starred environments skip numbering\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eSpacing\u003c/b\u003e\u003c/summary\u003e\n\n`\\,`, `\\:`, `\\;`, `\\quad`, `\\qquad`, `\\!`, `\\hspace{...}`, normal spaces\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eColors \u0026 Background\u003c/b\u003e\u003c/summary\u003e\n\n- **Text color**: `\\color{red}{...}`, `\\textcolor{#FF5733}{...}` (named + hex)\n- **Background color**: `\\colorbox{yellow}{text}`, `\\fcolorbox{borderColor}{bgColor}{text}`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eChemical Formulas (13)\u003c/b\u003e — mhchem package\u003c/summary\u003e\n\n`\\ce{H2O}`, `\\ce{H2SO4}`, `\\ce{Na+}`, `\\ce{SO4^{2-}}`, `\\ce{A + B -\u003e C}`, `\\ce{A \u003c=\u003e B}`, coefficients, isotope notation, complexes\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eSpecial Effects \u0026 Layout (9)\u003c/b\u003e\u003c/summary\u003e\n\n- **Boxes**: `\\boxed{E=mc^2}`, `\\fbox{text}`\n- **Phantoms \u0026 spacing**: `\\phantom`, `\\smash`, `\\vphantom`, `\\hphantom`\n- **Zero-width overlaps**: `\\mathclap{content}`, `\\mathllap{content}`, `\\mathrlap{content}`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eAdvanced Annotations (6)\u003c/b\u003e — hyperlinks, tensors, four-corner scripts\u003c/summary\u003e\n\n- **Hyperlinks**: `\\href{url}{text}`, `\\url{url}` (blue underline, click callback)\n- **Four-corner scripts**: `\\sideset{_a^b}{_c^d}{\\sum}`\n- **Pre-scripts**: `\\prescript{A}{Z}{X}` (isotope notation)\n- **Tensor indices**: `\\tensor{T}{^a_b^c}`, `\\indices{^a_b}`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eCustom Commands \u0026 Macros (9)\u003c/b\u003e\u003c/summary\u003e\n\n`\\newcommand`, `\\renewcommand`, `\\def` (0–9 parameters, optional argument defaults), `\\newenvironment`, `\\renewenvironment`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eSection Structure Commands\u003c/b\u003e\u003c/summary\u003e\n\n`\\section`, `\\subsection`, `\\subsubsection`, `\\paragraph`, `\\subparagraph` (with starred variants)\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eRTL Text Direction\u003c/b\u003e\u003c/summary\u003e\n\n- **Commands**: `\\RLE{...}`, `\\LRE{...}`, `\\textarabic{...}`, `\\texthebrew{...}`\n- **Environments**: `\\begin{RTL}...\\end{RTL}`, `\\begin{LTR}...\\end{LTR}`\n- **Nesting**: supports RTL inside LTR and vice versa\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eLabels \u0026 References\u003c/b\u003e\u003c/summary\u003e\n\n`\\label`, `\\ref`, `\\eqref`, `\\tag{1}`, `\\tag*{A}`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eError Handling\u003c/b\u003e\u003c/summary\u003e\n\n- Unrecognized commands rendered in error color instead of silent failure\n- `parseWithDiagnostics()` provides structured diagnostics (8 categories, filter by severity)\n\u003c/details\u003e\n\n## 📸 Rendering Preview\n\nThe project includes a Demo App (`composeApp`/`androidApp`) showcasing various complex LaTeX scenarios:\n\n| Basic Math | Chemical Formulas | Incremental Parsing |\n| :---: | :---: | :---: |\n| ![Basic Math](images/normal_latex.png) | ![Chemical Formulas](images/chemical_latex.png) | ![Incremental Parsing](images/incremental_latex.png) |\n| Basic Math Rendering | Supports `\\ce{...}` syntax | Real-time preview for incomplete input |\n\n## 🛠️ Usage\n\nIn a Compose Multiplatform project, you can use the `Latex` component directly. The component handles incremental parsing automatically and supports real-time preview:\n\n```kotlin\nimport com.hrm.latex.renderer.Latex\nimport com.hrm.latex.renderer.model.LatexConfig\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.unit.sp\n\n@Composable\nfun MyScreen() {\n    Latex(\n        latex = \"\\\\frac{-b \\\\pm \\\\sqrt{b^2 - 4ac}}{2a}\",\n        config = LatexConfig(\n            fontSize = 20.sp,\n            color = Color.Black,\n            darkColor = Color.White // Automatic dark mode support\n        )\n    )\n}\n```\n\n### Automatic Line Wrapping\n\nFor long formulas that need to wrap within the container width, use `LatexAutoWrap`:\n\n```kotlin\nimport com.hrm.latex.renderer.LatexAutoWrap\n\n@Composable\nfun MyScreen() {\n    LatexAutoWrap(\n        latex = \"E = mc^2 + \\\\frac{p^2}{2m} + V(x) + \\\\frac{1}{2}kx^2\",\n        modifier = Modifier.fillMaxWidth(),\n        config = LatexConfig(fontSize = 20.sp)\n    )\n}\n```\n\nLine breaks occur at mathematically valid points: relation operators (`=`, `\u003c`, `\u003e`), then additive operators (`+`, `-`), then multiplicative operators (`×`, `÷`). Atomic structures like fractions, roots, and matrices are never broken.\n\n### Image Export\n\nExport rendered LaTeX formulas as PNG, JPEG, or WEBP images. Use `rememberLatexExporter()` in a Composable scope, then call `export()` on a background thread:\n\n```kotlin\nimport com.hrm.latex.renderer.export.*\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.launch\n\n@Composable\nfun MyScreen() {\n    val exporter = rememberLatexExporter()\n    val scope = rememberCoroutineScope()\n\n    Button(onClick = {\n        scope.launch(Dispatchers.Default) {\n            // Export as PNG (default, 2x resolution)\n            val result = exporter.export(\"E = mc^2\")\n            val pngBytes = result?.bytes       // PNG byte array\n            val bitmap = result?.imageBitmap    // For in-app display\n\n            // Export as JPEG (3x resolution, quality 85)\n            val jpegResult = exporter.export(\n                latex = \"\\\\frac{a}{b}\",\n                exportConfig = ExportConfig(\n                    scale = 3f,\n                    format = ImageFormat.JPEG,\n                    quality = 85\n                )\n            )\n\n            // Export with transparent background (PNG only)\n            val transparentResult = exporter.export(\n                latex = \"x^2 + y^2 = r^2\",\n                exportConfig = ExportConfig(transparentBackground = true)\n            )\n        }\n    }) {\n        Text(\"Export\")\n    }\n}\n```\n\n`ExportConfig` parameters:\n\n| Parameter | Type | Default | Description |\n|-----------|------|---------|-------------|\n| `scale` | `Float` | `2f` | Resolution multiplier (1x, 2x, 3x, etc.) |\n| `format` | `ImageFormat` | `PNG` | `ImageFormat.PNG`, `ImageFormat.JPEG`, or `ImageFormat.WEBP` |\n| `transparentBackground` | `Boolean` | `false` | Use transparent background (PNG and WEBP only; JPEG always uses opaque background) |\n| `quality` | `Int` | `90` | Compression quality (1–100) for JPEG and WEBP; ignored for PNG |\n\n### Accessibility\n\nThe library provides built-in accessibility support for screen readers. When enabled, each `Latex` component exposes a MathSpeak-style natural language description via Compose semantics, making math formulas readable by TalkBack (Android), VoiceOver (iOS), and other assistive technologies.\n\n```kotlin\nLatex(\n    latex = \"\\\\frac{1}{2}\",\n    config = LatexConfig(accessibilityEnabled = true)\n)\n// Screen reader reads: \"fraction: 1 over 2\"\n```\n\nThe `AccessibilityVisitor` converts the LaTeX AST into descriptive text covering fractions, roots, superscripts/subscripts, matrices, Greek letters, operators, and more.\n\n### Pre-measurement API (Inline Math Support)\n\nPre-measure formula dimensions for embedding inline math via `InlineTextContent`:\n\n```kotlin\nval measurer = rememberLatexMeasurer(config)\nval dims = measurer.measure(\"\\\\frac{a}{b}\", config) ?: return\n\nval placeholder = Placeholder(\n    width = with(density) { dims.widthPx.toSp() },\n    height = with(density) { dims.heightPx.toSp() },\n    placeholderVerticalAlign = PlaceholderVerticalAlign.TextCenter\n)\n```\n\n`LatexDimensions` provides `widthPx`, `heightPx`, `baselinePx` (with padding) and their content-only counterparts. Use `measureBatch()` for multiple formulas.\n\n### WYSIWYG Editor (Experimental)\n\n\u003e **Note**: The editor API is experimental and may change in future versions. All editor APIs require the `@ExperimentalComposeUiApi` annotation.\n\nThe library includes a built-in WYSIWYG (What You See Is What You Get) LaTeX editor component. Users can edit LaTeX source text and see the rendered formula in real-time, with cursor position synchronized between the source and the rendered output.\n\n```kotlin\n@OptIn(ExperimentalComposeUiApi::class)\n@Composable\nfun MyEditor() {\n    val editorState = rememberEditorState(initialText = \"x^{2} + y^{2} = r^{2}\")\n\n    LatexEditor(\n        editorState = editorState,\n        config = LatexConfig(fontSize = 20.sp),\n        showSourceText = true // Show source text input field\n    )\n}\n```\n\n## 📦 Installation\n\n### Version Compatibility\n\nThis library publishes two variants for each release to support different Kotlin/Compose versions:\n\n| Variant | Kotlin | Compose Multiplatform | Artifact Version |\n|---------|--------|-----------------------|------------------|\n| **Standard** | 2.3.0+ | 1.10.0+ | `1.3.0` |\n| **Kotlin 2.1.0** | 2.1.0 | 1.9.3 | `1.3.0-kt2.1.0` |\n\n\u003e Choose the variant that matches your project's Kotlin version. If your project uses **Kotlin 2.1.0**, use the `-kt2.1.0` suffixed version.\n\n### Standard Version (Kotlin 2.3.0+)\n\nAdd dependencies in `gradle/libs.versions.toml`:\n\n```toml\n[versions]\nlatex = \"1.3.0\"\n\n[libraries]\nlatex-base = { module = \"io.github.huarangmeng:latex-base\", version.ref = \"latex\" }\nlatex-parser = { module = \"io.github.huarangmeng:latex-parser\", version.ref = \"latex\" }\nlatex-renderer = { module = \"io.github.huarangmeng:latex-renderer\", version.ref = \"latex\" }\n```\n\n### Kotlin 2.1.0 Compatible Version\n\nIf your project uses Kotlin 2.1.0, use the `-kt2.1.0` suffixed artifacts:\n\n```toml\n[versions]\nlatex = \"1.3.0-kt2.1.0\"\n\n[libraries]\nlatex-base = { module = \"io.github.huarangmeng:latex-base\", version.ref = \"latex\" }\nlatex-parser = { module = \"io.github.huarangmeng:latex-parser\", version.ref = \"latex\" }\nlatex-renderer = { module = \"io.github.huarangmeng:latex-renderer\", version.ref = \"latex\" }\n```\n\n### Add to Your Module\n\nReference in your module's `build.gradle.kts`:\n\n```kotlin\ndependencies {\n    implementation(libs.latex.base) // Basic logging\n    implementation(libs.latex.renderer) // Rendering logic\n    implementation(libs.latex.parser) // Parsing logic\n}\n```\n\n## 🏗️ Project Structure\n\n- `:latex-base`: Base data structures and interfaces.\n- `:latex-parser`: Core parsing engine, responsible for converting LaTeX strings to AST.\n- `:latex-renderer`: Responsible for rendering AST into Compose UI components.\n- `:latex-preview`: Preview components and sample datasets.\n- `:composeApp`: Cross-platform Demo application.\n- `:androidApp`: Android Demo application.\n\n## 🚀 Quick Start\n\n### Running the Demo App\n\n- **Android**: `./gradlew :androidApp:assembleDebug`\n- **Desktop**: `./gradlew :composeApp:run`\n- **Web (Wasm)**: `./gradlew :composeApp:wasmJsBrowserDevelopmentRun`\n- **iOS**: Open `iosApp/iosApp.xcworkspace` in Xcode to run.\n\n### Running Tests\n\n```bash\n./run_parser_tests.sh\n```\n\n## 📊 Roadmap \u0026 Coverage\n\nFor a detailed list of supported features, please refer to: [PARSER_COVERAGE_ANALYSIS.md](./latex-parser/PARSER_COVERAGE_ANALYSIS.md)\n\n## 🙏 Acknowledgements\n\n- [KaTeX](https://github.com/KaTeX/KaTeX) — This project uses font files from KaTeX for mathematical formula rendering. KaTeX is licensed under the [MIT License](https://github.com/KaTeX/KaTeX/blob/main/LICENSE).\n\n## 💡 Recommended\n\n- [Markdown](https://github.com/huarangmeng/Markdown) — A Kotlin Multiplatform Markdown parsing and rendering library by the same author. If you need both LaTeX and Markdown rendering in your project, check it out!\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n```\nMIT License\n\nCopyright (c) 2026 huarangmeng\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuarangmeng%2Flatex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuarangmeng%2Flatex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuarangmeng%2Flatex/lists"}