XeTeX in MiKTeX - Faculteit Wiskunde en Informatica · 2 UTF-8Encoding...

5
X Ǝ T E X in MiKT E X Marko Boon [email protected] March 2012 1 X Ǝ T E X and X Ǝ L A T E X X Ǝ T E X (pronounced: z-tech) is an adaptation of the T E X typesetting system developed by Professor Donald E. Knuth of Stanford University. It was originally written for Mac OS X, but it has been incorporated in the MiKT E X distribution since version 2.7. WinEdt has a XeTeX compile button since version 6. This document describes the new X Ǝ T E X features. While T E X is an 8-bit system, processing text encoded as a stream of single bytes, and accessing fonts using single-byte character indexes, X Ǝ T E X is designed to work with Unicode text. The fundamental "characters" that X Ǝ T E X works with are 16- bit codes that are assumed to represent the UTF-16 encoding form of Unicode. The most common form of Unicode text used with X Ǝ T E X is UTF-8. X Ǝ T E X reads UTF-8 input files and converts the byte sequences into Unicode character codes automatically (without the use of additional TEX macros such as the L A T E X inputenc package). It will also automatically read files using UTF-16, should this be necessary. The second main feature of X Ǝ T E X that sets it apart from T E X is the ability to easily use Unicode-compliant fonts and work with both Mac OS X's advanced typographic services (AAT: Apple Advanced Typography) and OpenType layout features. In general, any font installed in the operating system's various Library/Fonts folders is directly available for use in a X Ǝ T E X document. Because X Ǝ T E X is so closely tied to the AAT font machinery, the concept of a DVI (device- independent) output file is not very useful. The xetex tool writes a form of ``extended DVI'' (.xdv) data to describe the typeset pages. By default, the xetex tool automatically converts this xdv file to PDF, so for your X Ǝ T E X documents the same rules apply as for PDFL A T E X: • no PostScript specials are allowed (so you cannot use psfrag). 1

Transcript of XeTeX in MiKTeX - Faculteit Wiskunde en Informatica · 2 UTF-8Encoding...

XƎTEX in MiKTEX

Marko [email protected]

March 2012

1 XƎTEX and XƎLATEX

XƎTEX (pronounced: z-tech) is an adaptation of the TEX typesetting system developedby Professor Donald E. Knuth of Stanford University. It was originally written for MacOS X, but it has been incorporated in the MiKTEX distribution since version 2.7. WinEdthas a XeTeX compile button since version 6. This document describes the new XƎTEXfeatures.While TEX is an 8-bit system, processing text encoded as a stream of single bytes, andaccessing fonts using single-byte character indexes, XƎTEX is designed to work withUnicode text. The fundamental "characters" that XƎTEX works with are 16- bit codes thatare assumed to represent the UTF-16 encoding form of Unicode. The most commonform of Unicode text used with XƎTEX is UTF-8. XƎTEX reads UTF-8 input files andconverts the byte sequences into Unicode character codes automatically (without the useof additional TEX macros such as the LATEX inputenc package). It will also automaticallyread files using UTF-16, should this be necessary.The second main feature of XƎTEX that sets it apart from TEX is the ability to easily useUnicode-compliant fonts and work with both Mac OS X's advanced typographic services(AAT: Apple Advanced Typography) and OpenType layout features. In general, any fontinstalled in the operating system's various Library/Fonts folders is directly available foruse in a XƎTEX document.Because XƎTEX is so closely tied to the AAT font machinery, the concept of a DVI (device-independent) output file is not very useful. The xetex tool writes a form of ``extendedDVI'' (.xdv) data to describe the typeset pages. By default, the xetex tool automaticallyconverts this xdv file to PDF, so for your XƎTEX documents the same rules apply as forPDFLATEX:

• no PostScript specials are allowed (so you cannot use psfrag).

1

• no Encapsulated PostScript (EPS) graphics are supported. EPS graphics shouldbe converted to PDF using the EPS2PDF shortcut on your desktop or in yourMiKTEX start menu group.

• JPG and PNG images can be used without having to specify the bounding box.

XƎLATEX is the LATEX equivalent of XƎTEX. Some packages have been written to enablethe new features:

fontspec defines LaTeX commands to load system fonts.

xunicode needed to display some special characters correctly, like %, and $.

xltxtra some general improvements, defines the XƎTEX logo.

To compile this document, select the XeLaTeX option from the drop-down list in WinEdt(see Figure 1).

Figure 1: XeLaTeX in WinEdt 6.

2

2 UTF-8 Encoding

Please note that if you want to use special (international) characters like é, ë, ï, or €,you should save your document in UTF-8 format. WinEdt only supports UTF-8 fullysince version 7 (released in March 2012). More information about working with UTF-8encoded files in WinEdt can be found in WinEdt if you click on the menu item Document→ Samples → UTF-8 Demo. Some parts that are relevant for XƎTEX are copied below:WinEdt is a unicode editor with support for UTF-8 or code page-specific encoding. UTF-8 is the default format for TeX documents. This can be configured through the Unicodesection of the Options interface (or through the Unicode page in Preferences dialog).Help explains the details.A comment in the beginning of a TeX document:

% !Mode:: "TeX:UTF-8"

will ensure that a document is properly loaded and saved.

3 Loading System Fonts

The default fonts for the document can be set with the following commands:

\setmainfont{Arial}\setmonofont{Lucida Console}\setsansfont{Comic Sans MS}

This text uses the Comic Sans MS as Sans Serif Font: Reëel, café, geïrriteerd, €,$ %If you want to overrule the default font at a certain location in your text, you should usethe \fontspec{font name} command: This text is typeset in Comic Sans MS.

4 Images and Graphics

This section shows the usage of the supported graphics formats: JPG, PNG and PDF.

3

JPG image

PNG image

PDF image

This image was originally an EPS image which has been converted to PDF using theEPS2PDF shortcut on your desktop.

4

0

0.6

1.2

1.8

2.4 3

3.6

4.2

4.8

5.4 6

sin(x)

-1

-0.5

0

0.5

1

sin(x) and cos(x)

sin(x)

cos(x)

5 Mathematics

If you use the no-math option with the fontspec package, mathematics are still typesetin the original font (in this case Computer Modern):

∫ 2π

0sinx dx

6 More information

More information about XƎTEX can be found on the web site: http://scripts.sil.org/xetex.Documentation about the fontspec package (and all other installed LATEX packages) canbe found in the MiKTeX Start menu group: Documentation → LaTeX Packages Help.

5