ConTeXt online
Compile ConTeXt online in your browser: the current LMTX release on the LuaMetaTeX engine, with nothing to install.
Open in LaTeX.to Download the example (zip)
- Recommended Active, 2019
- Magic comment:
% !TeX program = contexton the first line of main.tex, which is how the example picks it under Auto. - License: Public domain, use freely.
- Files:
main.tex
% !TeX program = context % ConTeXt has no \documentclass. Everything lives between \starttext and % \stoptext, and is configured with \setup... commands. The bare name % "context" is the current ConTeXt, LMTX, running on the LuaMetaTeX engine. \setuppapersize[A4] \setupbodyfont[modern,11pt] \setupwhitespace[medium] \setupinteraction[state=start,color=darkblue,contrastcolor=darkred] \definecolor[deepblue][r=.12,g=.30,b=.47] \setuphead[section][style=\bfa,color=deepblue] \setupTABLE[frame=on,rulethickness=.6pt,offset=1mm] \setupTABLE[row][first][background=color,backgroundcolor=deepblue,foregroundcolor=white,style=bold] \starttext \startsection[title={Why ConTeXt},reference=sec:why] ConTeXt is a complete document system built on the TeX engine, but with a very different philosophy from LaTeX. Instead of loading a class and a stack of packages, you describe what you want through one consistent family of setup commands. There is no document class here at all. This document runs on LMTX, the current ConTeXt, whose engine is LuaMetaTeX: a lean successor of LuaTeX that the ConTeXt developers maintain themselves, with Lua built in and the PDF backend written in Lua. \stopsection \startsection[title={One consistent interface},reference=sec:interface] Every part of the document is shaped the same way. The page size came from \type{\setuppapersize}, the typeface from \type{\setupbodyfont}, the paragraph spacing from \type{\setupwhitespace}, and the heading colour above from \type{\setuphead}. Learn that one pattern and it carries you everywhere, from headings to footnotes to tables. \startitemize[packed] \item Setups read almost like plain English options. \item Sensible defaults keep short documents short. \item Finer control is always one more setup command away. \stopitemize \stopsection \startsection[title={Lua inside the engine},reference=sec:lua] LuaMetaTeX embeds Lua, and ConTeXt makes it a first-class part of the document. The next sentence was computed while this page was typeset: \startluacode local total = 0 for k = 1, 100 do total = total + k end local function isprime(n) if n < 2 then return false end for d = 2, math.floor(math.sqrt(n)) do if n % d == 0 then return false end end return true end local primes = {} for n = 2, 30 do if isprime(n) then primes[#primes + 1] = n end end context("The integers from one to one hundred add up to %s, and the primes below thirty are %s.", total, table.concat(primes, ", ")) \stopluacode Nothing about those numbers is stored in the source, and there is no package to load: the interpreter is part of the engine. \stopsection \startsection[title={Tables and formulas},reference=sec:tables] Natural tables are written cell by cell and styled with the same setup commands as everything else: \bTABLE \bTR \bTH Branch \eTH \bTH Engine \eTH \bTH Status \eTH \eTR \bTR \bTD LMTX \eTD \bTD LuaMetaTeX \eTD \bTD current, this document \eTD \eTR \bTR \bTD MkIV \eTD \bTD LuaTeX \eTD \bTD frozen, kept for older documents \eTD \eTR \eTABLE Display formulas can be numbered and referenced. Formula~\in[eq:euler] below is Euler's identity: \placeformula[eq:euler] \startformula e^{i\pi} + 1 = 0 \stopformula \stopsection \startsection[title={Batteries included},reference=sec:batteries] Layout, fonts, colour, graphics, and structure all ship as one integrated whole, developed and versioned together. Interaction is switched on in this document, so a reference such as section~\in[sec:why] is a live link in the PDF. For people who would rather have a single, coherent tool than assemble an ecosystem of packages, that integration is the whole appeal of ConTeXt. \stopsection \stoptext
How to compile with ConTeXt on LaTeX.to
Everything runs in your browser: nothing to install, no login, no compile timeout.
- Click Open in LaTeX.to. The example opens as a project with main.tex in the editor and its finished PDF in the preview.
- Edit, then press Ctrl+Enter (Cmd+Enter on a Mac). The first compile downloads what this engine needs; after that a compile takes seconds.
What ConTeXt is
ConTeXt is an alternative to LaTeX on the same TeX engines. LaTeX is a kernel plus a class plus whatever packages you pile on top, each with its own interface. ConTeXt is one integrated system from Hans Hagen and Pragma ADE: layout, fonts, color, graphics through MetaPost, interactive PDF features and bibliographies, all driven by one family of \setup... commands. There is no \documentclass; a document is what sits between \starttext and \stoptext.
"ConTeXt" here means the current branch, LMTX, on the LuaMetaTeX engine, the snapshot TeX Live ships (the log says 2026.02.19). The older MkIV branch on LuaTeX has its own page. Both share the \starttext fingerprint, so Auto always picks LMTX and MkIV has to be named.
When to use it
- A document that is yours to design: a book, a report with a house style, anything with tables and color on every page.
- When you would rather learn one consistent interface than a hundred package manuals.
- When you want MetaPost drawings and Lua code as parts of the language rather than add-ons. The example builds a natural table, numbers a formula, and computes a sentence in a
\startluacodeblock. - Not for a journal's class file, a package that exists only for LaTeX, or a coauthor who has never met ConTeXt.
Good to know before the first compile
- Hosted LaTeX editors are built around
latexmkand offer no ConTeXt setting, because ConTeXt is driven by its own Lua runner. Here theluametatexbinary runs directly against a prebuilt format inside your browser, so there is nothing to install. - The first compile downloads the ConTeXt tree; later ones come from the cache.
- Fonts are the one slow spot. The example uses Latin Modern, whose font database is prebuilt. The first compile that asks for another typeface, say
\setupbodyfont[pagella], spends a few minutes while ConTeXt builds its font cache; later compiles reuse it, and Reset cache in the settings gear clears it. - Bibliographies need no BibTeX or Biber step:
\usebtxdatasetreads a.bibfile and\placelistofpublicationsprints it. - The ConTeXt Garden wiki is the reference.
More engines: ConTeXt (MkIV) and all engines.