Debian Codegraph @

texmf-dist/doc/latex/fontspec/fontspec-example.tex

raw
1 %%^^A%% fontspec-example.tex -- part of FONTSPEC <latex3.github.io/fontspec>
2
3 \documentclass{article}
4
5 \usepackage{fontspec}
6
7 \setmainfont{TeX Gyre Pagella}
8 \setsansfont{TeX Gyre Heros}[Scale=MatchLowercase]
9 \setmonofont{Inconsolata}[Scale=MatchLowercase]
10
11 \begin{document}
12 \pagestyle{empty}
13
14 \section*{The basics of the \textsf{fontspec} package}
15
16 The \textsf{fontspec} package enables automatic font selection
17 for \LaTeX{} documents typeset with Xe\TeX{} or Lua\TeX.
18 The basic command is
19
20 {\centering \verb|\fontspec{font display name}[font features]|.\par}
21
22 The default, sans serif, and typewriter fonts may be set with the
23 commands \verb|\setmainfont|, \verb|\setsansfont| and \verb|\setmonofont|,
24 respectively, as shown in the preamble. They take the
25 same syntax as the \verb|\fontspec| package. All expected font
26 shapes are available:
27
28 \begin{center}
29 {\itshape Italics and \scshape small caps\dots}\\
30 {\sffamily\bfseries Bold sans serif and \itshape bold italic sans serif\dots}
31 \end{center}
32
33 Text fonts in maths mode are also changed (e.g., notice the cosine function in
34 `$\cos(n\pi)=\pm 1$') but only if the roman and sans serif fonts are set in
35 the preamble; \verb|\setmainfont| will not affect these maths mode fonts when
36 called mid-document.
37 Maths symbols themselves are not affected.
38
39 Notice the font features used to load the default fonts in the preamble.
40 \verb|Ligatures=TeX| is automatically enabled for the roman and sans font,
41 allowing regular \TeX{} ligatures like \verb|``---''| for ``---''.
42 \verb|Scale=MatchLowercase| automatically scales the fonts to
43 the same x-height.
44
45 Please see the complete \textsf{fontspec} documentation for further
46 information.
47
48 \end{document}