summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/unicode-math/unimath-example.ltx
blob: 928a523f306ebeaf7ceb8a58a2e62264a812d925 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
%%^^A%% unimath-example.ltx -- part of UNICODE-MATH <wspr.io/unicode-math>
%%^^A%% A minimal example file to demonstrate the package.

%%%%%%%%%%%%%%%%%%%%%%%
% UNICODE-MATH EXAMPLE FILE
%%%%%%%%%%%%%%%%%%%%%%%

\documentclass{article}

% Load fontspec and define a document font:
\usepackage{fontspec}
\setmainfont{texgyrepagella-regular.otf}

% Load unicode-math and define a math font:
\usepackage{unicode-math}
\setmathfont{texgyrepagella-math.otf}

\begin{document}
\title{An example of \textsf{unicode-math}}
\author{Will Robertson}
\maketitle

This is an example of the \textsf{unicode-math} package.
It allows you to write maths with Unicode input and to use fonts that contain Unicode mathematical glyphs. Follow along in the source code to see how it works.

After loading the package and selecting a font, you shouldn't need to change much to continue to write maths as always.
\[
   F(s)=\symscr L \{f(t)\}=\int_0^\infty \symup e^{-st}f(t)\,\symup d t
\]

The style of Latin and Greek letters is set up by default to match the output of standard \LaTeX: Latin letters and Greek lowercase letters are italic, and Greek uppercase letters are upright. These can be configured with the \texttt{math-style} package option.

One very important feature to recognise is that bold maths now works consistently for both Latin and Greek letters. By default, \verb|\symbf| will turn a Latin letter bold and upright, and a Greek letter will remain italic and also become bold. For example:
\[
  \symbf{a} = a\,\symbf{I} \qquad \symbf{\beta} = \beta\,\symbf{I}
\]
This behaviour can be configured with the \texttt{bold-style} package option.

In the examples above, I've used \LaTeX\ commands to input characters like \verb|\beta|, \verb|\infty|, and so on. These may now be typed directly into the source of the document:
\[
   𝐉 = ∇×𝐇 \qquad 𝐁 = μ₀(𝐌 + 𝐇)
\]
\[
  ∫₀³ xⁿφ₁₂(x)\,ⅆx
\]
It does not matter if you use upright or italic characters; they will be normalised according to the setting of the \texttt{math-style} and \texttt{bold-style} options.

And that's a brief introduction to the package. Please see the documentation for further details. This is a new package; feedback, suggestions, and bug reports are all most welcome.

\end{document}

\endinput

% /©
%
% ------------------------------------------------
% The UNICODE-MATH package  <wspr.io/unicode-math>
% ------------------------------------------------
% This package is free software and may be redistributed and/or modified under
% the conditions of the LaTeX Project Public License, version 1.3c or higher
% (your choice): <http://www.latex-project.org/lppl/>.
% ------------------------------------------------
% Copyright 2006-2018  Will Robertson, LPPL "maintainer"
% Copyright 2010-2017  Philipp Stephani
% Copyright 2011-2017  Joseph Wright
% Copyright 2012-2015  Khaled Hosny
% ------------------------------------------------
%
% ©/