Recent from talks
Nothing was collected or created yet.
XeTeX
View on Wikipedia
This article needs additional citations for verification. (March 2013) |
| XeTeX | |
|---|---|
| Original author | Jonathan Kew |
| Stable release | 0.999997
/ March 7, 2025 |
| Repository | |
| Written in | Pascal (WEB), C and C++ |
| Operating system | Cross-platform |
| Type | Typesetting |
| License | MIT License |
| Website | xetex |
XeTeX (/ˈziːtɛx/ ZEE-tekh[1] or /ˈziːtɛk/; see also Pronouncing and writing "TeX"), sometimes stylized as XeTeX, is a TeX typesetting engine using Unicode and supporting modern font technologies such as OpenType, Graphite and Apple Advanced Typography (AAT). It was originally written by Jonathan Kew and is distributed under the X11 free software license.[2]
Initially developed for Mac OS X only, it is now available for all major platforms. It natively supports Unicode and the input file is assumed to be in UTF-8 encoding by default. XeTeX can use any fonts installed in the operating system without configuring TeX font metrics, and can make direct use of advanced typographic features of OpenType, AAT and Graphite technologies such as alternative glyphs and swashes, optional or historic ligatures, and variable font weights. Support for OpenType local typographic conventions (locl tag) is also present. XeTeX even allows raw OpenType feature tags to be passed to the font. Microtypography is also supported. XeTeX also supports typesetting mathematics using Unicode fonts that contain special mathematical features, such as Cambria Math or Asana Math as an alternative to the traditional mathematical typesetting based on TeX font metrics.
LaTeX developers have announced that they no longer support new LaTeX functionalities on the XeTeX engine, and encourage users to migrate to LuaTeX, another Unicode-supporting engine.[3]
Mode of operation
[edit]
XeTeX processes input in two stages. In the first stage XeTeX outputs an extended DVI (xdv) file, which is then converted to PDF by a driver. In the default operating mode the xdv output is piped directly to the driver without producing any user-visible intermediate files. It is possible to run just the first stage of XeTeX and save the xdv, although as of July 2008[update] there are no viewers capable of displaying the intermediate format.
Two backend drivers are available to generate PDF from an xdv file:
- xdv2pdf, which uses ATSUI and QuickTime frameworks, and only works on Mac OS X.
- xdvipdfmx, a modified version of dvipdfmx, which uses FreeType. This driver works on all platforms.
Starting from version 0.997, the default driver is xdvipdfmx on all platforms. As of version 0.9999, xdv2pdf is no longer supported and its development has been discontinued.[4]
XeTeX works well with both LaTeX and ConTeXt macro packages. It is usually invoked through xelatex when using LaTeX. It is usually used with the fontspec package, which provides a configurable interface for font selection, and allows complex font choices to be named and later reused.[5]
XeTeX is bundled with TeX Live, MacTeX, MiKTeX and Lyx (see the History below for dates and versions).[6]
Example
[edit]The following is an example of XeLaTeX source and rendered output. The typeface used is OFL-licensed font Linux Libertine. The text is to be processed by the command xelatex.
Arabic support
[edit]XeTeX also supports right-to-left scripts, such as Arabic. One way of rendering Arabic in XeTeX is to use the package arabxetex. In order to do so, the Arabic is placed inside the following:
\begin{arab}[utf]
.
.
.
\end{arab}
The following code illustrates this:
Features
[edit]In bibliographic files (see below the BibTeX example) you can use Unicode entities and call them with their native scripting, for example \cite{Ekstrøm}, instead of a transliterated ASCII form like \cite{Ekstrom} which is mandatory using the pdfTeX engine.
% Encoding: UTF8
@ARTICLE(Ekstrom,
AUTHOR = "Author w",
TITLE = "{Ekstrøm title}",
JOURNAL = "Ekstr{\o}m Journal",
YEAR = 1965,
note = {Working with pdflatex}
)
@ARTICLE(Ekstrøm,
AUTHOR = "Author Ekstr{\o}m",
TITLE = "{Ekstrøm title}",
JOURNAL = "Ekstrøm Journal",
YEAR = "1965",
note = {Not working with pdflatex but with xelatex}
)
History
[edit]XeTeX was initially released for Mac OS X only in April 2004[7] with built-in AAT and Unicode support. In 2005 support for OpenType layout features was first introduced. During BachoTeX 2006 a version for Linux was announced, which was ported to Microsoft Windows by Akira Kakuto a few months later, and finally included into TeX Live 2007 for all major platforms. XeTeX is also supported by LyX since version 2.0[8] and shipped with MiKTeX since version 2.7.
As of the inclusion in TeX Live, XeTeX supports most macro packages written for LaTeX, OpenType, TrueType and PostScript fonts without any specific setup procedure.
Version 0.998 announced at BachoTeX 2008 supports Unicode normalization via the \XeTeXinputnormalization command.
Version 0.9999, released in May 2013, switched from ICU Layout Engine to HarfBuzz for OpenType layout, and Graphite2 engine for Graphite layout, as well Core Text framework instead of ATSUI on Mac OS X.
XeTeX's original SourceForge code repository has not seen changes since January 20, 2020.[9] It's still included in the TeX Live repository and occasionally receives fixes, but there have been no major developments. LaTeX developers have stated that it won't be supported in their ongoing effort to produce tagged PDF,[3] and one developer consider it unmaintained.[10]
See also
[edit]- LuaTeX
- Omega (TeX)
- Typeface
- TeXworks – A multi-platform, Unicode editor designed for working with TeX files, written by the author of XeTeX.
- List of TeX extensions
References
[edit]- ^ Kew, Jonathan (April 3, 2007). "Jonathan Kew". TUG (Interview). Interviewed by Dave Walden. Retrieved November 20, 2009.
- ^ "XeTeX COPYING file". Retrieved March 18, 2013.
- ^ a b LaTeX Project Team (November 1, 2024). "News from the "LaTeX Tagged PDF" project" (PDF). LaTeX News. No. 40. Retrieved May 22, 2025.
- ^ Hosny, Khaled (March 12, 2013). "Future of xdv2pdf driver on Mac". Retrieved June 7, 2013.
- ^ Robertson, Will (August 9, 2008). "The fontspec package" (PDF). Archived from the original (PDF) on February 5, 2009. Retrieved January 8, 2009.
- ^ "LyX wiki | LyX / XeTeX". wiki.lyx.org. Retrieved August 25, 2017.
- ^ Kew, Jonathan. "The XETEX project: typesetting for the rest of the world". XIV Ogólnopolska Konferencja Polskiej Grupy Użytkowników Systemu TEX: 4–5.
- ^ "LyX wiki | LyX / New in LyX 2.0". wiki.lyx.org. Retrieved August 25, 2017.
- ^ "XeTeX - Unicode-based TeX Code". SourceForge. May 21, 2024. Retrieved May 27, 2024.
- ^ Wright, Joseph (November 5, 2024). "Engine news from the LaTeX Project". Some TeX Developments. Retrieved May 21, 2025.
Further reading
[edit]- M. Goossens (Ed.) (2008) The XeTeX Companion: TeX meets OpenType and Unicode.
External links
[edit]- Official website

