xetex
Compile TeX documents with Unicode and fonts
TLDR
Compile a PDF document
Compile a PDF document, specifying an output directory
Compile a PDF document, exiting if errors occur
SYNOPSIS
xetex [options] file
xetex [options] \command
PARAMETERS
-output-directory=DIR
Write output files (DVI, PDF, log, etc.) into the specified directory DIR.
-no-file-line-error
Suppress the usual file:line:error messages. Useful for tools that parse error output.
-halt-on-error
Exit immediately upon encountering the first error during compilation.
-interaction=MODE
Set the interaction mode. Common modes include batchmode (no user interaction), nonstopmode (continue without stopping for errors), scrollmode, and errorstopmode (default).
-jobname=NAME
Use NAME for the output files (DVI/PDF, log). By default, it's derived from the input filename.
-version
Print version information of XeTeX and exit.
-ini
Start XeTeX in INI mode, used for creating format files (e.g., xelatex.fmt).
-fmt=FORMAT
Use the specified FORMAT file instead of the default or the one determined by the input filename.
-shell-escape
Enable the \write18 command, allowing TeX to execute external system commands. This is a potential security risk.
-no-shell-escape
Disable the \write18 command, preventing TeX from executing external system commands. This is the default behavior in modern TeX distributions.
-output-format=FORMAT
Specify the output format. Can be dvi or pdf. Default is typically PDF.
DESCRIPTION
XeTeX is a typesetting engine based on TeX, designed to bridge the gap between traditional TeX and modern operating system technologies. It provides direct support for Unicode input and allows the use of OpenType and AAT system fonts directly without special configurations. This makes it particularly suitable for multilingual documents, complex scripts, and advanced typographic features. XeTeX processes source files (typically .tex) and outputs either a Device Independent (DVI) file or a Portable Document Format (PDF) file, embedding the necessary fonts directly. It is a key component of modern TeX distributions like TeX Live and MiKTeX.
CAVEATS
The -shell-escape option allows the execution of arbitrary system commands, which poses a significant security risk if you're compiling untrusted documents. It should be used with extreme caution or disabled by default for security reasons. While XeTeX offers excellent Unicode and font support, some older TeX packages might not be fully compatible or require specific workarounds.
UNICODE SUPPORT
XeTeX processes all input and output using Unicode (specifically UTF-8 by default), enabling users to work with a vast range of characters from different languages and scripts without complex encoding conversions.
NATIVE FONT HANDLING
One of XeTeX's most powerful features is its ability to directly access and use fonts installed on your operating system (e.g., OpenType and Apple Advanced Typography). This eliminates the need for TeX-specific font metric files (.tfm) and greatly simplifies font embedding and usage.
HISTORY
XeTeX was developed by Jonathan Kew, with its first public release around 2004. Its primary motivation was to overcome the limitations of traditional TeX engines regarding Unicode character encoding and advanced font features. It brought the ability to use native system fonts (OpenType and AAT) directly into the TeX workflow, simplifying multilingual typesetting and complex typographic layouts. It gained significant popularity and was soon integrated as a core component of major TeX distributions like TeX Live, becoming a preferred choice for modern TeX users who require extensive font and Unicode support.