LinuxCommandLibrary

xetex

Compile TeX documents with Unicode and fonts

TLDR

Compile a PDF document

$ xetex [source.tex]
copy

Compile a PDF document, specifying an output directory
$ xetex -output-directory=[path/to/directory] [source.tex]
copy

Compile a PDF document, exiting if errors occur
$ xetex -halt-on-error [source.tex]
copy

SYNOPSIS

XeTeX [options] [input.tex] [.fmt] | commands

PARAMETERS

-help
    Display this help and exit

-version
    Print version information

-ini
    Initialize from basname.ini dump

-jobname=string
    Set main output file name

-halt-on-error
    Stop on first error

-interaction=mode
    Set interaction mode (batch, nonstopmode, scrollmode, errorstopmode)

-output-directory=dir
    Directory for auxiliary files

-shell-escape
    Enable \write18{command} escapes

-src-specials
    Include source file specials in output

-etex
    Enable e-TeX extensions (default)

-no-etex
    Disable e-TeX extensions

-translate-file=tcf
    Use tcf name translation file

-papersize=paper
    Set default paper size (e.g., a4)

-output-driver=prog[args]
    Set program for final output (default: xdvipdfmx)

-feature-file=file
    Load OpenType feature file

DESCRIPTION

XeTeX is an advanced typesetting engine extending Donald Knuth's original TeX. It natively supports Unicode input and directly accesses system-installed OpenType and TrueType fonts via fontconfig on Linux. This eliminates the need for traditional TeX font metrics (pk, vf) or map files, enabling high-quality typography with advanced font features like ligatures, kerning, optical sizes, and glyph substitution.

XeTeX processes input files (typically .tex) and generates an extended DVI format (.xdv). It pairs with xdvipdfmx to produce PDF output, supporting embedding of full font subsets and precise glyph positioning. Ideal for multilingual documents, non-Latin scripts (e.g., Arabic, Devanagari), and professional design work. Commonly invoked directly or via wrappers like XeLaTeX for LaTeX compatibility.

Key advantages include seamless integration with modern tools like Lua scripts for font loading and HarfBuzz for complex text shaping (in newer versions). It's part of TeX Live distributions and excels in reproducible builds with containerized fonts.

CAVEATS

Requires fontconfig and OpenType fonts; default output needs xdvipdfmx for PDF. Shell escapes pose security risks. Large documents may need increased memory (-mem-bot=..., etc.). Not fully compatible with legacy TeX packages.

BASIC USAGE

xetex mydoc.tex
Generates mydoc.xdv; run xdvipdfmx mydoc for PDF.

xelatex doc.tex
LaTeX wrapper auto-handles PDF output.

FONT LOADING

Use \font\myfont="/path/to/font.otf" at 12pt;
Or \setmainfont{Font Name} in XeLaTeX with fontspec package.

HISTORY

Developed by Jonathan Kew from 2001; first public release ~2004. Integrated into TeX Live 2005. Gained HarfBuzz support in 2013 (XeTeX 0.99996). Now maintained by TeX project, emphasizing Unicode and font tech evolution.

SEE ALSO

xelatex(1), pdflatex(1), luatex(1), tex(1), xdvipdfmx(1), fontconfig(3)

Copied to clipboard