summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/fontspec/fontspec-example.tex
blob: bf2831b134b7e3467341d7e1c8a6b57199e03f7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
%%^^A%%  fontspec-example.tex -- part of FONTSPEC <wspr.io/fontspec>

\documentclass{article}

\usepackage{fontspec}

\setmainfont{TeX Gyre Pagella}
\setsansfont{TeX Gyre Heros}[Scale=MatchLowercase]
\setmonofont{Inconsolata}[Scale=MatchLowercase]

\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 Xe\TeX{} or Lua\TeX.
The basic command is

{\centering \verb|\fontspec{font display name}[font features]|.\par}

The default, sans serif, and typewriter fonts may be set with the
commands \verb|\setmainfont|, \verb|\setsansfont| and \verb|\setmonofont|,
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}

Text fonts in maths mode are also changed (e.g., notice the cosine function in
`$\cos(n\pi)=\pm 1$') but only if the roman and sans serif fonts are set in
the preamble; \verb|\setmainfont| will not affect these maths mode fonts when
called mid-document.
Maths symbols themselves are not affected.

Notice the font features used to load the default fonts in the preamble.
\verb|Ligatures=TeX| is automatically enabled for the roman and sans font,
allowing regular \TeX{} ligatures like \verb|``---''| for ``---''.
\verb|Scale=MatchLowercase| automatically scales the fonts to
the same x-height.

Please see the complete \textsf{fontspec} documentation for further
information.

\end{document}