Debian Codegraph @

texmf-dist/source/latex/mathgreeks/mathgreeks.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2024 by Antoine Missier <[email protected]>
4 %
5 % This file may be distributed and/or modified under the conditions of
6 % the LaTeX Project Public License, either version 1.3 of this license
7 % or (at your option) any later version. The latest version of this
8 % license is in:
9 %
10 % http://www.latex-project.org/lppl.txt
11 %
12 % and version 1.3 or later is part of all distributions of LaTeX version
13 % 2005/12/01 or later.
14 % \fi
15 %
16 % \iffalse
17 %<*driver>
18 \ProvidesFile{mathgreeks.dtx}
19 %</driver>
20 %<*package>
21 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
22 \ProvidesPackage{mathgreeks}
23 [2024/05/07 v1.2 .dtx Math Greek letters]
24 %</package>
25 %<*driver>
26 \documentclass[11pt]{article}
27 %\usepackage[utf8]{inputenc}
28 \usepackage[T1]{fontenc}
29 \usepackage[english]{babel}
30 \usepackage{doc}
31 \usepackage{geometry}
32 \usepackage[mathdesign=Charter,otherfonts]{mathgreeks}
33 \usepackage{sectsty}
34 \usepackage{xcolor}
35 \usepackage{spacingtricks}
36 \usepackage{metalogo}
37 %\usepackage{supertabular} % incompatible with tabls
38 \usepackage{tabls}
39 \usepackage{multirow}
40 \usepackage{ifluatex}
41 \ifluatex
42 \usepackage{unicode-math}
43 \setmainfont{XCharter}
44 \else
45 \usepackage{charter}
46 \fi
47 \geometry{scale=0.73,vmarginratio=3:4,heightrounded}
48 \MakeShortVerb{"}
49 \definecolor{darkbrown}{rgb}{0.5,0.1,0.1}
50 \allsectionsfont{\color{darkbrown}}
51 \newcommand\bs{\textbackslash}
52 \DisableCrossrefs
53 %\CodelineIndex
54 %\RecordChanges
55 \OnlyDescription
56 \usepackage{hyperref}
57 \title{The \textsf{mathgreeks} package}
58 \author{Antoine Missier \\ \texttt{[email protected]}}
59 \date{\filedate, \fileversion}
60 \hypersetup{%
61 colorlinks,
62 linkcolor=blue,
63 citecolor=red,
64 pdftitle={mathgreeks},
65 pdfsubject={LaTeX package},
66 pdfauthor={Antoine Missier}
67 }
68
69 \begin{document}
70 \DocInput{mathgreeks.dtx}
71 %\PrintChanges
72 %\PrintIndex
73 \end{document}
74 %</driver>
75 % \fi
76 %
77 % \CheckSum{1061}
78 %
79 % \CharacterTable
80 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
81 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
82 % Digits \0\1\2\3\4\5\6\7\8\9
83 % Exclamation \! Double quote \" Hash (number) \#
84 % Dollar \$ Percent \% Ampersand \&
85 % Acute accent \' Left paren \( Right paren \)
86 % Asterisk \* Plus \+ Comma \,
87 % Minus \- Point \. Solidus \/
88 % Colon \: Semicolon \; Less than \<
89 % Equals \= Greater than \> Question mark \?
90 % Commercial at \@ Left bracket \[ Backslash \\
91 % Right bracket \] Circumflex \^ Underscore \_
92 % Grave accent \` Left brace \{ Vertical bar \|
93 % Right brace \} Tilde \~}
94 %
95 % \changes{v1.0}{2024/04/30}{Initial version}
96 % \changes{v1.1}{2024/05/04}{Adding the libsans option; a few changes in the doc}
97 % \changes{v1.2}{2024/05/07}{A clarification in the documentation about the option shape=it}
98 %
99 % \GetFileInfo{mathgreeks.sty}
100 %
101 % \maketitle
102 % \tableofcontents
103 %
104 % \section{Introduction}
105 %
106 % The purpose of this package is to provide access to numerous Greek letter fonts
107 % for math mode, without altering other mathematical characters and symbols
108 % and without loading whole extensions that provide these fonts.
109 %
110 % The commands "\italpha", "\itbeta"\ldots\ produce the italic forms of the chosen font,
111 % and "\upalpha", "\upbeta" \ldots\ produce the upright forms.
112 % Style options allow choosing between italic or upright forms for the basic commands
113 % "\alpha", "\beta"\ldots
114 % Only letters whose glyph differs from the corresponding Roman letter
115 % will be defined this way.
116 % Therefore, the package does not provide a command "\omicron",
117 % whose letter is identical to the Roman `o', and only a few uppercase letters are defined:
118 % "\Gamma", "\Delta", "\Theta"\ldots
119 %
120 % \medskip
121 % An ISO recommendation, rarely followed, is to typeset uppercase
122 % Greek letters in italic shape, as for other variables~\cite{ICTNS}.
123 % This is automatically achieved, for some particular fonts, with packages
124 % such as \textsf{fixmath} by Walter Schmidt~\cite{FIXM},
125 % \mbox{\textsf{isomath}} by Günter Milde~\cite{ISOM}
126 % or \textsf{pm-isomath} by Claudio Beccari~\cite{PMISO} and optionally with some others
127 % (such as \textsf{mathpazo} or \textsf{mathptmx} with the option \texttt{slantedGreek}).
128 % When running through \LuaLaTeX\ or \XeLaTeX\ you can also get this result
129 % with the option \mbox{\texttt{math-style=ISO}} provided
130 % by the \textsf{unicode-math} package~\cite{UNIC}.
131 %
132 % \pagebreak ^^A To get the same page breaking when compiling with pdfLaTeX
133 % Furthermore there are several packages that provide the uppercase Greek letters
134 % in italic and have also options to typeset the lowercase Greek
135 % letters in upright shape.
136 % Notably, let us mention
137 % \mbox{\textsf{mathdesign}}~\cite{DESIGN},
138 % \mbox{\textsf{kpfonts}}~\cite{KPF},
139 % \mbox{\textsf{fourier}}~\cite{FOUR}, but also
140 % \mbox{\textsf{pxgreeks}} (using \textsf{pxfonts}~\cite{PX}), \mbox{\textsf{txgreeks}}
141 % (using \textsf{txfonts}~\cite{TX}),
142 % \mbox{\textsf{libertinust1math}}~\cite{LIB}, \mbox{\textsf{libgreek}}, etc.
143 % A special mention goes to \textsf{lgrmath} of Jean-François Burnol~\cite{LGR}
144 % which allows the use of any Greek LGR-encoded font in math mode,
145 % an idea taken up in \textsf{mathgreeks}.
146 % Also note \textsf{newtxmath}~\cite{NTX} which has several font options.
147 % For upright lowercase letters, we have the nice \textsf{upgreek}~\cite{GREEK} package.
148 %
149 % \medskip
150 % The interest of \textsf{mathgreeks} lies in being able to choose the Greek letters font
151 % from one of these packages or from a TrueType or OpenType font installed on your computer.
152 % The package sets Greek letters in the desired font and shape
153 % and enables to change font or shape dynamically within the document.
154 %
155 % \section{Options and settings}
156 %
157 % \subsection{Package options}
158 %
159 % When calling the package, there are three types of options:
160 % \begin{itemize}
161 % \item Font options,
162 % \item Shape options (the style),
163 % \item Additional options.
164 % \end{itemize}
165 % These options use the `\texttt{key=value}' mechanism.
166 % When a default value is set, the key can be used without specifying a value
167 % (which will then be the default value).
168 % Some keys represent booleans with the default value being `\texttt{true}'.
169 %
170 % \bigskip
171 % The first table, in two parts, presents the different keys corresponding to font options,
172 % the list of possible values (complete when it is reduced).
173 % The default value is indicated in bold, the second part consist in boolean options.
174 % Results are presented in section~\ref{examples}.
175 %
176 % \begin{table}[h]
177 % \begin{center}\ttfamily
178 % \begin{tabular}{ll}
179 % \hline
180 % \vstrut{2ex}\normalfont{Option} & \normalfont{Values} \\
181 % \hline
182 % lgrmath & Alegreya-LF, Cochineal-LF, \textbf{fcm}\ldots \\
183 % fontspec & FreeSerif, \textbf{GFS Didot}, Cambria\ldots \\
184 % unicode-math & \textbf{Latin Modern Math}, STIX Two Math\ldots \\
185 % upgreek & Euler, \textbf{Symbol}, Symbolsmallscale \\
186 % mathdesign & Utopia, Garamond, \textbf{Charter} \\
187 % kpfonts & \textbf{normal}, light \\
188 % \hline
189 % \end{tabular}
190 % \hspace{1cm}
191 % \begin{tabular}{l}
192 % \hline
193 % \vstrut{2ex}\normalfont{Booleans} \\
194 % \hline
195 % fourier \\
196 % pxfonts \\
197 % txfonts \\
198 % libertinus \\
199 % concrete \\
200 % cmbright \\
201 % \hline
202 % \end{tabular}
203 % \caption{\normalfont{font options}\label{table:font}}
204 % \end{center}
205 % \end{table}
206 %
207 % \vspace{-1\baselineskip}
208 % The \texttt{fontspec} and \texttt{unicode-math} options require loading
209 % the corresponding packages, and these can only work when running through
210 % \LuaLaTeX\ (or \XeLaTeX).
211 % The \texttt{fontspec} option allows for the use of most TrueType or OpenType
212 % fonts installed on your computer, those that have Greek letters.
213 % Although the \textsf{unicode-math} package loads the \textsf{fontspec} package,
214 % the fonts usable with one of these options are not necessarily usable with the other;
215 % \texttt{fontspec} has a large number of possible values.
216 %
217 % When calling "\boldmath" (outside the math environment), you get the letters in bold face,
218 % but the command "\mathbf" doesn't work here.
219 %
220 % \bigskip
221 % The second table below presents the shape options. If the shape option
222 % is not specified, the italic shape is chosen by default, meaning that the commands
223 % "\alpha", "\beta", \ldots, "\Delta", "\Gamma"\ldots\ will produce the same result
224 % as the corresponding "\it"\meta{letter} commands.
225 %
226 % \begin{table}[h]
227 % \begin{center}
228 % \begin{tabular}{ll}
229 % \hline
230 % \vstrut{2ex}\normalfont{Option} & \normalfont{Description} \\
231 % \hline
232 % \texttt{greekup} & lowercase letters in upright shape \\
233 % \texttt{Greekup} & uppercase letters in upright shape \\
234 % \texttt{TeX} & lowercase=italic, uppercase=upright \\
235 % \texttt{ISO} & lowercase=italic, uppercase=italic \\
236 % \texttt{upright} & lowercase=upright, uppercase=upright \\
237 % \texttt{style} & possible values: \texttt{TeX}, \texttt{ISO}, \texttt{upright} \\
238 % \hline
239 % \end{tabular}
240 % \caption{shape options\label{table:shape}}
241 % \end{center}
242 % \end{table}
243 %
244 % \vspace{-1\baselineskip}
245 % \begin{itemize}
246 % \item Except for \texttt{style}, all these options are booleans.
247 % \item The \texttt{Greekup} option est initialized to \texttt{true} (corresponding
248 % to the \texttt{TeX} style).
249 % \item The \texttt{style=ISO} option produces the same result as the simple
250 % \texttt{ISO} option, and the same applies to the other two styles
251 % (\texttt{TeX}, \texttt{upright}).
252 % \item To get lowercase letters in upright shape and uppercase letters in italic,
253 % activate \begin{center}\texttt{greekup=true,Greekup=false}.\end{center}
254 % \end{itemize}
255 %
256 % \bigskip
257 % The following list presents the additional options, which are also booleans:
258 % \begin{description}
259 % \item[\texttt{savegreeks}] Saves the letters corresponding to the original commands
260 % "\alpha", "\beta"\ldots so that they remain accessible through the commands
261 % "\backalpha", "\backbeta"\ldots
262 % \item[\texttt{otherfonts}] Allows dynamic font switching (see next section)
263 % for later use of \texttt{lgrmath}, \texttt{fourier}, \texttt{libertinus}
264 % or \texttt{upgreek}.
265 % \item[\texttt{libsans}] This is a special option that works only with \texttt{libertinus}
266 % to produce a sanserif font.
267 % \item[\texttt{lowercase}] This option is initialized to \texttt{true};
268 % \texttt{lowercase=false} allows keeping the original lowercase Greek letters
269 % without redefining the commands "\alpha", "\beta"\ldots
270 % \item[\texttt{uppercase}] This option is initialized to \texttt{true};
271 % \texttt{uppercase=false} allows keeping the original uppercase Greek letters
272 % without redefining the commands "\Gamma", "\Delta"\ldots
273 % \end{description}
274 %
275 % \subsection{Dynamic settings commands}
276 %
277 % There are two commands for dynamic settings:
278 % \begin{description}
279 % \item[] "\setmathgreeks"
280 % This command takes a mandatory parameter which is a list of
281 % `\texttt{key=value}' settings among the shape options presented
282 % in table~\ref{table:shape} (the other options are not usable in this command).
283 % This allows modifying these settings in the body of the document,
284 % with a global effect, or local if the command is called in an environment
285 % or a group (delimited by braces).
286 %
287 % \item[] "\mathgreeksfont"
288 % This command allows modifying the font of Greek letters throughout the document,
289 % with a global or local effect.
290 % The possible options fall into two categories:
291 % \begin{center}
292 % \texttt{fontspec}, \texttt{unicode-math}, \\
293 % \texttt{enc}, \texttt{fam}, \texttt{series}, \texttt{shape}.
294 % \end{center}
295 % The \texttt{fontspec} and \texttt{unicode-math} options are identical
296 % to those in table~\ref{table:font}. In that case, the shape is set by "\setmathgreeks"
297 % (before or after).
298 % The other previous font options (\texttt{lgrmath}, \texttt{mathdesign},
299 % \texttt{fourier}, etc.)\@ are not usable in "\mathgreeksfont".
300 % However, these fonts can be obtained by specifying the encoding (option \texttt{enc}),
301 % family (option \texttt{fam}), series and shape: the New Font Selection Scheme (NFSS).
302 % The series defines the `boldness' and has a default value: \texttt{series=m} (medium).
303 % For the shape, the default value is \texttt{shape=it};
304 % \texttt{enc} and \texttt{fam} have no default value.
305 % For example,
306 % \begin{center}
307 % "\mathgreeksfont{enc=OML,fam=mdbch,shape=n}"
308 % \end{center}
309 % will produce upright letters from the Charter font provided by \textsf{mathdesign}.
310 % For each font option seen previously,
311 % the following examples (section~\ref{examples}) indicates
312 % the values to give to \texttt{enc}, \texttt{fam}, and \texttt{shape}.
313 % The font definition by NFSS attributes will not produce specific commands for italics
314 % "\it"\meta{letter} or for upright letters "\up"\meta{letter}.
315 % Only the commands "\alpha", "\beta"\ldots will be redefined according to the
316 % selected shape.
317 %
318 % When using the \texttt{fontspec} or \texttt{unicode-math} option,
319 % these NFSS options have no effect.
320 %
321 % Notice that the encoding obtained by the package font options is faster, moreover
322 % the command "\boldmath" doesn't work anymore
323 % when changing the font with \texttt{enc}, \texttt{fam} and \texttt{shape},
324 % but you can obtain the boldface
325 % letters with \texttt{series=b}, or \texttt{series=bx} (bold extended).
326 %
327 % \end{description}
328 %
329 % \section{Examples} \label{examples}
330 % \begin{description}
331 % \item[] "\greektable"
332 % The following examples are produced with the "\greektable" command.
333 % This command generates a table with two rows: the first contains the lowercase letters
334 % obtained with "\alpha", \ldots, "\omega", and the second contains variants
335 % "\varepsilon", "\vartheta"\ldots\ of certain letters as well as the uppercase letters
336 % obtained with "\Gamma", "\Delta", \ldots, "\Omega"
337 % (for those who differ from their Latin equivalent).
338 % \end{description}
339 %
340 % \subsection{PostScript font options}
341 %
342 % The \texttt{upgreek} option, as its name suggests, produces only upright letters,
343 % and the \texttt{Euler} font does not have the variants "\varrho" and "\varsigma".
344 % The \texttt{Symbolsmallscale} font is identical to Symbol but reduced in size by 90\,\%;
345 % \texttt{Symbol} and \texttt{Symbolsmallscale} have no bold version.
346 % ^^A\texttt{mathdesign=Garamond} yields a virtual font that may not always work.
347 % For several fonts, the upright shape is obtained with the attribute \texttt{shape=it}
348 % and not \texttt{shape=n}.
349 %
350 % \newlength\legendwidth
351 % \setlength\legendwidth{3.2cm}
352 % \newcommand*\doublerows[1]{\multirow{2}{\legendwidth}[-1.5ex]{\bfseries#1}}
353
354 % \begin{center}
355 % \begin{tabular}{|l|@{}c@{}|c@{$\;$}c@{\:}c|}
356 % \hline
357 % \makebox[\legendwidth][l]{\textbf{upgreek=...}} & \makebox[8.4cm]{Result}
358 % & \makebox[1cm]{enc} & \makebox[1cm]{fam} & shape \\
359 % \hline
360 % \textbf{Symbol}
361 % & \mathgreeksfont{enc=U,fam=psy,shape=n}\greektable
362 % & U & psy & n \\
363 % \hline
364 % \textbf{Symbolsmallscale}
365 % & \mathgreeksfont{enc=U,fam=fsy,shape=n} \greektable
366 % & U & fsy & n \\
367 % \hline
368 % \textbf{Euler}
369 % & \mathgreeksfont{enc=U,fam=eur,shape=n} \greektable
370 % & U & eur & n \\
371 % \hline
372 % \end{tabular}
373 % \end{center}
374 %
375 % \begin{center}
376 % \begin{tabular}{|l|@{}c@{}|c@{$\;$}c@{}c|}
377 % \hline
378 % \textbf{mathdesign=...} & \makebox[8.4cm]{Result} & enc & fam & shape \\
379 % \hline
380 % \doublerows{Utopia}
381 % & \mathgreeksfont{enc=OML,fam=mdput} \greektable
382 % & OML & mdput & it \\
383 % & \mathgreeksfont{enc=OML,fam=mdput,shape=n} \greektable
384 % & OML & mdput & n \\
385 % \hline
386 % \doublerows{Garamond}
387 % & \mathgreeksfont{enc=OML,fam=mdugm} \greektable
388 % & OML & mdugm & it \\
389 % & \mathgreeksfont{enc=OML,fam=mdugm,shape=n} \greektable
390 % & OML & mdugm & n \\
391 % \hline
392 % \doublerows{Charter}
393 % & \mathgreeksfont{enc=OML,fam=mdbch} \greektable
394 % & OML & mdbch & it \\
395 % & \mathgreeksfont{enc=OML,fam=mdbch,shape=n} \greektable
396 % & OML & mdbch & n \\
397 % \hline
398 % \end{tabular}
399 % \end{center}
400 %
401 % \begin{center}
402 % \begin{tabular}{|l|@{}c@{}|c@{$\;$}c@{}c|}
403 % \hline
404 % \textbf{kpfonts=...} & \makebox[8.4cm]{Result} & enc & fam & shape \\
405 % \hline
406 % \doublerows{normal}
407 % & \mathgreeksfont{enc=OML,fam=jkp} \greektable
408 % & OML & jkp & it \\
409 % & \mathgreeksfont{enc=U,fam=jkpmia} \greektable
410 % & U & jkpmia & it \\
411 % \hline
412 % \doublerows{light}
413 % & \mathgreeksfont{enc=OML,fam=jkpl} \greektable
414 % & OML & jkpl & it \\
415 % & \mathgreeksfont{enc=U,fam=jkplmia} \greektable
416 % & U & jkplmia & it \\
417 % \hline
418 % \end{tabular}
419 % \end{center}
420 %
421 % \begin{center}
422 % \begin{tabular}{|l|@{}c@{}|c@{$\;$}c@{}c|}
423 % \hline
424 % Boolean options & \makebox[8.2cm]{Result} & enc & fam & shape \\
425 % \hline
426 % \doublerows{fourier}
427 % & \mathgreeksfont{enc=FML,fam=futmi} \greektable
428 % & FML & futmi & it \\
429 % & \mathgreeksfont{enc=FML,fam=futm} \greektable
430 % & FML & futm & it \\
431 % \hline
432 % % \doublerows{pxfonts}
433 % & \mathgreeksfont{enc=OML,fam=pxmi} \greektable
434 % & OML & pxmi & it \\
435 % & \mathgreeksfont{enc=U,fam=pxmia} \greektable
436 % & U & pxmia & it \\
437 % \hline
438 % \doublerows{txfonts}
439 % & \mathgreeksfont{enc=OML,fam=txmi} \greektable
440 % & OML & txmi & it \\
441 % & \mathgreeksfont{enc=U,fam=txmia} \greektable
442 % & U & txmia & it \\
443 % \hline
444 % \doublerows{libertinus}
445 % & \mathgreeksfont{enc=LS1,fam=libertinust1math} \greektable
446 % & LS1 & * & it \\
447 % & \mathgreeksfont{enc=LS1,fam=libertinust1math,shape=n} \greektable
448 % & LS1 & * & n \\
449 % \hline
450 % \textbf{concrete}
451 % & \mathgreeksfont{enc=OML,fam=ccm} \greektable
452 % & OML & ccl & it \\
453 % \hline
454 % \textbf{cmbright}
455 % & \mathgreeksfont{enc=OML,fam=cmbrm} \greektable
456 % & OML & cmbrm & it \\
457 % \hline
458 % \end{tabular}
459 % \end{center}
460 % \emph{* The asterisks for the} \textbf{libertinus} \emph{family corresponds to}
461 % \textnormal{`libertinust1math'} \emph{a name too long to appear in this table.
462 % Activating the} \texttt{libsans} \emph{package option yields a sanserif font.}
463 %
464 % \subsection{The \texttt{lgrmath} option}
465 %
466 % The \texttt{lgrmath} option, inspired by the eponymous package of J.F. Burnol,
467 % has a large number of possible values. We present here only a few.
468 % The documentation of the \textsf{lgrmath} package~\cite{LGR} explains how
469 % to list the fonts available on your distribution with the LGR encoding.
470 % One can also consult with profit the documentation of \textsf{cb-fonts}\cite{CB},
471 % the Greek fonts of Claudio Beccari.
472 %
473 % With the \texttt{lgrmath} option, the alternative commands for the variants
474 % produce the same glyphs as those of the normal letters except for "\varsigma".
475 % However, the "\varsigma" $\varsigma$ often substitutes for the usual "\sigma" $\sigma$
476 % when using dynamic font changes through "\mathgreeksfont" with \texttt{enc=LGR}.
477 %
478 % We have not presented here the third column previously indicating the values for
479 % \texttt{enc}, \texttt{fam}, and \texttt{shape} because, for this entire section,
480 % we have \texttt{enc=LGR}, \texttt{fam=\meta{font-name}}, the name of the font presented,
481 % and \texttt{shape=it}, for the italic shape, or \texttt{shape=n}, for the upright shape.
482 % Example:
483 % \begin{center}
484 % "\mathgreeksfont{enc=LGR,fam=Alegreya-LF,shape=n}"
485 % \end{center}
486 %
487 %\setlength\legendwidth{4cm}
488 % \newcommand\lgrtbl[1]{%
489 % \doublerows{#1}
490 % & \mathgreeksfont{enc=LGR,fam=#1} \greektable \\
491 % & \mathgreeksfont{enc=LGR,fam=#1,shape=n} \greektable \\
492 % \hline
493 % }
494 %
495 % \begin{center}
496 % \begin{tabular}{|l|c|}
497 % \hline
498 % \textbf{lgrmath=...} & Result \\
499 % \hline
500 % \lgrtbl{Alegreya-LF}
501 % \lgrtbl{Cochineal-LF}
502 % \lgrtbl{LibertinusSerif-LF}
503 % \lgrtbl{LibertinusSans-LF}
504 % \lgrtbl{NotoSerif-LF}
505 % \lgrtbl{droidserif}
506 % \lgrtbl{fcm}
507 % \lgrtbl{gentium}
508 % \lgrtbl{lmss}
509 % \end{tabular}
510 % \end{center}
511 %
512 % \ifluatex
513 % \subsection{The \texttt{fontspec} option}
514 %
515 % Most TrueType or OpenType fonts can be used here.
516 % ^^A Needs the \textsf{fontspec} package and must be run through \LuaLaTeX\ or \XeLaTeX.
517 % Some of the fonts below are non free, and some do not have all the variants,
518 % for example Arial, Palatino Linotype, Times New Roman.
519 %
520 % \newcommand\fontspectbl[2][fontspec]{%
521 % \doublerows{#2}
522 % & \mathgreeksfont{#1=#2}
523 % \setmathgreeks{style=ISO} \greektable \\
524 % & \mathgreeksfont{fontspec=#2}
525 % \setmathgreeks{style=upright} \greektable \\
526 % \hline
527 % }
528 %
529 % \begin{center}
530 % \begin{tabular}{|l|c|}
531 % \hline
532 % \textbf{fontspec=...} & Result \\
533 % \hline
534 % \fontspectbl{DejaVu Serif}
535 % \fontspectbl{DejaVu Sans}
536 % \fontspectbl{FreeSerif}
537 % \fontspectbl{FreeSans}
538 % \fontspectbl{GFS Artemisia}
539 % \fontspectbl{GFS Didot}
540 % \fontspectbl{Liberation Serif}
541 % \fontspectbl{Liberation Sans}
542 % \end{tabular}
543 % \end{center}
544 %
545 % \begin{center}
546 % \begin{tabular}{|l|c|}
547 % \hline
548 % \textbf{fontspec=...} & Result \\
549 % \hline
550 % \fontspectbl{Linux Libertine O}
551 % ^^A\fontspectbl{Linux Biolinum O}
552 % \fontspectbl{Arial}
553 % \fontspectbl{Cambria}
554 % \fontspectbl{Palatino Linotype}
555 % \fontspectbl{Times New Roman}
556 % \end{tabular}
557 % \end{center}
558 %
559 %
560 % \subsection{The \texttt{unicode-math} option}
561 %
562 % \begin{center}
563 % \begin{tabular}{|l|c|}
564 % \hline
565 % \textbf{unicode-math=...} & Result \\
566 % \hline
567 % \fontspectbl[unicode-math]{Latin Modern Math}
568 % \fontspectbl[unicode-math]{STIX Two Math}
569 % \fontspectbl[unicode-math]{Fira Math}
570 % \end{tabular}
571 % \end{center}
572 %
573 % \else
574 % \typeout{This is a short version of the documentation.
575 % Use LuaLaTeX to get the complete version}
576 % \fi
577 %
578 % \StopEventually{
579 % \begin{thebibliography}{20}
580 % \begin{raggedright}
581 % \bibitem{ICTNS} \emph{On the Use of Italic and up Fonts for Symbols in Scientific Text},
582 % I.M.~Mills and W.V.~Metanomski, ICTNS (Interdivisional Committee
583 % on Terminology, Nomenclature and Symbols), dec 1999,
584 % \url{https://old.iupac.org/standing/idcns/italic-roman_dec99.pdf}.
585 % \bibitem{UNIC} \emph{Experimental Unicode mathematical typesetting:
586 % The \textsf{unicode-math} package}, Will Robertson, Philipp Stephani, Joseph Wright,
587 % Khaled Hosny, and others, CTAN, v0.8r 2023/08/13.
588 % \bibitem{FSPEC} \emph{The \textsf{fontspec} package -- Font selection for \XeLaTeX\
589 % and \LuaLaTeX}, Will Robertson, CTAN, v2.9b 2024/04/27.
590 % \bibitem{FIXM} \emph{The \textsf{fixmath} package for \LaTeXe}, Walter Schmidt,
591 % CTAN, v0.9 2000/04/11.
592 % \bibitem{ISOM} \emph{\textsf{isomath} -- Mathematical style for science and technology},
593 % Günter Milde, CTAN, v0.6.1 2012/09/04.
594 % \bibitem{PMISO} \emph{\textsf{PM-ISOmath}, The Poor Man ISO math bundle},
595 % the \textsf{pm-isomath} package by Claudio Beccari, CTAN, v1.2.00 2021/08/04.
596 % \bibitem{GREEK} \emph{The \textsf{upgreek} package for \LaTeXe}, Walter Schmidt,
597 % CTAN, v2.0 2003/02/12.
598 % \bibitem{DESIGN} \emph{The \textsf{mathdesign} package},
599 % Paul Pichaureau, CTAN, v2.31 2013/08/29.
600 % \bibitem{KPF} \emph{\textsf{Kp-Fonts} -- The Johannes Kepler project},
601 % Christophe Caignaert, CTAN, v3.34 20/09/2022.
602 % \bibitem{FOUR} \textsf{Fourier-GUT\hspace{-0.1em}\emph{enberg}},
603 % Michel Bovani, CTAN, v1.3 2005/01/30.
604 % \bibitem{PX} \emph{\textsf{PX Fonts} -- Palatino-like fonts in support of mathematics},
605 % Young Ryu, CTAN, 2000/12/14.
606 % \bibitem{TX} \emph{\textsf{TX Fonts} -- Times-like fonts in support of mathematics},
607 % Young Ryu, CTAN, 2000/12/15.
608 % \bibitem{CB} \emph{The CB Greek fonts}, Claudio Beccari, CTAN, 2008/01/01.
609 % \bibitem{PXG} \emph{The \textsf{pxgreeks} package}, Jean-François Burnol,
610 % CTAN v1.0 2011/03/16.
611 % \bibitem{TXG} \emph{The \textsf{txgreeks} package}, Jean-François Burnol,
612 % CTAN v1.0 2011/03/16.
613 % \bibitem{LIBG} \emph{The \textsf{libgreek} package}, Jean-François Burnol,
614 % CTAN v1.1 2022/11/11.
615 % \bibitem{LGR} \emph{The \textsf{lgrmath} package}, Jean-François B., CTAN, v1.0 2022/11/16.
616 % \bibitem{NTX} \emph{New TX font package}, Michael Sharpe, CTAN, v1.735 2024/03/01.
617 % \bibitem{LIB} \emph{The LibertinusT1 Math Package}, Michael Sharpe, CTAN,
618 % v2.0.4 2024/01/14.
619 % \bibitem{CHEM} \emph{\textsf{chemgreek} -- Upright Greek letters in chemistry},
620 % Clemens Niederberger, CTAN, v1.1a 2020/01/16.
621 % \end{raggedright}
622 % \end{thebibliography}
623 % }
624 %
625 % \section{Implementation}
626 %
627 % \begin{macrocode}
628 \RequirePackage{kvoptions}
629 %\SetupKeyvalOptions{family=mgr} % mathgreeks by default
630
631 \DeclareStringOption{lgrmath}[fcm]
632 \newif\ifmathgreeks@lgrmath
633 \AddToKeyvalOption*{lgrmath}{\mathgreeks@lgrmathtrue}
634 \DeclareStringOption{fontspec}[GFS Didot]
635 \newif\ifmathgreeks@fontspec
636 \AddToKeyvalOption*{fontspec}{\mathgreeks@fontspectrue}
637 \newif\ifmathgreeks@unicodemath
638 \define@key{mathgreeks}{unicode-math}[Latin Modern Math]{
639 \newcommand*{\mathgreeks@unicodemath}{#1}
640 \mathgreeks@unicodemathtrue}
641 \DeclareStringOption{upgreek}[Symbol]
642 \newif\ifmathgreeks@upgreek
643 \AddToKeyvalOption*{upgreek}{\mathgreeks@upgreektrue
644 \mathgreeks@Greekuptrue\mathgreeks@greekuptrue}
645 \DeclareStringOption{mathdesign}[Charter]
646 \newif\ifmathgreeks@mathdesign
647 \AddToKeyvalOption*{mathdesign}{\mathgreeks@mathdesigntrue}
648 \DeclareBoolOption{fourier}% false by default
649 \DeclareStringOption{kpfonts}[normal]
650 \newif\ifmathgreeks@kpfonts
651 \AddToKeyvalOption*{kpfonts}{\mathgreeks@kpfontstrue}
652 \DeclareBoolOption{pxfonts}
653 \DeclareBoolOption{txfonts}
654 \DeclareBoolOption{libertinus}
655 \DeclareBoolOption{concrete}
656 \DeclareBoolOption{cmbright}
657
658 \DeclareBoolOption{savegreeks}
659 \DeclareBoolOption{otherfonts}
660 \DeclareBoolOption{libsans}
661 \DeclareBoolOption[true]{lowercase}
662 \DeclareBoolOption[true]{uppercase}
663
664 % dynamic options
665 \DeclareBoolOption[true]{Greekup}
666 \DeclareBoolOption{greekup}
667 \DeclareBoolOption{upright}
668 \AddToKeyvalOption*{upright}{\mathgreeks@Greekuptrue
669 \mathgreeks@greekuptrue}
670 \DeclareBoolOption{ISO}
671 \AddToKeyvalOption*{ISO}{\mathgreeks@Greekupfalse
672 \mathgreeks@greekupfalse}
673 \DeclareBoolOption{TeX}
674 \AddToKeyvalOption*{TeX}{\mathgreeks@Greekuptrue
675 \mathgreeks@greekupfalse}
676 \DeclareStringOption{style}
677 \AddToKeyvalOption*{style}{\setkeys{mathgreeks}{\mathgreeks@style}}
678
679 \DeclareDefaultOption{\PackageError{mathgreeks}{%
680 Option key `\CurrentOptionKey' undefined}{}}
681 \ProcessLocalKeyvalOptions* % \setkeys is done here
682
683 \RequirePackage{etoolbox} % provides \AtEndPreamble
684
685 \newif\ifkp@upRm % from kpgonts, bugs if after \ifmathgreeks@kpfonts
686 \newif\iflibus@sansmath % from libertinust1math
687 \newif\ifmathgreeks@Symbol % for codes definition
688 \newif\ifmathgreeks@itgreek % for fonts without upright shape
689 \newif\ifmathgreeks@font % if font option at package call
690 \mathgreeks@fonttrue
691
692
693 %%%%%%%%%%%%%%%% INITIAL SETTINGS %%%%%%%%%%%%%%%
694
695 \ifmathgreeks@otherfonts
696 \DeclareFontEncoding{LGR}{}{}
697 \DeclareFontEncoding{FML}{}{}
698 \DeclareFontSubstitution{FML}{futm}{m}{it}
699 \ifmathgreeks@libsans \libus@sansmathtrue\fi % taken up at encoding time
700 \DeclareFontEncoding{LS1}{}{}
701 \DeclareFontSubstitution{LS1}{libertinust1math}{m}{n}
702
703 % from the upgreek package
704 \DeclareFontFamily{U}{eur}{\skewchar\font'177}
705 \DeclareFontShape{U}{eur}{m}{n}{%
706 <-6> eurm5 <6-8> eurm7 <8-> eurm10}{}
707 \DeclareFontShape{U}{eur}{b}{n}{%
708 <-6> eurb5 <6-8> eurb7 <8-> eurb10}{}
709 \DeclareFontFamily{U}{fsy}{}
710 \DeclareFontShape{U}{fsy}{m}{n}{<->s*[.9]psyr}{}
711
712 \fi
713
714 \DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{lgrmath}
715 \DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{fontspec}
716 \DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{unicodemath}
717 \DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{upgreek}
718 \DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{mathdesign}
719 \DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{fourier}
720 \DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{kpfonts}
721 \DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{pxfonts}
722 \DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{txfonts}
723 \DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{savegreeks}
724 \DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{otherfonts}
725 \DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{libsans}
726 \DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{lowercase}
727 \DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{uppercase}
728
729
730 \AtEndPreamble{\AtBeginDocument{
731 \@ifundefined{text}{\RequirePackage{amstext}}{}
732
733 \ifmathgreeks@lgrmath
734 \DeclareFontEncoding{LGR}{}{}
735 \DeclareSymbolFont{mgr@it}{LGR}{\mathgreeks@lgrmath}{m}{it}
736 \SetSymbolFont{mgr@it}{bold}{LGR}{\mathgreeks@lgrmath}{b}{it}
737 \DeclareSymbolFont{mgr@up}{LGR}{\mathgreeks@lgrmath}{m}{n}
738 \SetSymbolFont{mgr@up}{bold}{LGR}{\mathgreeks@lgrmath}{b}{n}
739
740 \else\ifmathgreeks@fontspec
741 \@ifpackageloaded{fontspec}{}{
742 \PackageError{mathgreeks}{`fontspec' or `unicodemath'
743 options need the fontspec package\MessageBreak
744 which must be run with LuaLaTeX or XeLaTeX}{}
745 }
746 \newfontfamily\MathGreeksFont{\mathgreeks@fontspec}%
747 [NFSSFamily=mgru]
748 \DeclareSymbolFont{mgr@it}{TU}{mgru}{m}{it}
749 \SetSymbolFont{mgr@it}{bold}{TU}{mgru}{b}{it}
750 \DeclareSymbolFont{mgr@up}{TU}{mgru}{m}{n}
751 \SetSymbolFont{mgr@it}{bold}{TU}{mgru}{b}{n}
752
753 \else\ifmathgreeks@unicodemath
754 \@ifpackageloaded{unicode-math}{}{
755 \PackageError{mathgreeks}{`unicodemath' option needs
756 the unicode-math package\MessageBreak
757 which must be run with LuaLaTeX or XeLaTeX}{}
758 }
759 \setmathfont{\mathgreeks@unicodemath}[range=it/{greek,Greek}]
760 \setmathfont{\mathgreeks@unicodemath}[range=up/{greek,Greek}]
761 \mathgreeks@fontspectrue % for \mgr@CodeGreeks
762 \let\mgr@UnicodeGreek\mgr@UnicodemathGreek
763
764 \else\ifmathgreeks@upgreek
765 \ifdefstring{\mathgreeks@upgreek}{Euler}{
766 \DeclareFontFamily{U}{eur}{\skewchar\font'177}
767 \DeclareFontShape{U}{eur}{m}{n}{%
768 <-6> eurm5 <6-8> eurm7 <8-> eurm10}{}
769 \DeclareFontShape{U}{eur}{b}{n}{%
770 <-6> eurb5 <6-8> eurb7 <8-> eurb10}{}
771 \DeclareSymbolFont{mgr@up}{U}{eur}{m}{n}
772 \SetSymbolFont{mgr@up}{bold}{U}{eur}{b}{n}
773 }{
774 \ifdefstring{\mathgreeks@upgreek}{Symbol}{
775 \DeclareSymbolFont{mgr@up}{U}{psy}{m}{n} % no bold face
776 \mathgreeks@Symboltrue
777 }{
778 \ifdefstring{\mathgreeks@upgreek}{Symbolsmallscale}{
779 \DeclareFontFamily{U}{fsy}{}
780 \DeclareFontShape{U}{fsy}{m}{n}{<->s*[.9]psyr}{}
781 \DeclareSymbolFont{mgr@up}{U}{fsy}{m}{n}
782 \mathgreeks@Symboltrue
783 }{
784 \PackageError{mathgreeks}{Invalid value
785 `\mathgreeks@upgreek' with `upgreek' key}{With `upgreek'
786 possible values are: Euler, Symbol, Symbolsmallscale.}
787 }}}
788
789 \else\ifmathgreeks@mathdesign
790 \ifdefstring{\mathgreeks@mathdesign}{Utopia}{
791 \DeclareSymbolFont{mgr@it}{OML}{mdput}{m}{it}
792 \SetSymbolFont{mgr@it}{bold}{OML}{mdput}{b}{it}
793 \DeclareSymbolFont{mgr@up}{OML}{mdput}{m}{n}
794 \SetSymbolFont{mgr@up}{bold}{OML}{mdput}{b}{n}
795 }{
796 \ifdefstring{\mathgreeks@mathdesign}{Garamond}{
797 \DeclareSymbolFont{mgr@it}{OML}{mdugm}{m}{it}
798 \SetSymbolFont{mgr@it}{bold}{OML}{mdugm}{b}{it}
799 \DeclareSymbolFont{mgr@up}{OML}{mdugm}{m}{n}
800 \SetSymbolFont{mgr@up}{bold}{OML}{mdugm}{b}{n}
801 }{
802 \ifdefstring{\mathgreeks@mathdesign}{Charter}{
803 \DeclareSymbolFont{mgr@it}{OML}{mdbch}{m}{it}
804 \SetSymbolFont{mgr@it}{bold}{OML}{mdbch}{b}{it}
805 \DeclareSymbolFont{mgr@up}{OML}{mdbch}{m}{n}
806 \SetSymbolFont{mgr@up}{bold}{OML}{mdbch}{b}{n}
807 }{
808 \PackageError{mathgreeks}{Invalid value
809 `\mathgreeks@mathdesign' with `mathdesign' key}{With
810 `mathdesign' possible values are:
811 Utopia, Garamond, Charter.}
812 }}}
813
814 \else\ifmathgreeks@fourier
815 \DeclareFontEncoding{FML}{}{}
816 \DeclareFontSubstitution{FML}{futm}{m}{it}
817 \DeclareSymbolFont{mgr@it}{FML}{futmi}{m}{it}
818 \SetSymbolFont{mgr@it}{bold}{FML}{futmi}{b}{it}
819 \DeclareSymbolFont{mgr@up}{FML}{futm}{m}{it}
820 \SetSymbolFont{mgr@up}{bold}{FML}{futm}{b}{it}
821
822 \else\ifmathgreeks@kpfonts
823 \ifdefstring{\mathgreeks@kpfonts}{normal}{
824 \DeclareSymbolFont{mgr@it}{OML}{jkp}{m}{it}
825 \SetSymbolFont{mgr@it}{bold}{OML}{jkp}{bx}{it}
826 \DeclareSymbolFont{mgr@up}{U}{jkpmia}{m}{it}
827 \SetSymbolFont{mgr@up}{bold}{U}{jkpmia}{bx}{it}
828 }{
829 \ifdefstring{\mathgreeks@kpfonts}{light}{
830 \DeclareSymbolFont{mgr@it}{OML}{jkpl}{m}{it}
831 \SetSymbolFont{mgr@it}{bold}{OML}{jkpl}{bx}{it}
832 \DeclareSymbolFont{mgr@up}{U}{jkplmia}{m}{it}
833 \SetSymbolFont{mgr@up}{bold}{U}{jkplmia}{bx}{it}
834 }{
835 \PackageError{mathgreeks}{Invalid value
836 `\mathgreeks@kpfonts' with `kpfonts' key}{With
837 `kpfonts' possible values are: normal, light.}
838 }}
839
840 \else\ifmathgreeks@pxfonts % no font option specified
841 \DeclareSymbolFont{mgr@it}{OML}{pxmi}{m}{it}
842 \SetSymbolFont{mgr@it}{bold}{OML}{pxmi}{bx}{it}
843 \DeclareSymbolFont{mgr@up}{U}{pxmia}{m}{it}
844 \SetSymbolFont{mgr@up}{bold}{U}{pxmia}{bx}{it}
845
846 \else\ifmathgreeks@txfonts
847 \DeclareSymbolFont{mgr@it}{OML}{txmi}{m}{it}
848 \SetSymbolFont{mgr@it}{bold}{OML}{txmi}{bx}{it}
849 \DeclareSymbolFont{mgr@up}{U}{txmia}{m}{it}
850 \SetSymbolFont{mgr@up}{bold}{U}{txmia}{bx}{it}
851
852 \else\ifmathgreeks@libertinus
853 \ifmathgreeks@libsans \libus@sansmathtrue\fi
854 \DeclareFontEncoding{LS1}{}{}
855 \DeclareFontSubstitution{LS1}{libertinust1math}{m}{n}
856 \DeclareSymbolFont{mgr@it}{LS1}{libertinust1math}{m}{it}
857 \SetSymbolFont{mgr@it}{bold}{LS1}{libertinust1math}{m}{it}
858 \DeclareSymbolFont{mgr@up}{LS1}{libertinust1math}{m}{n}
859 \SetSymbolFont{mgr@up}{bold}{LS1}{libertinust1math}{m}{n}
860
861 \else\ifmathgreeks@concrete
862 \DeclareSymbolFont{mgr@it}{OML}{ccm}{m}{it}
863 \SetSymbolFont{mgr@it}{bold}{OML}{ccm}{b}{it}
864 \mathgreeks@itgreektrue
865
866 \else\ifmathgreeks@cmbright
867 \DeclareSymbolFont{mgr@it}{OML}{cmbrm}{m}{it}
868 \SetSymbolFont{mgr@it}{bold}{OML}{cmbrm}{b}{it}
869 \mathgreeks@itgreektrue
870
871 \else
872 \PackageWarningNoLine{mathgreeks}{No font option specified}
873 \mathgreeks@fontfalse
874 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
875
876 \ifmathgreeks@savegreeks \SaveGreeks \fi
877
878 \ifmathgreeks@font
879 \ifmathgreeks@upgreek
880 \mathgreeks@Greekuptrue \mathgreeks@greekuptrue
881 \PackageWarningNoLine{mathgreeks}{Commands \string \italpha,
882 \string\itbeta... \MessageBreak
883 not available with the `upgreek' option}
884 \else
885 \mgr@CodeGreeks{it}
886 \fi
887 \ifmathgreeks@itgreek
888 \mathgreeks@Greekupfalse \mathgreeks@greekupfalse
889 \PackageWarningNoLine{mathgreeks}{Commands \string \upalpha,
890 \string\upbeta... \MessageBreak
891 not available with `concrete' or 'cmbright}
892 \else
893 \mgr@CodeGreeks{up}
894 \fi
895 \mgr@DefaultGreeks
896 \fi
897 }}
898
899
900 %%%%%%%%%%%%%%%%%%%%%%%%%% MACROS %%%%%%%%%%%%%%%%%%%%%%%%%%%
901
902
903 \def\re@DeclareMathSymbol#1#2#3#4{% from kpfonts, pxfonts, txfonts
904 \let#1=\undefined
905 \DeclareMathSymbol{#1}{#2}{#3}{#4}}
906
907 %\def\re@DeclareMathSymbol#1#2#3#4{% from newtxmath
908 %\if\relax\noexpand#1\let#1=\undefined \fi
909 %\DeclareMathSymbol{#1}{#2}{#3}{#4}}
910
911 \newcommand{\mgr@CodeGreek}[3]{% #1 = it or up
912 \expandafter\re@DeclareMathSymbol\csname#1#2\endcsname%
913 {\mathalpha}{mgr@#1}{#3} % perhaps \mathord is better
914 }
915
916 \newcommand{\mgr@UnicodeGreek}[3]{%
917 \expandafter\Umathchardef\csname#1#2\endcsname="7 % mathalpha
918 \csname symmgr@#1\endcsname #3
919 }
920
921 \def\mgr@UnicodemathGreek#1#2#3{\unskip
922 \expandafter\DeclareRobustCommand\csname#1#2\endcsname
923 {\csname sym#1\endcsname{\symbol{#3}}}\ignorespaces
924 }
925
926 \newcommand{\mgr@CodeGreeks}[1]{% #1 = it or up
927 \ifmathgreeks@lgrmath % LGR encoding
928 \mgr@CodeGreek{#1}{Gamma}{71}
929 \mgr@CodeGreek{#1}{Delta}{68}
930 \mgr@CodeGreek{#1}{Theta}{74}
931 \mgr@CodeGreek{#1}{Lambda}{76}
932 \mgr@CodeGreek{#1}{Xi}{88}
933 \mgr@CodeGreek{#1}{Pi}{80}
934 \mgr@CodeGreek{#1}{Sigma}{83}
935 \mgr@CodeGreek{#1}{Upsilon}{85}
936 \mgr@CodeGreek{#1}{Phi}{70}
937 \mgr@CodeGreek{#1}{Psi}{89}
938 \mgr@CodeGreek{#1}{Omega}{87}
939 \mgr@CodeGreek{#1}{alpha}{97}
940 \mgr@CodeGreek{#1}{beta}{98}
941 \mgr@CodeGreek{#1}{gamma}{103}
942 \mgr@CodeGreek{#1}{delta}{100}
943 \mgr@CodeGreek{#1}{epsilon}{101}
944 \mgr@CodeGreek{#1}{zeta}{122}
945 \mgr@CodeGreek{#1}{eta}{104}
946 \mgr@CodeGreek{#1}{theta}{106}
947 \mgr@CodeGreek{#1}{iota}{105}
948 \mgr@CodeGreek{#1}{kappa}{107}
949 \mgr@CodeGreek{#1}{lambda}{108}
950 \mgr@CodeGreek{#1}{mu}{109}
951 \mgr@CodeGreek{#1}{nu}{110}
952 \mgr@CodeGreek{#1}{xi}{120}
953 \mgr@CodeGreek{#1}{pi}{112}
954 \mgr@CodeGreek{#1}{rho}{114}
955 \mgr@CodeGreek{#1}{sigma}{115}
956 \mgr@CodeGreek{#1}{tau}{116}
957 \mgr@CodeGreek{#1}{upsilon}{117}
958 \mgr@CodeGreek{#1}{phi}{102}
959 \mgr@CodeGreek{#1}{chi}{113}
960 \mgr@CodeGreek{#1}{psi}{121}
961 \mgr@CodeGreek{#1}{omega}{119}
962 \mgr@CodeGreek{#1}{varepsilon}{101} % = epsilon
963 \mgr@CodeGreek{#1}{vartheta}{106} % = theta
964 \mgr@CodeGreek{#1}{varpi}{112} % = pi
965 \mgr@CodeGreek{#1}{varrho}{114} % = rho
966 \mgr@CodeGreek{#1}{varsigma}{99}
967 \mgr@CodeGreek{#1}{varphi}{102} % = phi
968 \else\ifmathgreeks@fontspec % unicode encoding
969 \mgr@UnicodeGreek{#1}{Gamma}{"0393}
970 \mgr@UnicodeGreek{#1}{Delta}{"0394}
971 \mgr@UnicodeGreek{#1}{Theta}{"0398}
972 \mgr@UnicodeGreek{#1}{Lambda}{"039B}
973 \mgr@UnicodeGreek{#1}{Xi}{"039E}
974 \mgr@UnicodeGreek{#1}{Pi}{"03A0}
975 \mgr@UnicodeGreek{#1}{Sigma}{"03A3}
976 \mgr@UnicodeGreek{#1}{Upsilon}{"03A5}
977 \mgr@UnicodeGreek{#1}{Phi}{"03A6}
978 \mgr@UnicodeGreek{#1}{Psi}{"03A8}
979 \mgr@UnicodeGreek{#1}{Omega}{"03A9}
980 \mgr@UnicodeGreek{#1}{alpha}{"03B1}
981 \mgr@UnicodeGreek{#1}{beta}{"03B2}
982 \mgr@UnicodeGreek{#1}{gamma}{"03B3}
983 \mgr@UnicodeGreek{#1}{delta}{"03B4}
984 \mgr@UnicodeGreek{#1}{epsilon}{"03B5}
985 \mgr@UnicodeGreek{#1}{zeta}{"03B6}
986 \mgr@UnicodeGreek{#1}{eta}{"03B7}
987 \mgr@UnicodeGreek{#1}{theta}{"03B8}
988 \mgr@UnicodeGreek{#1}{iota}{"03B9}
989 \mgr@UnicodeGreek{#1}{kappa}{"03BA}
990 \mgr@UnicodeGreek{#1}{lambda}{"03BB}
991 \mgr@UnicodeGreek{#1}{mu}{"03BC}
992 \mgr@UnicodeGreek{#1}{nu}{"03BD}
993 \mgr@UnicodeGreek{#1}{xi}{"03BE} % not omicron
994 \mgr@UnicodeGreek{#1}{pi}{"03C0}
995 \mgr@UnicodeGreek{#1}{rho}{"03C1}
996 \mgr@UnicodeGreek{#1}{sigma}{"03C3}
997 \mgr@UnicodeGreek{#1}{tau}{"03C4}
998 \mgr@UnicodeGreek{#1}{upsilon}{"03C5}
999 \mgr@UnicodeGreek{#1}{phi}{"03C6}
1000 \mgr@UnicodeGreek{#1}{chi}{"03C7}
1001 \mgr@UnicodeGreek{#1}{psi}{"03C8}
1002 \mgr@UnicodeGreek{#1}{omega}{"03C9}
1003 \mgr@UnicodeGreek{#1}{varepsilon}{"03F5}
1004 \mgr@UnicodeGreek{#1}{vartheta}{"03D1}
1005 \mgr@UnicodeGreek{#1}{varpi}{"03D6}
1006 \mgr@UnicodeGreek{#1}{varrho}{"03F1}
1007 \mgr@UnicodeGreek{#1}{varsigma}{"03C2}
1008 \mgr@UnicodeGreek{#1}{varphi}{"03D5}
1009 \else\ifmathgreeks@Symbol % Symbol encoding
1010 \mgr@CodeGreek{#1}{Gamma}{`G}
1011 \mgr@CodeGreek{#1}{Delta}{`D}
1012 \mgr@CodeGreek{#1}{Theta}{`Q}
1013 \mgr@CodeGreek{#1}{Lambda}{`L}
1014 \mgr@CodeGreek{#1}{Xi}{`X}
1015 \mgr@CodeGreek{#1}{Pi}{`P}
1016 \mgr@CodeGreek{#1}{Sigma}{`S}
1017 \mgr@CodeGreek{#1}{Upsilon}{`U}
1018 \mgr@CodeGreek{#1}{Phi}{`F}
1019 \mgr@CodeGreek{#1}{Psi}{`Y}
1020 \mgr@CodeGreek{#1}{Omega}{`W}
1021 \mgr@CodeGreek{#1}{alpha}{`a}
1022 \mgr@CodeGreek{#1}{beta}{`b}
1023 \mgr@CodeGreek{#1}{gamma}{`g}
1024 \mgr@CodeGreek{#1}{delta}{`d}
1025 \mgr@CodeGreek{#1}{epsilon}{`e}
1026 \mgr@CodeGreek{#1}{zeta}{`z}
1027 \mgr@CodeGreek{#1}{eta}{`h}
1028 \mgr@CodeGreek{#1}{theta}{`q}
1029 \mgr@CodeGreek{#1}{iota}{`i}
1030 \mgr@CodeGreek{#1}{kappa}{`k}
1031 \mgr@CodeGreek{#1}{lambda}{`l}
1032 \mgr@CodeGreek{#1}{mu}{`m}
1033 \mgr@CodeGreek{#1}{nu}{`n}
1034 \mgr@CodeGreek{#1}{xi}{`x}
1035 \mgr@CodeGreek{#1}{pi}{`p}
1036 \mgr@CodeGreek{#1}{rho}{`r}
1037 \mgr@CodeGreek{#1}{sigma}{`s}
1038 \mgr@CodeGreek{#1}{tau}{`t}
1039 \mgr@CodeGreek{#1}{upsilon}{`u}
1040 \mgr@CodeGreek{#1}{phi}{`f}
1041 \mgr@CodeGreek{#1}{chi}{`c}
1042 \mgr@CodeGreek{#1}{psi}{`y}
1043 \mgr@CodeGreek{#1}{omega}{`w}
1044 \mgr@CodeGreek{#1}{varepsilon}{`u} % = epsilon
1045 \mgr@CodeGreek{#1}{vartheta}{`J}
1046 \mgr@CodeGreek{#1}{varpi}{`v}
1047 \mgr@CodeGreek{#1}{varrho}{`r} % = rho
1048 \mgr@CodeGreek{#1}{varsigma}{`s} % = sigma
1049 \mgr@CodeGreek{#1}{varphi}{`j}
1050 \else % OML (or U) encoding
1051 \mgr@CodeGreek{#1}{Gamma}{"00}
1052 \mgr@CodeGreek{#1}{Delta}{"01}
1053 \mgr@CodeGreek{#1}{Theta}{"02}
1054 \mgr@CodeGreek{#1}{Lambda}{"03}
1055 \mgr@CodeGreek{#1}{Xi}{"04}
1056 \mgr@CodeGreek{#1}{Pi}{"05}
1057 \mgr@CodeGreek{#1}{Sigma}{"06}
1058 \mgr@CodeGreek{#1}{Upsilon}{"07}
1059 \mgr@CodeGreek{#1}{Phi}{"08}
1060 \mgr@CodeGreek{#1}{Psi}{"09}
1061 \mgr@CodeGreek{#1}{Omega}{"0A}
1062 \mgr@CodeGreek{#1}{alpha}{"0B}
1063 \mgr@CodeGreek{#1}{beta}{"0C}
1064 \mgr@CodeGreek{#1}{gamma}{"0D}
1065 \mgr@CodeGreek{#1}{delta}{"0E}
1066 \mgr@CodeGreek{#1}{epsilon}{"0F}
1067 \mgr@CodeGreek{#1}{zeta}{"10}
1068 \mgr@CodeGreek{#1}{eta}{"11}
1069 \mgr@CodeGreek{#1}{theta}{"12}
1070 \mgr@CodeGreek{#1}{iota}{"13}
1071 \mgr@CodeGreek{#1}{kappa}{"14}
1072 \mgr@CodeGreek{#1}{lambda}{"15}
1073 \mgr@CodeGreek{#1}{mu}{"16}
1074 \mgr@CodeGreek{#1}{nu}{"17}
1075 \mgr@CodeGreek{#1}{xi}{"18}
1076 \mgr@CodeGreek{#1}{pi}{"19}
1077 \mgr@CodeGreek{#1}{rho}{"1A}
1078 \mgr@CodeGreek{#1}{sigma}{"1B}
1079 \mgr@CodeGreek{#1}{tau}{"1C}
1080 \mgr@CodeGreek{#1}{upsilon}{"1D}
1081 \mgr@CodeGreek{#1}{phi}{"1E}
1082 \mgr@CodeGreek{#1}{chi}{"1F}
1083 \mgr@CodeGreek{#1}{psi}{"20}
1084 \mgr@CodeGreek{#1}{omega}{"21}
1085 \mgr@CodeGreek{#1}{varepsilon}{"22}
1086 \mgr@CodeGreek{#1}{vartheta}{"23}
1087 \mgr@CodeGreek{#1}{varpi}{"24}
1088 \mgr@CodeGreek{#1}{varrho}{"25}
1089 \mgr@CodeGreek{#1}{varsigma}{"26}
1090 \mgr@CodeGreek{#1}{varphi}{"27}
1091 %\mgr@CodeGreek{#1}{varkappa}{"FE}
1092 \fi\fi\fi
1093 }
1094
1095 \newcommand\mgr@DefaultGreeks{%
1096 \ifmathgreeks@uppercase
1097 \ifmathgreeks@Greekup
1098 \let\Gamma\upGamma
1099 \let\Delta\upDelta
1100 \let\Theta\upTheta
1101 \let\Lambda\upLambda
1102 \let\Xi\upXi
1103 \let\Pi\upPi
1104 \let\Sigma\upSigma
1105 \let\Upsilon\upUpsilon
1106 \let\Phi\upPhi
1107 \let\Psi\upPsi
1108 \let\Omega\upOmega
1109 \else
1110 \let\Gamma\itGamma
1111 \let\Delta\itDelta
1112 \let\Theta\itTheta
1113 \let\Lambda\itLambda
1114 \let\Xi\itXi
1115 \let\Pi\itPi
1116 \let\Sigma\itSigma
1117 \let\Upsilon\itUpsilon
1118 \let\Phi\itPhi
1119 \let\Psi\itPsi
1120 \let\Omega\itOmega
1121 \fi\fi
1122 \ifmathgreeks@lowercase
1123 \ifmathgreeks@greekup
1124 \let\alpha\upalpha
1125 \let\beta\upbeta
1126 \let\gamma\upgamma
1127 \let\delta\updelta
1128 \let\epsilon\upepsilon
1129 \let\zeta\upzeta
1130 \let\eta\upeta
1131 \let\theta\uptheta
1132 \let\iota\upiota
1133 \let\kappa\upkappa
1134 \let\lambda\uplambda
1135 \let\mu\upmu
1136 \let\nu\upnu
1137 \let\xi\upxi
1138 \let\pi\uppi
1139 \let\rho\uprho
1140 \let\sigma\upsigma
1141 \let\tau\uptau
1142 \let\upsilon\upupsilon
1143 \let\phi\upphi
1144 \let\chi\upchi
1145 \let\psi\uppsi
1146 \let\omega\upomega
1147 \let\varepsilon\upvarepsilon
1148 \let\vartheta\upvartheta
1149 \let\varpi\upvarpi
1150 \let\varrho\upvarrho
1151 \let\varsigma\upvarsigma
1152 \let\varphi\upvarphi
1153 \else
1154 \let\alpha\italpha
1155 \let\beta\itbeta
1156 \let\gamma\itgamma
1157 \let\delta\itdelta
1158 \let\epsilon\itepsilon
1159 \let\zeta\itzeta
1160 \let\eta\iteta
1161 \let\theta\ittheta
1162 \let\iota\itiota
1163 \let\kappa\itkappa
1164 \let\lambda\itlambda
1165 \let\mu\itmu
1166 \let\nu\itnu
1167 \let\xi\itxi
1168 \let\pi\itpi
1169 \let\rho\itrho
1170 \let\sigma\itsigma
1171 \let\tau\ittau
1172 \let\upsilon\itupsilon
1173 \let\phi\itphi
1174 \let\chi\itchi
1175 \let\psi\itpsi
1176 \let\omega\itomega
1177 \let\varepsilon\itvarepsilon
1178 \let\vartheta\itvartheta
1179 \let\varpi\itvarpi
1180 \let\varrho\itvarrho
1181 \let\varsigma\itvarsigma
1182 \let\varphi\itvarphi
1183 \fi\fi
1184 }
1185
1186 \providecommand\SaveGreeks{%
1187 \let\backGamma\Gamma
1188 \let\backDelta\Delta
1189 \let\backTheta\Theta
1190 \let\backLambda\Lambda
1191 \let\backXi\Xi
1192 \let\backPi\Pi
1193 \let\backSigma\Sigma
1194 \let\backUpsilon\Upsilon
1195 \let\backPhi\Phi
1196 \let\backPsi\Psi
1197 \let\backOmega\Omega
1198 \let\backalpha\alpha
1199 \let\backbeta\beta
1200 \let\backgamma\gamma
1201 \let\backdelta\delta
1202 \let\backepsilon\epsilon
1203 \let\backzeta\zeta
1204 \let\backeta\eta
1205 \let\backtheta\theta
1206 \let\backiota\iota
1207 \let\backkappa\kappa
1208 \let\backlambda\lambda
1209 \let\backmu\mu
1210 \let\backnu\nu
1211 \let\backxi\xi
1212 \let\backpi\pi
1213 \let\backrho\rho
1214 \let\backsigma\sigma
1215 \let\backtau\tau
1216 \let\backupsilon\upsilon
1217 \let\backphi\phi
1218 \let\backchi\chi
1219 \let\backpsi\psi
1220 \let\backomega\omega
1221 \let\backvarepsilon\varepsilon
1222 \let\backvartheta\vartheta
1223 \let\backvarpi\varpi
1224 \let\backvarrtho\varrho
1225 \let\backvarsigma\varsigma
1226 \let\backvarphi\varphi
1227 }
1228
1229
1230 %%%%%%%%%%%%%% Macros for changing font dynamically %%%%%%%%%%%%%
1231
1232 \def\setmathgreeks#1{\setkeys{mathgreeks}{#1}\unskip
1233 \ifmathgreeks@upgreek
1234 \mathgreeks@Greekuptrue
1235 \mathgreeks@greekuptrue
1236 \PackageWarning{mathgreeks}{Style is set to `upright'
1237 \MessageBreak with the `upgreek' option}
1238 \fi
1239 \mgr@DefaultGreeks\ignorespaces
1240 }
1241
1242 \newif\ifmgrfont@unicodemath
1243 \define@key{mgrfont}{unicode-math}[Latin Modern Math]{%
1244 \def\mgrfont@unicodemath{#1}\mgrfont@unicodemathtrue}
1245 \newif\ifmgrfont@fontspec
1246 \define@key{mgrfont}{fontspec}[GFS Didot]{%
1247 \def\mgrfont@fontspec{#1}\mgrfont@fontspectrue}
1248 \define@key{mgrfont}{enc}{\def\mgrfont@enc{#1}}
1249 \define@key{mgrfont}{fam}{\def\mgrfont@fam{#1}}
1250 \newcommand*\mgrfont@series{m} % default value
1251 \define@key{mgrfont}{series}{\renewcommand*\mgrfont@series{#1}}
1252 \newcommand*\mgrfont@shape{it} % default value
1253 \define@key{mgrfont}{shape}{\renewcommand*\mgrfont@shape{#1}}
1254
1255 \def\mathgreeksfont#1{%
1256 \mgrfont@unicodemathfalse
1257 \mgrfont@fontspecfalse
1258 \renewcommand*\mgrfont@series{m}
1259 \renewcommand*\mgrfont@shape{it}
1260 \mathgreeks@lgrmathfalse
1261 \mathgreeks@fontspecfalse
1262 \mathgreeks@Symbolfalse
1263 \mathgreeks@upgreekfalse
1264 \setkeys{mgrfont}{#1}
1265 \ifmgrfont@unicodemath
1266 \setmathfont{\mgrfont@unicodemath}[range=it/{greek,Greek}]
1267 \setmathfont{\mgrfont@unicodemath}[range=up/{greek,Greek}]
1268 \let\mgr@UnicodeGreek\mgr@UnicodemathGreek
1269 \mathgreeks@fontspectrue % for \mgr@CodeGreeks
1270 \mgr@CodeGreeks{it}
1271 \mgr@CodeGreeks{up}
1272 \mgr@DefaultGreeks
1273 \else\ifmgrfont@fontspec
1274 \let\MathGreeksFont\relax
1275 \newfontfamily\MathGreeksFont{\mgrfont@fontspec}
1276 \let\mgr@UnicodeGreek\mgr@NewUnicodeGreek
1277 \mathgreeks@fontspectrue
1278 \mgr@CodeGreeks{it}
1279 \mgr@CodeGreeks{up}
1280 \mgr@DefaultGreeks
1281 \else
1282 \let\mgr@CodeGreek\mgr@NewCodeGreek
1283 \ifdefstring{\mgrfont@enc}{LGR}{
1284 \mathgreeks@lgrmathtrue
1285 }{
1286 \ifdefstring{\mgrfont@fam}{psy}{
1287 \mathgreeks@Symboltrue
1288 }{
1289 \ifdefstring{\mgrfont@fam}{fsy}{
1290 \mathgreeks@Symboltrue
1291 }{
1292 }}}
1293 \mgr@CodeGreeks{}
1294 \fi\fi
1295 }
1296
1297 \def\mgr@NewCodeGreek#1#2#3{\unskip
1298 \expandafter\DeclareRobustCommand\csname#1#2\endcsname
1299 {\mathalpha{\text{\usefont{\mgrfont@enc}{\mgrfont@fam}
1300 {\mgrfont@series}{\mgrfont@shape}\symbol{#3}}
1301 }}\ignorespaces
1302 }
1303
1304 \def\mgr@NewUnicodeGreek#1#2#3{\unskip % only with fontspec
1305 \expandafter\DeclareRobustCommand\csname#1#2\endcsname
1306 {\mathalpha{\text{\csname#1shape\endcsname%
1307 \MathGreeksFont\symbol{#3}}
1308 }}\ignorespaces
1309 }
1310
1311 \providecommand\greektable{
1312 $\begin{array}{c}
1313 \begin{array}{*{23}{@{\;}c}@{\;}}
1314 \alpha & \beta & \gamma & \delta & \epsilon & \zeta & \eta &
1315 \theta & \iota & \kappa & \lambda & \mu & \nu & \xi & \pi &
1316 \rho & \sigma & \tau & \upsilon & \phi & \chi & \psi & \omega
1317 \end{array}
1318 \\
1319 \begin{array}{*{18}{@{\;}c}@{\;}}
1320 \varepsilon & \vartheta & \varpi & \varrho & \varsigma & \varphi
1321 & | &
1322 \Gamma & \Delta & \Theta & \Lambda & \Xi & \Pi & \Sigma &
1323 \Upsilon & \Phi & \Psi & \Omega
1324 \end{array}
1325 \end{array}$
1326 }
1327
1328 % \end{macrocode}
1329 % \Finale
1330 \endinput