Skip to main content

LaTeX

LaTeX is a high-quality typesetting system for technical and scientific documents.

LiveCodes supports LaTeX with a live preview of the typeset document. Documents are written in the markup editor and compiled to HTML in the browser using LaTeX.js.

Basic Demo​

show code
import { createPlayground } from 'livecodes';

const options = {
"config": {
"markup": {
"language": "latex",
"content": "\\documentclass{article}\n\n\\title{Hello, \\LaTeX{}!}\n\\author{LiveCodes}\n\\date{\\today}\n\n\\begin{document}\n\\maketitle\n\n\\section{Introduction}\n\nThis is a \\LaTeX{} document running in LiveCodes. It supports \\textbf{bold text}, \\emph{italic text},\nlists, links, and math.\n\n\\begin{itemize}\n\\item Written in the markup editor\n\\item Compiled in the browser\n\\item Previewed live\n\\end{itemize}\n\n\\section{Mathematics}\n\nInline math like $E = mc^2$ and displayed equations are supported:\n\n\\[\n\\int_{-\\infty}^{\\infty} e^{-x^2} \\, dx = \\sqrt{\\pi}\n\\]\n\n\\end{document}\n"
},
"editor": "auto"
}
};
createPlayground('#container', options);

Usage​

LaTeX documents are written in the markup editor and previewed live as you type. See the starter template for an example covering sections, lists, math, cross-references, and links.

show code
import { createPlayground } from 'livecodes';

const options = {
"template": "latex"
};
createPlayground('#container', options);

Language Info​

Name​

latex

Extensions​

tex, latex, ltx

Editor​

markup

Compiler​

LaTeX is compiled to HTML in the browser by LaTeX.js. It is a JavaScript LaTeX-to-HTML5 translator that uses a PEG parser and renders math with KaTeX. The compiler runs in the compiler sandbox and the generated HTML is sent to the result page. Nothing is sent to a server.

Version​

latex.js v0.13.1 (with KaTeX v0.19.1)

There is no separate LaTeX release version: LaTeX.js implements LaTeX2e syntax itself.

Limitations​

  • LaTeX.js supports a subset of LaTeX. The document classes article, book, and report are built in, along with parts of the color, xcolor, graphics, graphicx, hyperref, multicol, latexsym, gensymb, textcomp, textgreek, and stix packages.
  • Tables, figures, and other floats are not implemented.
  • Packages and commands that are not supported by LaTeX.js cannot be loaded from a TeX distribution. They are reported in the console when used.
  • The output is HTML, not PDF. PDF-specific features are not available.

Starter Template​

https://livecodes.io/?template=latex