XeTeX

XeTeX

Discussion

Encyclopedia
XeTeX is a TeX
TeX
TeX is a typesetting system designed and mostly written by Donald Knuth and released in 1978. Within the typesetting system, its name is formatted as ....

typesetting engine
Typesetting
Typesetting is the composition of text by means of types.Typesetting requires the prior process of designing a font and storing it in some manner...

using Unicode
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

and supporting modern font technologies such as OpenType
OpenType
OpenType is a format for scalable computer fonts. It was built on its predecessor TrueType, retaining TrueType's basic structure and adding many intricate data structures for prescribing typographic behavior...

Apple Advanced Typography is Apple Inc's computer software for advanced font rendering, supporting internationalization and complex features for typographers, a successor to Apple's little-used QuickDraw GX font technology of the mid-1990s...

(AAT). It is written and maintained by Jonathan Kew and distributed under the X11 free software license
The MIT License is a free software license originating at the Massachusetts Institute of Technology . It is a permissive license, meaning that it permits reuse within proprietary software provided all copies of the licensed software include a copy of the MIT License terms...

.

Initially developed for Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

only, it is now available for all major platforms. It natively supports Unicode and the input file is assumed to be in UTF-8
UTF-8
UTF-8 is a multibyte character encoding for Unicode. Like UTF-16 and UTF-32, UTF-8 can represent every character in the Unicode character set. Unlike them, it is backward-compatible with ASCII and avoids the complications of endianness and byte order marks...

encoding by default. XeTeX can use any fonts installed in the operating system without configuring TeX font metric
TeX font metric
TeX font metric is a font file format used by the TeX typesetting system. It is a font metric format, not an outline font format like TrueType, because it provides only the information necessary to typeset the font such as each character's width, height and depth. The actual glyphs are stored...

s, and can make direct use of advanced typographic features of OpenType
OpenType
OpenType is a format for scalable computer fonts. It was built on its predecessor TrueType, retaining TrueType's basic structure and adding many intricate data structures for prescribing typographic behavior...

, AAT
Apple Advanced Typography is Apple Inc's computer software for advanced font rendering, supporting internationalization and complex features for typographers, a successor to Apple's little-used QuickDraw GX font technology of the mid-1990s...

and Graphite
Graphite (SIL)
Graphite is a programmable Unicode-compliant smart-font technology and rendering system developed by SIL International. It is free software, distributed under the terms of the GNU Lesser General Public License and the Common Public License....

technologies such as alternative glyph
Glyph
A glyph is an element of writing: an individual mark on a written medium that contributes to the meaning of what is written. A glyph is made up of one or more graphemes....

s and swashes
Swash (typography)
A swash is a typographical flourish on a glyph, like an exaggerated serif.Capital swash characters, which extended to the left, were historically often used to begin sentences. There were also minuscule swash characters, which came either extending to the left, to begin words, or to the right to...

, 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
Microtypography
Microtypography is the name given to a range of methods for improving the readability and appearance of text, especially justified text. The methods reduce the appearance of large interword spaces and create edges to the text that appear more even.- Methods :...

is also supported. XeTeX also supports typesetting mathematics using Unicode fonts that contain special mathematical features, such as Cambria Math or Asana Math
Asana-Math
Asana-Math is a Palatino-like OpenType mathematical font with advanced layout features based on the undocumented Microsoft mathematical OpenType layout extensions. It was developed by Apostolos Syropoulos, based on the Type 1 pxfonts by Young Ryu. Asana-Math is freely available under the Open Font...

as an alternative to the traditional mathematical typesetting based on TeX font metrics.

Mode of operation

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 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 AAT
Apple Advanced Typography is Apple Inc's computer software for advanced font rendering, supporting internationalization and complex features for typographers, a successor to Apple's little-used QuickDraw GX font technology of the mid-1990s...

, and only works on Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

.
• xdvipdfmx, a modified version of dvipdfmx, which in turn uses a modified version of ICU
International Components for Unicode
International Components for Unicode is an open source project of mature C/C++ and Java libraries for Unicode support, software internationalization and software globalization. ICU is widely portable to many operating systems and environments. It gives applications the same results on all...

on top of standard FreeType
FreeType
FreeType is a software library written in C that implements a font rasterization engine. It is used to render text on to bitmaps and provides support for other font-related operations.-Details:...

and fontconfig
Fontconfig
Fontconfig is a computer program library designed to provide system-wide font configuration, customization, and application access. Fontconfig is written and was originally maintained by Keith Packard...

. This driver works on all platforms.

Starting from version 0.997, the default driver is xdvipdfmx on all platforms.

XeTeX works well with both LaTeX
LaTeX
LaTeX is a document markup language and document preparation system for the TeX typesetting program. Within the typesetting system, its name is styled as . The term LaTeX refers only to the language in which documents are written, not to the editor used to write those documents. In order to...

and ConTeXt
ConTeXt
ConTeXt is a general-purpose document processor. It is especially suited for structured documents, automated document production, very fine typography, and multi-lingual typesetting. It is based in part on the TeX typesetting system, and uses a document markup language for manuscript preparation...

macro packages. Its LaTeX counterpart is invoked as xelatex. 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.

