%!TEX TS-program = XeLaTeX \documentclass[12pt]{article} \suppressfontnotfounderror=1 \makeatletter \def\@dotsep{999} \usepackage{fontspec,xltxtra,xunicode} \setromanfont[Mapping=tex-text, Scale=MatchLowercase]{TeX Gyre Pagella} \setsansfont[Mapping=tex-text, Scale=MatchLowercase]{TeX Gyre Heros} \setmonofont[Scale=MatchLowercase]{Inconsolata} \usepackage{calc,fancyvrb,hyperref,refstyle,varioref,xcolor} \usepackage{geometry} %\geometry{screen,margin=3cm} \def\PDF{\textsc{pdf}} \hypersetup{colorlinks,linkcolor=black,urlcolor=black} \usepackage[it]{titlesec} \usepackage{enumitem} \setlist{nolistsep} \newenvironment{optdesc} {\begin{description}[font=\ttfamily,style=nextline,leftmargin=1.5cm]} {\end{description}} \newcommand\cmd{% \noindent \begin{trivlist}\item[] \SaveVerb[% aftersave={% \begin{minipage}{\linewidth} \parindent=2em\relax\noindent \UseVerb{CMD}}]{CMD}} \edef\|{|} \DefineShortVerb{\|} \newcommand\xarg[1]{\texttt‹{\rmfamily\itshape #1}\texttt›} \def\<#1>{\xarg{#1}} \newcommand\oarg[1]{\texttt{[\,#1\,]}} \newcommand\desc[1]{\par\noindent\ignorespaces#1\par} \def\endcmd{% \end{minipage} \end{trivlist}} \def\cs#1{\texttt{\textbackslash#1}} \newsavebox\verbatimbox \edef\examplefilename{\jobname.example} \newlength\exampleindent \setlength\exampleindent{1em} \newenvironment{example} {\VerbatimEnvironment \begin{VerbatimOut}{\examplefilename}} {\end{VerbatimOut} \typesetexample} \newcommand\typesetexample{% \begin{trivlist}\item[] \vrule \hspace{\exampleindent} \begin{minipage}{\linewidth-\exampleindent} \textit{Example:}\par \vspace{0.4\baselineskip} \BVerbatimInput[fontsize=\small]{\examplefilename}\par \vspace{0.4\baselineskip} \color[rgb]{0.7,0,0}\input\examplefilename\relax \end{minipage}\par \end{trivlist}} \let\strong\textbf \providecommand\pdfTeX{pdf\/\TeX} \newcommand\hlink[2]{\href{#1}{#2}\footnote{\url{#1}}} \let\latin\textit \def\eg{\latin{e.g.}} \def\ie{\latin{i.e.}} \def\Eg{\latin{E.g.}} \def\Ie{\latin{I.e.}} \def\etc{\@ifnextchar.{\latin{etc}}{\latin{etc.}\@}} \def\opteq{\unskip\,\textcolor{gray}{[\textcolor{black}{=}]}\,} \setlength\parskip{0pt} \setlength\parindent{2em} \raggedbottom \begin{document} \title{The \texorpdfstring{\XeTeX}{XeTeX} reference guide} \author{Will Robertson} \maketitle \vfill \section*{Introduction} This document serves to summarise \XeTeX's additional features without being so much as a `users' guide'. Note that much of the functionality addressed here is provided in abstracted form in various \LaTeX\ packages and Con\TeX{}t modules. The descriptions here should be a fairly exhaustive list of the new primitives and features of \XeTeX. Descriptions are still a little aenemic, however. I don't have much time to maintain this document, so contributions are highly welcomed \verb|:)| \section*{License} Copyright 2007--2010 Will Robertson. This work, \verb|XeTeX-reference.ltx|, also known as `\verb|xetexref|', is distributed under the terms of the LaTeX Project Public License \textup(\,\url{http://www.latex-project.org/lppl.txt}\,\textup), version 1.3c or later (your choice), and maintained by Will Robertson. This basically means you are free to re-distribute this file as you wish; you may also make changes to this file or use its contents for another purpose, in which case you should make it clear, by way of a name-change or some other means, that your changed version is a modified version of the original. Please read the license text for more detailed information. \vfill\vfill\vfill\null \newpage \tableofcontents \part{\texorpdfstring{\XeTeX}{XeTeX}\ specifics} \section{The \cs{font} command} The |\font| command has seen significant addition in \XeTeX\ to facilitate extended font feature selection. Under \TeX, fonts were selected like so: |\font\1="|\xarg{tfm name}|"| with various options appended such as `|at 10pt|' or `|scaled 1.2|', with obvious meaning. This syntax still works, but it has been greatly extended in \XeTeX. The extended syntax looks something like\par {\centering|\font\1="|\xarg{font identifier}\xarg{font options}|:|\xarg{font features}|"| \xarg{\TeX\ font features}\par}\noindent The \xarg{font identifier} is the only mandatory part of the above syntax. It is either a declared name of a font (e.g., `|Latin Modern Roman|') or a font file name in square brackets (e.g., |[lmroman10-regular]|). When using a font name, the font is looked up through the operating system, using (except on Mac~OS~X) the |fontconfig| library. Running |fc-list| should show you the font names available. \Eg, |\font\1="Liberation Serif"| \hfill \emph{look for OS-installed font} When using a file name, the |xdvipdfmx| driver must be used (this is the default), and the file name must be surrounded with square brackets. The current directory and the |texmf| trees are searched for files matching the name, or the path may be embedded in the font declaration, as usual with |kpathsea|. \Eg, \begin{quote}\small |\font\2="[lmroman10-regular]"| \hfill {\em find |lmroman10-regular.otf| in any tree} |\font\3="[/myfonts/fp9r8a]"| \hfill {\em look for |fp9r8a| only in |/myfonts/|} \end{quote} A file with either an |.otf| or |.ttf| extension will be found. The extension can also be specified explicitly. (Aside: if you load |luaotfload.sty|, you can use this same syntax in Lua\TeX, which doesn't provide \TeX-layer syntax by default. The |luaotfload| package works in plain \TeX\ and \LaTeX.) \subsection{Font options} \xarg{Font options} are only applicable when the font is selected through the operating system (\ie, without square brackets). They may be any concatenation of the following: \begin{optdesc} \item[/B] Use the bold version of the selected font. \item[/I] Use the italic version of the selected font. \item[/BI] Use the bold italic version of the selected font. \item[/IB] Same as \texttt{/BI}. \item[/S=$x$] Use the version of the selected font corresponding to the optical size $x$\,pt. \item[/AAT] Explicitly use the ATSUI renderer (Mac~OS~X only). \item[/ICU] Explicitly use the ICU OpenType renderer. \item[/GR] Explicitly use the Graphite font\footnote{\url{http://scripts.sil.org/RenderingGraphite}} renderer. \end{optdesc} \subsection{Font features} The \xarg{font features} is a comma or semi-colon separated list activating or deactivating various OpenType, Graphite, or AAT font features, which will vary by font. The \XeTeX\ documentation files \path{aat-info.tex} and \path{opentype-info.tex} provide per-font lists of supported features. \subsubsection{Arbitrary OpenType, Graphite, or AAT features} OpenType font features are chosen with \hlink{http://www.microsoft.com/typography/otspec/featuretags.htm}{standard tags}. They may be either comma- or semicolon-separated, and prepended with a |+| to turn them on and a |-| to turn them off. \begin{example} \font\liber="Linux Libertine O/I=5:+smcp" at 12pt \liber This is the OpenType font Linux Libertine in italic with small caps. \end{example} Varying depending on the language and script in use (see \secref[vref]{script}), a small number of OpenType features, if they exist, will be activated by default. AAT font features and Graphite font features are specified by strings within each font rather than standardised tags. Therefore, even equivalent features between different fonts can have different names. \begin{example} \font\gra="Charis SIL/GR:Small Caps=True" at 12pt \gra This is the Graphite font Charis SIL with small caps. \end{example} \subsubsection{Options for all fonts} Some font features may be applied for any font. These are \begin{optdesc} \item[mapping=\textsl{}] Uses the specified font mapping for this font. This uses the TECKit engine to transform unicode characters in the last-minute processing stage of the source. For example, |mapping=tex-text| will enable the classical mappings from ugly ascii |``---''| to proper typographical glyphs ``---'', and so on. \item[color={\slshape RRGGBB}{[{\slshape TT}]}] Triple pair of hex values to specify the colour in RGB space, with an optional value for the transparency. \item[letterspace=$x$] Adds $x/S$ space between letters in words, where $S$ is the font size. \item[embolden=$x$] Increase the envelope of each glyph by the set amount (this makes the letters look `more bold'). $x=0$ corresponds to no change; $x=1.5$ is a good default value. \item[extend=$x$] Stretch each glyph horizontally by a factor of $x$ (i.e., $x=1$ corresponds to no change). \item[slant=$x$] Slant each glyph by the set amount. $x=0$ corresponds to no change; $x=0.2$ is a good default value. The slant is given by $x=R/S$ where $R$ is the displacement of the top edge of each glyph and $S$ is the point size. \end{optdesc} \subsubsection{OpenType script and language support}\seclabel{script} OpenType font features (and font behaviour) can vary by \hlink{http://www.microsoft.com/typography/otspec/scripttags.htm}{script} (`alphabet') and by \hlink{http://www.microsoft.com/typography/otspec/languagetags.htm}{language}. These are selected with four and three letter tags, respectively. \begin{optdesc} \item[script=\textsl{