XeTeX - Old Content
XeTeX is a new TeX engine by Jonathan Kew and SIL International, which combines eTeX with pervasive Unicode support and advanced font support (multiple language, special AAT and OpenType font features, trivial font installation). It does this by leveraging Apple Advanced Typography support on MacOSX, so it gains its strength in features by sacrificing TeX's usual cross-platformness, and some backwards compatibility.
XeTeX and ConTeXt
XeTeX is a potential replacement for pdfeTeX in the ConTeXt workflow. It does not support all of the fancy PDF features found with pdfeTeX, but it supports most core features (see Features and Limitations on this page). Common consensus is that for text with non-heavy mathematics needs, XeTeX should be an interesting alternative.
(N.B.: The instructions described on this and other pages apply only to texexec versions 5.2.3 and up, and ConTeXt 2004.11.23 or later, which seems to correspond with TeXLive 2004.)
The best and easiest way of installing XeTeX on MacOSX is by using Gerben Wierda's i-Installer. After that, there is currently (1 December 2004) one configuration file change that you are likely to need. (If you don't find the configuration line that follows, just jump to Basic Installation on this page!)
XeTeX currently doesn't accept or ignore the -translate-file option that Hans has chosen as a default for normal ConTeXt operation. I haven't figured out how to run different "profiles" or configurations within my current installation, so I just edited the following lines in /usr/local/teTeX/share/texmf.local/context/config/texexec.ini (or wherever texexec finds its configuration file) from:
for tetex set TeXPassString to -progname=context --default-translate-file=cp8bit for tetex set TeXVirginFlag to -ini -translate-file=natural.tcx
for tetex set TeXPassString to -progname=context % and perhaps -shell-escape for tetex set TeXVirginFlag to -ini
(In other words, cut out the -translate-file-like options from the tetex set of parameters. Your actual settings may vary!)
I believe that's all that's necessary to change from the default or commonly recommended settings. I run ConTeXt with both pdfetex and XeTeX under this configuration, and it seems to work well enough (except for a minor warning in pdfTeX).
After XeTeX being installed and ConTeXt being updated, you should make a format with texexec:
For XeTeX 0.9(and after), you need to check that syst-xtx.tex(/texmf.local/tex/context/base/) contained the following lines:
\immediate\openin\scratchread=unicode-letters.tex \ifeof\scratchread \immediate\openin\scratchread=xplain.tex \ifeof\scratchread % no initialization file \else \input xplain.tex \fi \else \input unicode-letters.tex \fi
Now, make a format.
texexec --make --xtx en
This will generate cont-en.xfmt, which will be used when running XeTeX and ConTeXt.
For For XeTeX 0.9(and after), it will gernerate cont-en.fmt.
(If you receive permissions errors, then you may need to precede the above command with sudo:)
sudo texexec --make --xtx en
If you have later problems, make sure that the cont-en.xfmt file was placed in the correct directory for formats, typically /usr/local/teTeX/share/texmf.local/web2c/.
For For XeTeX 0.9(and after), create a folder xetex in the folder /usr/local/teTeX/share/texmf.local/web2c/, and put created format cont-en.fmt in it. (You may move xetex.fmt and xelatex.fmt in it, too.
Don't forget to texhash!
XeTeX is invoked with the --xtx switch in texexec. This loads the XeTeX-specific specials, typescripts and other commands, and actually runs ConTeXt within XeTeX. Technically, XeTeX is an eTeX-like processor, and outputs an .xdv file. After texexec's final XeTeX run, texexec runs xdv2pdf in order to create a PDF file.
texexec --xtx myfile.tex
For the normal ConTeXt file,
texexec --pdf myfile.tex
XeTeX is able to handle UTF-8 or UTF-16 documents natively, without any interference or configuration from ConTeXt. If you do want ConTeXt to process UTF-8 characters specially, then you can activate it with \enableregime[utf]. Be aware that you are then limited by the named glyphs that exist in the unicode vector files (unic-0xx). However, it is generally desirable to enter UTF documents without any regime notated, and let XeTeX work its magic.
You don't have to encode documents in UTF, though. ConTeXt allows you to use the regime of your choice because of its use of named glyphs, so documents in latin-1 or even MacRoman encoding can be supported, given the proper \enableregime command. For characters out of reach of the given regime, you can use accents (like \'e) and/or named glyphs (\eacute).
Although XeTeX would prefer that you key in documents in full Unicode, with things like — and “ in the place of --- and
, respectively. This is not always so feasible, so it provides a mechanism for inserting these "TeXish" ligatures. In a font specification, you need to insert mapping=tex-text as one of the font features. This is already done for all existing typescripts in type-xtx, but you should be aware of this concern if designing your own documents.
From there, things proceed fairly normally. Fonts in XeTeX get their own page, as they introduce some new features. Here are some new features that might be of interest:
- Unicode symbol sets
- While not exclusive to XeTeX, exactly, you get easy access to named Unicode Symbols. XeTeX-specific commands switch to Apple-supplied default fonts for these symbols.
- Basic Bi-directional text
- ConTeXt support for this was ushered in with XeTeX, but is fundamentally an eTeX feature. There is tentative support for direction changing with \pardir TRT and TLT, emulating Omega/Aleph's commands. These should be seen as low-level commands, to be intgrated with language switching, for example. There is a bad feature interaction between this and specials (e.g., color) support.
- Alternate script number conversions
- Hans introduced some clever machinery into the conversion macros, allowing one to efficiently define a conversion vector (\defineconversionvector) for script-specific numbers. Arabic and Persian are provided.
- More Unicode
- In the process of preparing XeTeX support in ConTeXt, many more Unicode glyphs were named and introduced into ConTeXt, including some Greek, Cyrillic, and Vietnamese.
- There are a number of typescripts defined to get a XeTeX user started.
- Font metrics
- XeTeX 0.88 is not yet able to retrieve character-specific font metrics from Apple's type API, so measurements based on character-specific units may fail or be unreliable.
- Grid typesetting
- many fonts on the Mac report larger vertical metrics than their font size. Because ConTeXt sets \lineskiplimit to zero, grid dimensions are limited by these intrinsic (and seemingly arbitrary) font characteristics. As a result, grid typesetting, with some fonts, won't work below approximately 1.25 times the font size. Hoefler Text seems to work on a 12/12 grid, however.
- Paper size
- XeTeX 0.88 is not yet able to support multiple paper sizes. The way texexec is arranged locks one in to the default paper size. Support will improve when XeTeX addresses the issue. If you need another paper size, you can re-run xdv2pdf with a paper size of your choice from the command line:
xdv2pdf -p a5:landscape file.xdv
(Alternatively, you can use
texexec --xtx --passon=-papersize=a5:landscape file
or something similar. Christopher Creutzig)
- Object reuse
- Currently, the XeTeX specials are unable to use ConTeXt's object (or faked object) support. As a result, repeated external figures may be included into the PDF several times, resulting in an increase in file sizes. This has not been tested.
- XeTeX uses dvipdfmx's specials for references, bookmarks, and the like. ConTeXt uses some of these specials "out of spec", and may result in some strangeness in certain documents.
- PDF Literals
- Because XeTeX relies on Apple's APIs to create PDFs, it is unable to take advantage of certain specials and other types of features that use native (literal) PDF commands.
- Occasionally Explodes
- Once in a while, XeTeX will fall into an infinite loop. I'm not entirely sure what circumstances trigger it (probably an overfull box), but it can be stopped with killall xetex in a terminal window. This has now been traced to a setting in texmf.cnf, where extra_mem_bot.context or extra_mem_bot is set to a non-zero value. If you encounter the infinite loop, then check your texmf.cfg file(s) to eradicate this value. (fixed in 0.90+)
- Hoefler Italic is too fancy
- Hoefler Italic has swashes enabled by deault. This is actually a product of Apple's implementation of the font. If this is unsuitable for you, add the feature: Smart Swashes=!Line Final Swashes to the HoeflerItalic font synonym in type-xtx.