XeTeX online
Run XeTeX online in your browser: plain TeX that reads Unicode and loads OpenType fonts by their names.
Open in LaTeX.to Download the example (zip)
- Unmaintained, 2004
- Magic comment:
% !TeX program = xetexon 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 = xetex % Plain XeTeX: Unicode input and the quoted \font syntax; ends with \bye. \font\body="TeX Gyre Pagella" at 11pt \font\titlefont="TeX Gyre Pagella" at 20pt \body \baselineskip=15pt \centerline{\titlefont XeTeX and Plain TeX} \medskip \centerline{Unicode text with real fonts} \bigskip \noindent XeTeX is plain TeX with two superpowers: it reads Unicode directly, and it loads fonts by name. This whole file is set in TeX Gyre Pagella, chosen with the quoted font syntax that only XeTeX and its relatives accept. \medskip \noindent Because the input is Unicode, text from many languages goes straight into the source and simply appears. Français, Português, Español, Català, Čeština, Polski (Łódź), Türkçe, and Tiếng Việt all sit side by side here, accents and all, with no escape codes. \medskip \noindent The quoted font form asks the system for a family by its human name, TeX Gyre Pagella, instead of a cryptic file name. Point it at another installed family and the document restyles itself. That mix of plain TeX minimalism and modern font handling is why XeTeX keeps a devoted following. \bye
How to compile with XeTeX 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 XeTeX is
XeTeX is the engine underneath XeLaTeX. Run it with the plain format instead of LaTeX and you get Knuth's plain TeX, the one that ends in \bye, plus the two things XeTeX was built for: it reads Unicode, and it loads fonts by name.
The example on this page shows both. \font\body="TeX Gyre Pagella" at 11pt asks for a font by its human name, in quotes, a syntax only XeTeX accepts, and the paragraph with Français, Čeština, Łódź and Tiếng Việt is typed exactly as it prints.
When to use it
- A plain TeX file that needs a real font:
\font\x="Latin Modern Roman:+smcp"gives small capitals, and the part after the colon takes any OpenType feature tag. - A plain TeX file with text in a script that TeX fonts cannot hold.
- Testing what a package can rely on under XeLaTeX: the
\XeTeX...primitives, the font extensions, and the absence of the\pdf...primitives, since the PDF is written by the driver, not the engine. - Not for a file with
\documentclass, which is XeLaTeX, and not for new plain work that needs to last: the engine is no longer developed.
XeTeX vs LuaTeX
Both read Unicode and both load OpenType fonts.
- XeTeX: shapes text with HarfBuzz built into the engine, writes XDV, which xdvipdfmx turns into PDF in the same run; unmaintained, and it cannot produce tagged PDFs.
- LuaTeX: writes PDF directly and carries a Lua interpreter, so a plain file can compute while it typesets; where new work lands.
For a plain file that only needs a nice font, either does the job. Auto picks XeTeX for a \bye file that loads a font with the quoted syntax, and the example pins it with % !TeX program = xetex on the first line.
More engines: LuaTeX, pdfTeX and all engines.