XeTeX is bundled with the TeX Live
TeX Live
TeX Live is a TeX distribution which is the replacement of its no-longer supported counterpart teTeX.It is now the default TeX distribution for several Linux distributions such as Fedora, Debian, Ubuntuand Gentoo....

2010, MacTeX
MacTeX
MacTeX is a redistribution of TeX Live. While TeX Live is designed to be cross-platform , MacTeX includes Mac-specific utilities and front-ends...

2010 and MiKTeX
MiKTeX
MiKTeX is a typesetting system for Microsoft Windows that is developed by Christian Schenk. It consists of an implementation of TeX and a set of related programs....

2.8 distributions.

Example

The following is an example of XeLaTeX source and rendered output. The typeface used is OFL
The SIL Open Font License is a free and open source license designed for fonts by SIL International for use with some of their Unicode fonts. The license is considered free by the Free Software Foundation, which states that a simple hello world program is enough to satisfy the license's requirement...

Linux Libertine
Linux Libertine is a digital typeface created by the Libertine Open Fonts Project, which aims to create free and open alternatives to Proprietary software typefaces such Times Roman...

. The text is to be processed by the command xelatex.
 \documentclass[11pt]{article} \usepackage{xltxtra} \setmainfont[Mapping=tex-text]{Linux Libertine O} \begin{document} \section{Unicode support} \subsection{English} All human beings are born free and equal in dignity and rights. \subsection{Íslenska} Hver maður er borinn frjáls og jafn öðrum að virðingu og réttindum. \subsection{Русский} Все люди рождаются свободными и равными в своем достоинстве и правах. \subsection{Tiếng Việt} Tất cả mọi người sinh ra đều được tự do và bình đẳng về nhân phẩm và quyền lợi. \subsection{Ελληνικά} Ὅλοι οἱ ἄνθρωποι γεννιοῦνται ἐλεύθεροι καὶ ἴσοι στὴν ἀξιοπρέπεια καὶ τὰ δικαιώματα. \section{Legacy syntax} When he goes---Hello World!\\ She replies—“Hello dear!” \section{Ligatures} \fontspec[Ligatures={Common, Historical}]{Linux Libertine O Italic} \fontsize{12pt}{18pt}\selectfont Questo è strano assai! \section{Numerals} \fontspec[Numbers={OldStyle}]{Linux Libertine O}Old style: 1234567\\ \fontspec[Numbers={Lining}]{Linux Libertine O}Lining: 1234567 \end{document}

History

XeTeX was initially released for Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

only in April 2004 with built-in AAT
Apple Advanced Typography is Apple Inc's computer software for advanced font rendering, supporting internationalization and complex features for typographers, a successor to Apple's little-used QuickDraw GX font technology of the mid-1990s...

and Unicode
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

support. In 2005 support for OpenType layout features was first introduced. During BachoTeX 2006 a version for Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

was announced, which was ported to Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

by Akira Kakuto a few months later, and finally included into TeX Live
TeX Live
TeX Live is a TeX distribution which is the replacement of its no-longer supported counterpart teTeX.It is now the default TeX distribution for several Linux distributions such as Fedora, Debian, Ubuntuand Gentoo....

2007 for all major platforms. XeTeX is also shipped with MiKTeX
MiKTeX
MiKTeX is a typesetting system for Microsoft Windows that is developed by Christian Schenk. It consists of an implementation of TeX and a set of related programs....

since version 2.7.
As of the inclusion in TeX Live
TeX Live
TeX Live is a TeX distribution which is the replacement of its no-longer supported counterpart teTeX.It is now the default TeX distribution for several Linux distributions such as Fedora, Debian, Ubuntuand Gentoo....

, XeTeX supports most macro packages written for LaTeX
LaTeX
LaTeX is a document markup language and document preparation system for the TeX typesetting program. Within the typesetting system, its name is styled as . The term LaTeX refers only to the language in which documents are written, not to the editor used to write those documents. In order to...

, OpenType
OpenType
OpenType is a format for scalable computer fonts. It was built on its predecessor TrueType, retaining TrueType's basic structure and adding many intricate data structures for prescribing typographic behavior...

, TrueType
TrueType
TrueType is an outline font standard originally developed by Apple Computer in the late 1980s as a competitor to Adobe's Type 1 fonts used in PostScript...

and PostScript
PostScript
PostScript is a dynamically typed concatenative programming language created by John Warnock and Charles Geschke in 1982. It is best known for its use as a page description language in the electronic and desktop publishing areas. Adobe PostScript 3 is also the worldwide printing and imaging...

fonts without any specific setup procedure.
As of 2007, future directions in XeTeX development include:
• modular, Unicode-based Babel replacement for advanced hyphenation;
• better integration with TeX editors such as TeXShop
TeXShop
TeXShop is a free TeX editor and previewer for Mac OS X. It is licensed under the GNU GPL.It was developed by the American mathematician Richard Koch. TeXShop was created especially for the Mac OS X user interface Aqua and capitalized on the native PDF support of the Macintosh operating system...

;
• MathML
MathML
Mathematical Markup Language is an application of XML for describing mathematical notations and capturing both its structure and content. It aims at integrating mathematical formulae into World Wide Web pages and other documents...

support using Unicode math fonts.

The upcoming 0.998 version announced at BachoTeX 2008 will support Unicode normalization via the \XeTeXinputnormalization command.