summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/mathastext/mathastexttestunicodelinux.tex
blob: d4e3e8d652f2999e4686a8c82b1defcbff6b62e5 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
\def\testfileincipit{Test file to accompany \texttt{mathastext}
version \texttt{1.3w} of \texttt{2019/11/16}}
%%----------------------------------------------------------------
%% Package: mathastext
%% Info:    Use the text font in math mode (JFB)
%% Version: 1.3w 2019/11/16
%% License: LPPL 1.3c (http://www.latex-project.org/lppl/lppl-1-3c.txt)
%% Copyright (C) 2011-2019 Jean-Francois Burnol <jfbu at free dot fr>
%% Examples of use of mathastext:
%%        http://jf.burnol.free.fr/mathastext.html
%%        http://jf.burnol.free.fr/showcase.html
%%----------------------------------------------------------------
%% This file `mathastexttestunicodelinux.tex' is for testing the use
%% of the package `mathastext' with the unicode engines XeTeX or LuaLaTeX.
%%
%% Fonts which were available on a Linux machine are used. Beware that
%% compilation with LuaLaTeX will abort with errors if specified fonts do not
%% exist on your system.
%%
%% See `mathastext.dtx' for the copyright and conditions of distribution or
%% modification.
%%
\documentclass{article}
\usepackage[hscale=0.8]{geometry}
\usepackage{multicol}
\usepackage[no-math]{fontspec}
\usepackage{lmodern}
\usepackage{metalogo}
\usepackage{iftex}
\ifXeTeX
\expandafter\def\expandafter\testfileincipit\expandafter
 {\testfileincipit\ (compiled with \XeLaTeX)}
\else
\ifLuaTeX
\expandafter\def\expandafter\testfileincipit\expandafter
 {\testfileincipit\ (compiled with \LuaLaTeX)}
\fi\fi
\usepackage[subdued,italic,asterisk]{mathastext}
\setmainfont[Color=999999]{Verdana}      \Mathastext[Verdana]
\setmainfont[Color=0000FF]{Arial}        \Mathastext[Arial]
\setmainfont[Color=00C000]{DejaVu Serif} \Mathastext[DejaVu]
\setmainfont[Color=FF0000]{Andale Mono}  \Mathastext[Andale]
%% commented out as these fonts do not exist anymore on the Linux box
%% I have access to (test last done 2016/01/15)
%%\setmainfont[Color=C000C0]{URW Chancery L}    \Mathastext[Chancery]
%%\setmainfont[Color=800080]{URW Palladio L}    \Mathastext[Palladio]
\setmainfont[Color=808000]{Liberation Serif}  \Mathastext[Liberation]
\MTDeclareVersion{Times}{T1}{ptm}{m}{n}
\begin{document}
\MTversion{normal}
\testfileincipit

This test uses \verb|mathastext| with its \emph{italic}, \emph{asterisk}, and
\emph{subdued} options. The base document fonts are the Latin Modern ones (in
OpenType format). The other OpenType fonts were chosen from those available on
a Linux machine. We also used the Times font in traditional \TeX\ font T1
encoding, to demonstrate the removal since release \texttt{1.3u} of a former
limitation that all math versions had to share the same font encoding, else
some characters such as the dotless \texttt{i} ($\imath$), or the minus sign
could well vanish from the output in the non-normal math versions.

Furthermore we test (last line of each block, on the left) if the non-letter
characters obey the math alphabet \verb|\mathbf|. In the normal and bold math
versions, this feature is de-activated, as option \emph{subdued} was used; and
if activated we should then use in these math versions the package
\verb|\Mathbf| rather than \verb|\mathbf| which is there still the original
one, which will use encoding \verb|OT1| in the normal and bold versions, as we
loaded \verb|fontspec| with its option \emph{no-math}.

Some among the fonts tested have no bold variant or no italic variant.

Note: the two unicode engines \XeLaTeX\ and \LuaLaTeX\ give likely not fully
identical results particularly for the math mode. At least this is what I
observed regularly over the years with the variant of this file prepared for
fonts available on Mac OS, which is my main system where I develop
|\mathastext|. Lastly for example (TL2019, august 2019), \LuaLaTeX\ could not
find the bold variant of some system font, but \XeLaTeX\ did. And the spacing
for the letters of the Didot font was vastly different between the two
engines.

\newcommand\TEST[1]{\MTversion{#1}\def\tmpa{#1}%
  \def\tmpb{normal}\def\tmpc{bold}%
  \ifx\tmpa\tmpb\else\ifx\tmpa\tmpc\else \MTnonlettersobeymathxx
  \MTexplicitbracesobeymathxx\fi\fi
\begin{multicols}{2}
\hbox to\columnwidth{\hbox to\columnwidth{\hfil
                $abcdefghijklmnopqrstuvwxyz$\hfil}\kern-2.5em{#1}}
   \centerline{ $ABCDEFGHIJKLMNOPQRSTUVWXYZ$ }
   \centerline{ $0123456789$ }
   \centerline{ $!\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
   \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\backslash$ }
   \centerline{ $\mathbf{!\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
   \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\backslash}$ }
\columnbreak
   \centerline{ abcdefghijklmnopqrstuvwxyz }
   \centerline{ ABCDEFGHIJKLMNOPQRSTUVWXYZ }
   \centerline{ 0123456789}
   \centerline{ !\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
   \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\char92 }
   \centerline{\bfseries !\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
   \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\char92 }
\end{multicols}}
\begin{multicols}{2}
   \centerline{\textbf{math mode}}
\columnbreak
   \centerline{ \textbf{text} }
\end{multicols}
\TEST{DejaVu}
\TEST{Verdana}
\TEST{Andale}
%%\TEST{Palladio}
\TEST{Arial}
%%\TEST{Chancery}
\TEST{Liberation}
\TEST{bold}\TEST{normal}\TEST{Times}
\end{document}
\endinput
%%
%% End of file `mathastexttestunicodelinux.tex'.