%% %% This is file `fontspec-example.ltx', %% generated with the docstrip utility. %% %% The original source files were: %% %% fontspec.dtx (with options: `example') %% %% ________________________________ %% The fontspec package for XeLaTeX %% (C) 2004--2007 Will Robertson %% %% License information appended. %% \documentclass{article} \usepackage{euler} \usepackage[cm-default]{fontspec} \usepackage{xltxtra} \defaultfontfeatures{Scale=MatchLowercase,Mapping=tex-text} \setmainfont[Numbers=Lowercase]{FPL Neu} \setsansfont{Lucida Sans} \setmonofont{Lucida Sans Typewriter} \frenchspacing % TeX's default is a little old-fashioned... \begin{document} \pagestyle{empty} \section*{The basics of the \textsf{fontspec} package} The \textsf{fontspec} package enables automatic font selection for \LaTeX{} documents typeset with \XeTeX{}. The basic command is\\ \indent \verb|\fontspec[font features]{font display name}|.\\ As an example: \begin{center} \Large \fontspec[ Colour = 0000CC, Numbers = OldStyle, VerticalPosition = Ordinal, Variant = 2 ]{Apple Chancery} My 1st example of Apple Chancery \end{center} The default, sans serif, and typewriter fonts may be set with the \verb|\setmainfont|, \verb|\setsansfont| and \verb|\setmonofont| commands, respectively, as shown in the preamble. They take the same syntax as the \verb|\fontspec| package. All expected font shapes are available: \begin{center} {\itshape Italics and \scshape small caps\dots}\\ {\sffamily\bfseries Bold sans serif and \itshape bold italic sans serif\dots} \end{center} With the roman and sans serif fonts set in the preamble, text fonts in math mode are also changed: $\cos(n\pi)=\pm 1$. The maths typeface `Euler' has been used in this document (with the \textsf{euler} package---or the \textsf{eulervm} package if the |xpdfdvimx| driver is being used), since the default Computer Modern maths font is rather light. \[ \mathcal F(s) = \int^\infty_0 f(t) \exp(-st)\,\mathrm{d}t \] You'll also notice the \verb|\defaultfontfeatures| command in the preamble. This command takes a single argument of font features that are then applied to every subsequent instance of font selection. The first argument in this case, \verb|Mapping=tex-text|, enables regular \TeX{} ligatures like \verb|``---''| for ``---''. The second automatically scales the fonts to the same x-height. Please see the documentation for font feature explanation and further package niceties. \end{document} %% %% Copyright 2004--2007 by Will Robertson %% %% Distributable under the LaTeX Project Public License, %% version 1.3c or higher (your choice). The latest version of %% this license is at: http://www.latex-project.org/lppl.txt %% %% This work is "maintained" (as per LPPL maintenance status) %% by Will Robertson. %% %% This work consists of this file fontspec.dtx %% and the derived files fontspec.sty, %% fontspec.cfg, %% fontspec.ins, %% fontspec-example.ltx, %% and fontspec.pdf. %% %% %% End of file `fontspec-example.ltx'.