Skip to content

LaTeX Support en

AminiamEva edited this page Nov 29, 2026 · 3 revisions

LaTeX Support (English)

中文 · English

Lineae is not a full LaTeX interpreter. It recognises a clearly defined syntax subset, turns recognised parts into editable nodes, and keeps everything else verbatim as source blocks.

Import pipeline

.tex source
   |
   v
Keep preamble, document boundary, opaque source blocks
   |
   v
Recognise supported block and inline syntax
   |
   v
ProseMirror document tree (editable)

Export runs the pipeline in reverse: supported nodes are re-serialised to LaTeX, opaque blocks are written back verbatim.

This page describes the web JS typesetting pipeline subset. The desktop native LuaLaTeX workspace is typeset and rendered by the real TeX engine, so construct coverage follows the engine; unsupported parts are likewise kept as source.

Supported constructs

Document structure

  • Preamble content such as \documentclass and \usepackage is kept verbatim
  • \title, \author, \maketitle
  • \section, \subsection, \subsubsection, including starred forms, short titles, and trailing labels; no chapter / part
  • \label, \ref, \eqref, \autoref, \pageref, \cite, table of contents (static keys; compiled page numbers are not provided)
  • \footnote (simple, single-line argument without nested braces only)
  • Paragraphs, line breaks, comments (comments inside an edited supported block may not survive)

Text formatting

  • \textbf, \textit (fully supported); \emph, \textsl, \texttt, \textsc, \fbox, \underline, \sout, uline / uuline / uwave (partially mapped)
  • A subset of font, size (zihao / setlength kept via source mapping), and colour commands
  • \textsuperscript, \textsubscript

Lists and blocks

  • itemize, enumerate, description (basic nesting; arbitrary enumitem configurations are not supported)
  • Block quotes and code blocks (lstlisting only without options or with a single language option; verbatim / minted / \verb content is protected but kept as source)
  • abstract, center, quote
  • \hrule

Tables

  • Basic tabular structure, selected column specifiers, \multicolumn / \multirow
  • booktabs \toprule, \midrule, \bottomrule
  • tblr (tabularray), tabularx, longtable, and table floats: the original source is kept and cell edits patch source ranges only (PR #26 model)
  • Adapter limits: tblr \SetCell supports column spans only (row spans stay Raw); tabularx \multicolumn parses, while multirow and other unadapted cases stay Raw

Math

  • Inline $...$, \(...\) (common single-line forms; complex or multi-line input may stay Raw)
  • Display \[...\], $$...$$, equation (incl. starred) and selected alignment environments: align, alignat, flalign, gather, multline, eqnarray; cases, aligned, matrix, array and other inner environments are stored as whole math strings
  • \tag, \notag, \nonumber and labels are partially restored (no TeX counter semantics)
  • Common commands, matrices, scripts, fractions, roots, integrals, and big operators are presented by MathLive; whether a given command renders/edits is a MathLive-layer capability

Figures

  • \includegraphics inside figure
  • \caption, \label, and a subset of alignment and placement options
  • Width accepts only numeric multiples of linewidth / textwidth or cm / mm / pt; height, cropping, or rotation options are not accepted
  • On import, multi-image and subfigure / minipage layouts are not flattened (kept Raw); the editor panel can crop, resize, or combine supported single images into subfigures (see Features)

Theorem-like

  • theorem, lemma, proposition, corollary, definition, remark, proof

What happens to unsupported content

Constructs outside the subset (custom environments, complex package commands, exotic tables, etc.) become opaque source blocks where possible:

  • Shown as source in the visual mode, never mistaken for plain text.
  • Fully editable in Source view.
  • Written back verbatim on export.

This is the "make limitations explicit" principle in practice: showing source is preferred over lossy guessing.

Round-trip fidelity

Scenario Behaviour
Open, make no changes, export Original source is preserved
Edit a supported block That block is re-serialised; whitespace, comments, and command spelling may change
Edit only prose paragraphs Preamble and opaque blocks are unaffected
Replace everything in Source view The editable projection is rebuilt; rich-text history resets

There is no universally lossless round trip. If you depend on exact source spelling (e.g. a camera-ready journal submission), verify with version control or an external diff after editing.

Typesetting fidelity

Even when the syntax is recognised correctly, the web editing view is not the compiled result:

  • Line breaking and page breaking are approximations, calibrated against real XeLaTeX output but not guaranteed to match.
  • Font metrics and kerning approximate the selected engine profile (XeLaTeX / LuaLaTeX / pdfLaTeX).
  • Math sizing, script placement, and spacing are approximations.
  • Expansion results of complex packages cannot be reproduced in the browser.

The desktop native LuaLaTeX workspace, rendered by real TeX, is the reference for typesetting fidelity; these gaps remain core TODOs for the web. See "Fidelity boundary" in Architecture.

Reporting compatibility issues

If a construct is misrecognised, treated as plain text, or changes meaning after export, attach a minimal reproducible .tex file:

https://github.com/AminiamEva/Lineae/issues

A minimal example is far more useful than a whole paper, and easier to turn into a regression test.

Clone this wiki locally