- The Beauty of LaTeX: illustrates XeTeX use with professional fonts.
- XeTeX Showcase at TUG.
XeTeX
View on GrokipediaOverview
Definition and Purpose
XeTeX is a typesetting engine built as an extension of Donald Knuth's original TeX system, specifically engineered to natively handle Unicode input and output while leveraging modern font formats such as OpenType and Graphite (with historical support for Apple Advanced Typography on older macOS versions).[8] Since 2019, it incorporates the HarfBuzz library for enhanced OpenType shaping and complex script support.[9] It inherits the core algorithmic typesetting capabilities of TeX, including its precise control over layout and spacing, but replaces TeX's traditional 8-bit character encoding with full Unicode/ISO 10646 support, allowing for the direct processing of UTF-8 encoded source files without the need for external conversion tools.[10] Developed by Jonathan Kew at SIL International, XeTeX was created to enable the typesetting of complex international scripts directly within TeX's framework, overcoming the restrictions of legacy engines like pdfTeX that rely on limited character sets and preprocessing for non-Latin languages.[11] The primary purpose of XeTeX is to facilitate the creation of multilingual documents and advanced typographic designs by integrating TeX's programmable formatting with contemporary font rendering technologies, thereby supporting features like ligatures and glyph variants (with packages for bidirectional text) without additional software layers for basic font rendering.[10] This addresses key limitations in traditional TeX engines, which struggle with the diversity of global writing systems due to their dependence on fixed encodings and basic font metrics.[8] By processing Unicode text internally in UTF-16 and interfacing with system fonts, XeTeX ensures high-fidelity output, particularly in PDF format, making it suitable for academic publishing, technical documentation, and cultural heritage projects involving scripts such as Arabic, Devanagari, or Cyrillic.[11] At its core, XeTeX embodies the fusion of TeX's mathematical precision in line breaking and justification with the expressive power of modern fonts, allowing users to specify font families and features declaratively in their documents for seamless rendering of typographic nuances.[10] This design choice not only preserves TeX's renowned quality for Western European languages but extends it globally, promoting accessibility for non-Roman scripts while maintaining compatibility with existing TeX macros and packages through its e-TeX foundation.[8]Licensing and Availability
XeTeX is distributed under the X11 License, a permissive open-source license that allows free use, modification, distribution, and incorporation into both academic and commercial projects without restrictive requirements.[12] The engine is integrated into prominent TeX distributions, including TeX Live since its 2007 release, MiKTeX on Windows, and MacTeX on macOS, enabling users to access it through standard installation packages without separate downloads in most cases.[13][14][15] Source code and development resources are hosted on the project's SourceForge repository, from which users can obtain the latest versions for compilation or contribution.[16] Originally developed with native support for macOS in its 2004 initial release, XeTeX was ported to Linux and Windows in 2006, providing cross-platform compatibility via these major TeX distributions on Unix-like systems, Windows, and macOS.[2] Documentation is available through the TeX Users Group at tug.org/xetex, and downloads via TeX distributions like TeX Live.[3]Technical Operation
Processing Workflow
XeTeX operates through a two-stage processing pipeline to generate output from input TeX source files. In the initial stage, the XeTeX engine compiles the source into an extended DVI format known as XDV (xdv), which incorporates detailed glyph positioning, font references, and layout instructions derived from the typesetting computations. This xdv file serves as an intermediate representation that preserves the full fidelity of the TeX processing without the constraints of traditional DVI's limited character set support. The second stage involves converting the xdv file to a final PDF output using a dedicated driver program, ensuring compatibility with modern document viewers.[10] The default driver for this conversion has evolved across XeTeX versions to enhance portability and performance. Starting with version 0.997, xdvipdfmx became the standard driver across all supported platforms, leveraging its robust handling of fonts, images, and PDF features originally developed for Asian typography in pdfTeX workflows. This shift improved cross-platform consistency and integration with system resources. An earlier alternative driver, xdv2pdf, was used for PDF generation on macOS but was discontinued as of version 0.9999 to streamline development and focus on xdvipdfmx's more mature capabilities. A core innovation of the xdv format is its direct embedding of Unicode character codes and font metrics, which allows XeTeX to bypass the 8-bit encoding limitations inherent in classical TeX and traditional DVI files. By storing glyph indices and font descriptors natively within the xdv stream, the format enables seamless access to system-installed fonts (such as OpenType and TrueType) during the driver conversion, facilitating high-fidelity rendering of complex layouts without requiring intermediate font conversion or encoding mappings. This approach supports Unicode's full range (up to U+10FFFF) throughout the pipeline, promoting accurate representation of international text and typographic features in the resulting PDF.[10] XeTeX also supports XeLaTeX, a configuration that combines the XeTeX engine with the LaTeX macro package via a dedicated format file and wrapper script, simplifying document preparation for users familiar with LaTeX syntax while leveraging XeTeX's advanced font and Unicode capabilities. The xelatex executable acts as this wrapper, automatically loading the appropriate LaTeX format (xelatex.fmt) and invoking XeTeX for processing, which follows the same two-stage workflow to produce PDF output. This integration allows LaTeX documents to benefit from XeTeX's features without manual engine specification.[17]Font and Unicode Handling
XeTeX provides native support for Unicode, enabling direct processing of UTF-8 encoded input files without the need for transliteration or additional encoding packages. This allows users to include international characters seamlessly in source documents, as the engine reads Unicode text up to 1,114,111 characters via primitives like\Uchar. Input normalization options, such as NFC or NFD, can be configured using \XeTeXinputnormalization to handle character decomposition consistently.[18][19]
For font integration, XeTeX primarily utilizes system-installed OpenType fonts, accessing them directly from the operating system's font database to support advanced glyph rendering and shaping. It includes fallback mechanisms to Graphite for complex script shaping in fonts that require it, specified via the /GR renderer, and to Apple Advanced Typography (AAT) on macOS systems using the /AAT renderer for legacy font features. Fonts in formats like .otf, .ttf, and .pfb can be loaded using the \font primitive with identifiers in square brackets, such as [fontname], enabling straightforward access to installed resources.[18][8]
In XeLaTeX, the fontspec package facilitates font loading through the \fontspec command, which allows specification of font families, weights, styles, and options like ligature activation for enhanced typographic control. This command integrates with the underlying XeTeX engine to select and configure fonts dynamically, supporting both named system fonts and file paths.[20]
XeTeX supports a range of OpenType features for precise glyph selection and positioning, including kerning adjustments via the +kern tag to ensure optically consistent spacing between characters. Optical margins are managed through protrusion controls like \XeTeXprotrudechars, which enable hanging punctuation and letterforms at line edges for improved ragged margin alignment (set to 0 for off, 1 for on without line-breaking impact, or 2 for protrusion affecting hyphenation). Variant glyphs, such as alternates or stylistic sets, are accessed using feature tags like +aalt or \XeTeXglyph, often configured via font feature files in fontspec to apply discretionary substitutions.[18][20]
Capabilities
Script and Language Support
XeTeX provides robust support for a wide array of writing systems through its integration of Unicode text encoding and OpenType font technologies, enabling the handling of left-to-right (LTR), right-to-left (RTL), and vertical scripts without relying on legacy 8-bit encodings.[10] This foundation allows for the rendering of complex layouts, where OpenType shaping engines apply script-specific glyph substitutions, positioning, and ligatures to ensure accurate typographic representation.[2] For scripts lacking full OpenType coverage, XeTeX incorporates Graphite font technology, which offers an alternative shaping mechanism for advanced layout features in non-Roman scripts.[21] Right-to-left scripts, such as Arabic and Hebrew, benefit from XeTeX's implementation of the Unicode bidirectional algorithm, which determines text directionality based on character properties and reorders mixed LTR/RTL content accordingly.[10] However, for comprehensive RTL support including proper joining and cursive connections in Arabic, additional packages like arabxetex or bidi are required; these facilitate paragraph-level reordering, contextual glyph forms, and integration with LaTeX environments to handle the script's inherent complexity.[2] The bidi package, in particular, extends XeTeX's capabilities by providing TeX primitives for bidirectional typesetting, ensuring that RTL text flows correctly while embedding LTR elements like numbers or Latin insertions. XeTeX excels in East Asian typesetting, offering full coverage for Chinese, Japanese, and Korean (CJK) languages through vertical writing modes supported by OpenType and Apple Advanced Typography (AAT) fonts.[10] This includes glyph rotation, tate (vertical) layout adjustments, and line-breaking rules tailored to character-based languages without spaces, allowing seamless horizontal-to-vertical transitions in documents. For South Asian scripts, such as Devanagari and other Indic systems, XeTeX employs OpenType features to manage conjunct characters—clusters of consonants and vowels formed through reph, matra, and halant substitutions—ensuring faithful reproduction of syllabic structures.[2] A key advantage of XeTeX is its ability to produce multilingual documents that mix disparate scripts, such as English alongside Hebrew or Arabic, directly within a single Unicode input stream, obviating the need for separate preprocessing steps or multiple engine runs.[10] This is achieved by leveraging the underlying font handling mechanisms to map Unicode codepoints to appropriate glyphs across scripts, with the bidirectional algorithm resolving any directional conflicts. XeTeX provides limited support for emoji characters, rendering them in black and white if supported by the font. Full color emoji output is not natively supported and requires workarounds, such as including images or using specialized packages.[22]Typographic and Mathematical Features
XeTeX enhances microtypography through the integration of packages like microtype, which supports character protrusion for justified text alignment. Protrusion allows certain glyphs, such as punctuation marks, to extend slightly beyond the margins, creating more uniform optical edges and reducing the ragged appearance of justified lines. This feature is particularly effective for hanging punctuation, where opening quotes and closing punctuation protrude into the left or right margins, respectively, to maintain even visual margins without altering the text block's geometric alignment. Optical margins are further improved by these adjustments, ensuring that the overall page layout appears balanced, especially in book design. However, font expansion—stretching or shrinking glyphs to optimize line breaks—is not supported in XeTeX, limiting its microtypographic adjustments compared to engines like pdfTeX or LuaTeX.[23] A key strength of XeTeX lies in its access to font-specific OpenType features via the fontspec package, enabling fine-grained typographic control. Users can activate old-style figures, which align numerically with lowercase letters for a more harmonious appearance in running text, by specifying theNumbers=OldStyle option; for example, numerals in fonts like TeX Gyre Adventor shift to a lowercase style. Similarly, small capitals can be invoked with Letters=SmallCaps, converting lowercase letters to scaled uppercase variants suitable for headings or emphasis, as supported in modern OpenType fonts. Swashes, decorative flourishes on letters, are accessible through Style=Swash or dedicated feature sets, allowing elegant alternates in script or italic faces for enhanced aesthetic variety. These options leverage XeTeX's native OpenType handling, providing typographers with precise control over font variations without manual glyph substitution.
For mathematical typesetting, XeTeX integrates seamlessly with the unicode-math package, which implements Unicode-based mathematics using OpenType math fonts. This setup supports a wide range of mathematical symbols directly via Unicode input, eliminating the need for legacy TeX math codes and enabling natural entry of expressions like integrals or summations. Spacing and delimiters are automatically managed according to OpenType math tables, which define metrics for horizontal and vertical positioning, accent placement, and fraction rules, ensuring consistent rendering across different fonts such as Latin Modern Math or STIX Two Math. The package requires an OpenType font with math table support and works exclusively with XeTeX or LuaTeX, providing extensible commands for customizing math styles (e.g., upright or italic symbols) while preserving TeX's traditional spacing algorithms.[24]
XeTeX's Unicode input capabilities extend to bibliographic handling, allowing direct inclusion of Unicode characters in .bib files when paired with tools like biblatex and its biber backend, which fully support UTF-8 encoded entries for multilingual references. This facilitates accurate rendering of non-Latin scripts or special symbols in citations without resorting to TeX macros, streamlining workflows for international scholarship.
Practical Usage
Basic Implementation
XeLaTeX, the LaTeX interface to XeTeX, enables straightforward document creation by incorporating the fontspec package for font management. A basic setup begins with the standard\documentclass{article} declaration, followed by loading the fontspec package via \usepackage{fontspec} in the preamble, and selecting a main font using the \setmainfont{FontName} command, where FontName refers to an available system font supporting the desired scripts.[20][3]
For a minimal multilingual document, consider the following example that incorporates English, Greek, and Cyrillic text:
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Noto Serif} % A font supporting multiple scripts
\begin{document}
English: Hello! Greek: Γειά σου! Cyrillic: Привет!
\end{document}
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Noto Serif} % A font supporting multiple scripts
\begin{document}
English: Hello! Greek: Γειά σου! Cyrillic: Привет!
\end{document}
xelatex filename.tex, assuming the source file is encoded in UTF-8, which XeTeX processes directly without additional encoding declarations.[3][20]
By default, XeTeX generates PDF output that embeds subsets of the used fonts, ensuring portability and consistent rendering across viewers without requiring external font installations.
Advanced Configurations
Advanced configurations in XeTeX enable the handling of complex multilingual documents through integrated packages that manage bidirectional text and sophisticated font manipulations. The polyglossia package facilitates seamless language switching in XeTeX documents, allowing users to define primary and secondary languages such as English and Arabic, while integrating with the bidi package to control bidirectional paragraphs for mixed left-to-right (LTR) and right-to-left (RTL) content.[25] For instance, commands like\setmainlanguage{english} and \setotherlanguage{arabic} establish the document's linguistic structure, with bidi ensuring proper paragraph directionality in RTL sections, preventing visual disruptions in hybrid texts.[25]
A practical application of this integration appears in RTL documents using the arabxetex package, which extends XeTeX's capabilities for Arabic-script languages by processing input via TECkit mappings to Unicode and rendering bidirectional text with embedded LTR elements, such as Western numerals in Arabic sentences.[26] In an example setup, arabxetex vocalizes Arabic text in three modes while maintaining LTR orientation for numbers, as in typesetting phrases like "العدد 123" where the digits flow left-to-right within the RTL context; this is achieved through XeTeX's native Unicode bidirectional algorithm, briefly referencing core RTL mechanics for script support.[26] Such configurations are particularly useful for critical editions or Quranic texts, where arabxetex combines with tools like ednotes for layered bidirectional rendering.[26]
XeTeX's advanced font features, accessed via the fontspec package, allow loading of OpenType variable fonts for dynamic adjustments like weight interpolation, enhancing typographic flexibility in multilingual setups.[20] For example, the command \setmainfont[FontWeight=500]{VariableFont} interpolates along the font's weight axis to produce intermediate boldness levels, supporting continuous variation without discrete style files; this is especially effective for scripts requiring nuanced emphasis in variable OpenType fonts.[20] Complementing this, XeTeX supports Graphite shaping for non-standard scripts through font-specific features, enabling custom glyph positioning and diacritic stacking beyond standard OpenType.[27] A representative case is rendering Burmese text with the Padauk/GR Graphite font, declared as \font\myfnt="Padauk/GR" at 7.5pt and paired with \XeTeXlinebreaklocale "my" for locale-aware line breaking in space-less scripts, ensuring accurate stacking of matras and conjuncts.[27][28]
For East Asian languages, XeTeX configurations handle CJK vertical writing by combining font selection with direction commands in the xeCJK package, which adapts CJK typesetting for vertical flow.[29] An example involves setting a vertical font family with \setCJKfamilyfont{vert}[Script=CJK]{SimSun} and switching modes via \CJKvert to rotate glyphs appropriately, producing upright vertical text such as "朝发轫于苍梧兮" flowing top-to-bottom; this requires fonts with vertical metrics and may incorporate OpenType features like +vert for punctuation adjustment.[29]

