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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263
|
% -*- coding: utf-8; time-stamp-format: "%02d-%02m-%:y at %02H:%02M:%02S %Z" -*-
% Execute etex on this file to extract package files.
% See in README for more build instructions.
%<*dtx>
\def\dtxtimestamp {Time-stamp: <16-11-2022 at 21:29:30 CET>}
%%
%% Package: lgrmath
%% Greek in math mode via LGR font of one's choice (JFB)
%% Version: 1.0
%% License: LPPL 1.3c
%% Copyright (C) 2022 Jean-François Burnol
%% Repository: https://github.com/jfbu/lgrmath
%%
%</dtx>
%<*tex>
\def\lgrmathversion{1.0}
\def\lgrmathdate{2022/11/16}
%</tex>
%<*dtx>
\iffalse
%</dtx>
%<*tex>
%% This is a generated file. Run latexmk on this file lgrmath.tex then
%% run dvipdfmx on lgrmath.dvi to produce the documentation lgrmath.pdf,
%% with the package source code included.
%%
%% Customize as desired the class options and the two toggles below.
%%
%% See lgrmath.dtx for the copyright and the conditions for distribution
%% and/or modification of this Work.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{lgrmath.tex}%
[\lgrmathdate\space v\lgrmathversion\space
driver file for lgrmath documentation (JFB)]%
\PassOptionsToClass{a4paper,fontsize=11pt}{scrartcl}
\chardef\Withdvipdfmx \ifdefined\pdfoutput\ifnum\pdfoutput>0 0\else1\fi\else0\fi\relax
\chardef\NoSourceCode 0 % replace 0<space> by 1<space> for no source code
\input lgrmath.dtx
%%% Local Variables:
%%% mode: latex
%%% End:
%</tex>
%<*dtx>
\fi
\chardef\noetex 0
\ifx\numexpr\undefined\chardef\noetex 1 \fi
\ifnum\noetex=1 \chardef\extractfiles 0 % extract files, then stop
\else
\ifx\ProvidesFile\undefined
\chardef\extractfiles 0 % etex etc.. on lgrmath.dtx
\else % latex/pdflatex on lgrmath.tex or on lgrmath.dtx
\ifx\Withdvipdfmx\undefined
% (lua|xe|pdf)latex run is on lgrmath.dtx, we will extract all files
\chardef\extractfiles 1 % 1 = extract all and typeset doc
\chardef\Withdvipdfmx
\ifdefined\pdfoutput\ifnum\pdfoutput>0 0\else1\fi\else0\fi\relax
\chardef\NoSourceCode 1 %
\NeedsTeXFormat{LaTeX2e}%
\PassOptionsToClass{a4paper,fontsize=11pt}{scrartcl}%
\else % latex run is on lgrmath.tex,
\chardef\extractfiles 2 % no extractions
\fi
\ProvidesFile{lgrmath.dtx}%
[lgrmath source (\lgrmathversion\space of \lgrmathdate) (JFB)]%
\fi
\fi
\ifnum\extractfiles<2 % extract files
\def\MessageDeFin{\newlinechar10 \let\Msg\message
\Msg{^^J}%
\Msg{********************************************************************^^J}%
\Msg{*^^J}%
\Msg{* To finish the installation you have to move the following^^J}%
\Msg{* file into a directory searched by TeX:^^J}%
\Msg{*^^J}%
\Msg{*\space\space\space\space lgrmath.sty^^J}%
\Msg{*^^J}%
\Msg{* To produce the documentation with source code included run latexmk^^J}%
\Msg{* on extracted lgrmath.tex and then dvipdfmx on lgrmath.dvi^^J}%
\Msg{*^^J}%
\Msg{* Happy TeXing!^^J}%
\Msg{*^^J}%
\Msg{********************************************************************^^J}%
}%
\begingroup
\input docstrip.tex
\askforoverwritefalse
\generate{\nopreamble
\usepostamble\defaultpostamble
\file{lgrmath.tex}{\from{lgrmath.dtx}{tex}}%
\usepreamble\defaultpreamble
\file{lgrmath.sty}{\from{lgrmath.dtx}{sty}}%
}
\endgroup
\fi % end of file extractions
\ifnum\extractfiles=0
% tex/etex/xetex/etc on lgrmath.dtx, files are now extracted, stop
\MessageDeFin\expandafter\end
\fi
% no file extractions if latex compilation was on lgrmath.tex
\ifdefined\MessageDeFin\AtEndDocument{\MessageDeFin}\fi
\ifnum\Withdvipdfmx>0
\documentclass [dvipdfmx]{scrartcl}
\else
\documentclass {scrartcl}
\fi
\tracinglostchars=2
% use doc with v2 because hyperref option clash with hypdoc
% no time to read documentation now
\usepackage{doc}[=v2]
% but the v2 does not define \cs, it got defined in ltxdoc
\def\cmd#1{\cs{\expandafter\cmd@to@cs\string#1}}
\def\cmd@to@cs#1#2{\char\number`#2\relax}
\DeclareRobustCommand\cs[1]{\texttt{\bslash#1}}
\AtBeginDocument{%
\pdfstringdefDisableCommands{\def\cs#1{\textbackslash\detokenize{#1}}}%
}%
% these are not defined by doc package
\providecommand\marg[1]{%
{\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
\providecommand\oarg[1]{%
{\ttfamily[}\meta{#1}{\ttfamily]}}
\providecommand\parg[1]{%
{\ttfamily(}\meta{#1}{\ttfamily)}}
\CodelineNumbered
\AtBeginDocument{\MakeShortVerb\|}
\ifnum\NoSourceCode=1
\OnlyDescription
\fi
\usepackage[LGR,T1]{fontenc}
\usepackage{hologo}
%% \hologoFontSetup{general=\upshape\rmfamily}
\DeclareRobustCommand*{\pdfLaTeX}{\hologo{pdfLaTeX}}%
% \DeclareRobustCommand*{\eTeX}{\hologo{eTeX}}%
% \DeclareRobustCommand*{\LuaTeX}{\hologo{LuaTeX}}%
% \DeclareRobustCommand*{\LuaLaTeX}{\hologo{LuaLaTeX}}%
% \DeclareRobustCommand*{\XeTeX}{\hologo{XeTeX}}%
% \DeclareRobustCommand*{\XeLaTeX}{\hologo{XeLaTeX}}%
\usepackage{geometry}
\usepackage[english]{babel}
\usepackage{color}
\definecolor{joli}{RGB}{225,95,0}
\definecolor{JOLI}{RGB}{225,95,0}
\definecolor{urlcolor}{RGB}{38,128,192}
\usepackage{colorframed}
\definecolor{shadecolor}{RGB}{223,219,195}
\usepackage{hyperref}
\hypersetup{%
linktoc=all,%
breaklinks=true,%
colorlinks=true,%
linkcolor={red},%
urlcolor={urlcolor},
pdfauthor={Jean-François Burnol},%
pdftitle={The lgrmath package},%
pdfstartview=FitH,%
pdfpagemode=UseNone,%
}
\usepackage{hypcap}
\usepackage{bookmark}
\usepackage{enumerate}
\usepackage{mlmodern}
\DeclareEncodingSubset{TS1}{mlmtt}{0}% fix \textasciigrave related latex2e#905
% useless with doc.sty
% \usepackage{upquote}
% as \verb, verbatim and macrocode do not use \@noligs
\begingroup
\catcode`\'\active\catcode`\`\active
\gdef\MakePrivateLetters{\makeatletter\def`{\textasciigrave}\def'{\textquotesingle}}
\endgroup
% https://github.com/latex3/latex2e/issues/953, for the record
\usepackage{xspace}
\newcommand\ctanpkg[1]{\href{https://ctan.org/pkg/#1}{#1}}
% Vendredi 11 novembre 2022 : impossible d'utiliser \hypersetup{urlcolor=joli}
% dans \section (même sans le \texorpdfstring).
% même si la macro \lgrmath est déclarée robuste mais avec \protected c'est bon
% \DeclareRobustCommand\lgrmath{{\hypersetup{urlcolor=joli}lgrmath}}% <-- BAD
% ceci ok (mais il faudra ajouter \texorpdfstring)
% \protected\def\lgrmath{{\hypersetup{urlcolor=joli}lgrmath}}% <-- OK
% L'erreur est
% Argument of \KVS@@CommaComma has an extra }
% mais je n'ai pas cherché à en savoir plus. De plus dans le code ci-dessous
% on avait plutôt un stack overflow dû à boucle infinie.
% le \texorpdfstring ne sert à rien si \protected dans \section
\protected\def\lgrmath{%
{\hypersetup{urlcolor=joli}\bfseries \ctanpkg{lgrmath}}\xspace
}
\pdfstringdefDisableCommands{\def\lgrmath{lgrmath\xspace}}
\usepackage{centeredline}
\usepackage{lgrmath}
\begin{document}\renewcommand\familydefault\sfdefault
\begin{center}
{\Large The \lgrmath package}\\
\textsc{Jean-François Burnol}\\
\texttt{jfbu (at) free (dot) fr}\\
\footnotesize
This is \lgrmathversion\ (\lgrmathdate) from
source file having \dtxtimestamp\\
Report issues at \url{https://github.com/jfbu/lgrmath/issues}
\end{center}
{
\addtocontents{toc}{\protect\hypersetup{hidelinks}}
\addtocontents{lot}{\protect\hypersetup{hidelinks}}
\tableofcontents
\listoftables
}
\section{Description}
The \lgrmath package sets the Greek letters {in math mode} (\textbf{only}) to use glyphs
from the LGR-encoded font of one's choice.
Thus \lgrmath is for people who want \emph{only} to adjust Greek letters in
math mode (and easily configure usage of upright or italic/slanted shapes),
perhaps in the context of having changed Latin letters as well, e.g.\@ from
using the \ctanpkg{frenchmath}%
%
\footnote{Antoine \textsc{Missier}, \emph{Typesetting mathematics according to French rules}, \url{https://ctan.org/pkg/frenchmath}.}
%
package which makes uppercase Latin letters in
math mode render upright, among quite a few other adjustments tailored for
French mathematical typesetting, or the \ctanpkg{mathastext}%
%
\footnote{Verfasser, \emph{Use the text font in math mode}, \url{https://ctan.org/pkg/mathastext}.}
%
package.
Actually \lgrmath is in part inspired from this latter package |LGRgreek|
option and \cs{MTgreekfont} command. But \lgrmath currently does not
incorporate a mechanism for defining and using multiple math versions, each one
with its own font for Greek letters, as is already provided by
\ctanpkg{mathastext}.
The package is also related to \ctanpkg{libgreek}%
%
\footnote{Verfasser, \emph{Greek letters in math mode from Libertinus or Linux
Libertine/Biolinum}, \url{https://ctan.org/pkg/libgreek}.},
%
also by the author, and shares most of its codebase, after dropping matters
related to |libgreek-legacy|, and the |scale| option which can not be
implemented generically.
The Greek letters all come with \cs{...up} and \cs{...it} named variants, and
whether ``bare'' control sequences map to the `|up|' or `|it|' ones can be
configured via package options, even midway in the document via
\cs{lgrmathsetup}. Further, the package optionally defines two math
alphabets \cs{lgrmathup} and \cs{lgrmathit}. What `|up|' and `|it|'
actually mean can be configured using the |upshape| and |itshape| keys at
package loading time.
\section{Options of the \lgrmath package}
\begin{table}[htbp]
\capstart
\DeleteShortVerb\|% a effet global !
\let\s\string
\ttfamily
\lgrmathsetup{style=fReNcH}% testing lowercasing works
\centering
\begin{tabular}{|lc|lc|lc|lc|}
\hline
\s\Alpha&$\Alpha$ &\s\Nu&$\Nu$ &\s\alpha&$\alpha$ &\s\nu&$\nu$\\
\s\Beta&$\Beta$ &\s\Xi&$\Xi$ &\s\beta&$\beta$ &\s\xi&$\xi$\\
\s\Gamma&$\Gamma$ &\s\Omicron&$\Omicron$&\s\gamma&$\gamma$ &\s\omicron&$\omicron$\\
\s\Delta&$\Delta$ &\s\Pi&$\Pi$ &\s\delta&$\delta$ &\s\pi&$\pi$\\
\s\Epsilon&$\Epsilon$&\s\Rho&$\Rho$ &\s\epsilon&$\epsilon$&\s\rho&$\rho$\\
\s\Zeta&$\Zeta$ &\s\Sigma&$\Sigma$ &\s\zeta&$\zeta$ &\s\sigma&$\sigma$\\
\s\Eta&$\Eta$ &\s\Tau&$\Tau$ &\s\eta&$\eta$ &\s\tau&$\tau$\\
\s\Theta&$\Theta$ &\s\Upsilon&$\Upsilon$&\s\theta&$\theta$ &\s\upsilon&$\upsilon$\\
\s\Iota&$\Iota$ &\s\Phi&$\Phi$ &\s\iota&$\iota$ &\s\phi&$\phi$\\
\s\Kappa&$\Kappa$ &\s\Chi&$\Chi$ &\s\kappa&$\kappa$ &\s\chi&$\chi$\\
\s\Lambda&$\Lambda$ &\s\Psi&$\Psi$ &\s\lambda&$\lambda$ &\s\psi&$\psi$\\
\s\Mu&$\Mu$ &\s\Omega&$\Omega$ &\s\mu&$\mu$ &\s\omega&$\omega$\\
\hline
\end{tabular}
\medskip
\begin{tabular}{lclclc}
\s\varsigma&$\varsigma$ & \s\digamma&$\digamma$ & \s\varSigma&$\varSigma$ \\
\s\varvarsigma&$\varvarsigma$ & \s\koppa&$\koppa$ & \s\Sampi&$\Sampi$ \\
\s\sampi&$\sampi$ & & & \s\Digamma&$\Digamma$
\end{tabular}
\caption{Greek letters, upright shapes, default family}
\label{table:upright}
\MakeShortVerb\|
\end{table}
\begin{table}[htbp]
\capstart
\DeleteShortVerb\|% a effet global !
\let\s\string
\ttfamily
\lgrmathsetup{style=ISO}
\centering
\begin{tabular}{|lc|lc|lc|lc|}
\hline
\s\Alpha&$\Alpha$ &\s\Nu&$\Nu$ &\s\alpha&$\alpha$ &\s\nu&$\nu$\\
\s\Beta&$\Beta$ &\s\Xi&$\Xi$ &\s\beta&$\beta$ &\s\xi&$\xi$\\
\s\Gamma&$\Gamma$ &\s\Omicron&$\Omicron$&\s\gamma&$\gamma$ &\s\omicron&$\omicron$\\
\s\Delta&$\Delta$ &\s\Pi&$\Pi$ &\s\delta&$\delta$ &\s\pi&$\pi$\\
\s\Epsilon&$\Epsilon$&\s\Rho&$\Rho$ &\s\epsilon&$\epsilon$&\s\rho&$\rho$\\
\s\Zeta&$\Zeta$ &\s\Sigma&$\Sigma$ &\s\zeta&$\zeta$ &\s\sigma&$\sigma$\\
\s\Eta&$\Eta$ &\s\Tau&$\Tau$ &\s\eta&$\eta$ &\s\tau&$\tau$\\
\s\Theta&$\Theta$ &\s\Upsilon&$\Upsilon$&\s\theta&$\theta$ &\s\upsilon&$\upsilon$\\
\s\Iota&$\Iota$ &\s\Phi&$\Phi$ &\s\iota&$\iota$ &\s\phi&$\phi$\\
\s\Kappa&$\Kappa$ &\s\Chi&$\Chi$ &\s\kappa&$\kappa$ &\s\chi&$\chi$\\
\s\Lambda&$\Lambda$ &\s\Psi&$\Psi$ &\s\lambda&$\lambda$ &\s\psi&$\psi$\\
\s\Mu&$\Mu$ &\s\Omega&$\Omega$ &\s\mu&$\mu$ &\s\omega&$\omega$\\
\hline
\end{tabular}
\medskip
\begin{tabular}{lclclc}
\s\varsigma&$\varsigma$ & \s\digamma&$\digamma$ & \s\varSigma&$\varSigma$ \\
\s\varvarsigma&$\varvarsigma$ & \s\koppa&$\koppa$ & \s\Sampi&$\Sampi$ \\
\s\sampi&$\sampi$ & & & \s\Digamma&$\Digamma$
\end{tabular}
\caption{Greek letters, italic shapes, default family}
\label{table:italic}
\MakeShortVerb\|
\end{table}
Here are the options recognized by the package:
\begin{description}
\item[font=\meta{font\textunderscore name}] This specifies which font (font family in the
sens of the \LaTeX{} font selection scheme) to use. It defaults to |lmr|.
In \autoref{table:upright} and \autoref{table:italic} we display the
glyphs from this default font |lmr| in LGR encoding, available to \LaTeX{}
thanks to the
support files from the package (in the sense of CTAN or \TeX Live, not of a
\LaTeX{} document) \ctanpkg{cbfonts-fd}.%
%
\footnote{Claudio~\textsc{Beccari}, \emph{\LaTeX{} font description files for the CB Greek fonts}, \url{https://ctan.org/pkg/cbfonts-fd}.}
%
It is recommended to user to have a look at its
documentation\centeredline{|texdoc cbfonts|}
in particular the section on Customizations which mentions alternate shapes
(such as |rs|, |ro|, |li|, |iv|, |uv| --- those last two are actually for
sans-serif |lmss| ---, and there are also comments relative to the series)
and use appropriately the |upshape|, |itshape|, |series| and |boldseries|
\lgrmath keys which are documented next.
The allowable names \meta{font\textunderscore name}'s are those |foo| for
which a file |LGRfoo.fd| or |lgrfoo.fd| exists on the system.
The above remarks about customization apply generally to all fonts, try to
see if there is some documentation associated with the font you choose.
Ultimate experts will look into the |.fd| files to see (for example) if there
is some interface to rescale the fonts by some factor.
Here is now a list of suitable such font definition files from which you can
extract usable font family names. This has been obtained via exercising the
Unix |find| utility in a \TeX Live 2022 installation (possibly only partial).
To test a font the package provides \cs{lgrmathgreektable} and
\cs{lgrmathgreektableextra} which are documented in the next section.
\begin{snugshade}
\catcode`\'\active\catcode`\`\active
\def\MacroFont{\ttfamily\footnotesize\def'{\textquotesingle}\def`{\textasciigrave}}
\catcode\string`\`12 \catcode`\' 12
\begin{verbatim}
in directory /usr/local/texlive/2022/texmf-dist/tex/latex we execute
find . -name 'LGR*fd'
and then rearrange somewhat the output to put it in alphabetical order,
and gain some space horizontally so as to obtain a two-column display
Naturally in many instances the various -TLF, -OsF, and so on, refer
to options of digit characters and have no impact on the Greek letters,
nevertheless I kept all filenames, just pick one, drop LGR and .fd parts.
./alegreya/ ./librefranklin/
LGRAlegreya-Inf.fd LGRLibreFranklin-Sup.fd
LGRAlegreya-LF.fd LGRLibreFranklin-TLF.fd
LGRAlegreya-OsF.fd ./linguisticspro/
LGRAlegreya-Sup.fd LGRLinguisticsPro-LF.fd
LGRAlegreya-TLF.fd LGRLinguisticsPro-OsF.fd
LGRAlegreya-TOsF.fd ./nimbus15/
LGRAlegreyaSans-Inf.fd LGRNimbuSans.fd
LGRAlegreyaSans-LF.fd LGRNimbusMono.fd
LGRAlegreyaSans-OsF.fd LGRNimbusMonoN.fd
LGRAlegreyaSans-Sup.fd LGRNimbusSerif.fd
LGRAlegreyaSans-TLF.fd ./noto/
LGRAlegreyaSans-TOsF.fd LGRNotoSans-LF.fd
./clara/ LGRNotoSans-OsF.fd
LGRClara-Sup.fd LGRNotoSans-Sup.fd
LGRClara-TLF.fd LGRNotoSans-TLF.fd
LGRClara-TOsF.fd LGRNotoSans-TOsF.fd
./cochineal/ LGRNotoSansMono-Sup.fd
LGRCochineal-LF.fd LGRNotoSansMono-TLF.fd
LGRCochineal-OsF.fd LGRNotoSansMono-TOsF.fd
LGRCochineal-TLF.fd LGRNotoSerif-LF.fd
LGRCochineal-TOsF.fd LGRNotoSerif-OsF.fd
./comfortaa/ LGRNotoSerif-Sup.fd
LGRcomfortaa.fd LGRNotoSerif-TLF.fd
./dejavu/ LGRNotoSerif-TOsF.fd
LGRDejaVuSans-TLF.fd ./oldstandard/
LGRDejaVuSansCondensed-TLF.fd LGROldStandard-Sup.fd
LGRDejaVuSansMono-TLF.fd LGROldStandard-TLF.fd
LGRDejaVuSerif-TLF.fd ./opensans/
LGRDejaVuSerifCondensed-TLF.fd LGRopensans-LF.fd
./domitian/ LGRopensans-OsF.fd
LGRDomitian-Inf.fd LGRopensans-TLF.fd
LGRDomitian-Sup.fd LGRopensans-TOsF.fd
LGRDomitian-TLF.fd ./plex/
LGRDomitian-TOsF.fd LGRIBMPlexSans-Sup.fd
./droid/ LGRIBMPlexSans-TLF.fd
LGRdroidsans.fd ./roboto/
LGRdroidsansmono.fd LGRRoboto-LF.fd
LGRdroidserif.fd LGRRoboto-OsF.fd
./ebgaramond/ LGRRoboto-TLF.fd
LGREBGaramond-Inf.fd LGRRoboto-TOsF.fd
LGREBGaramond-LF.fd LGRRobotoMono-TLF.fd
LGREBGaramond-OsF.fd LGRRobotoSerif-LF.fd
LGREBGaramond-Sup.fd LGRRobotoSerif-OsF.fd
LGREBGaramond-TLF.fd LGRRobotoSerif-Sup.fd
LGREBGaramond-TOsF.fd LGRRobotoSerif-TLF.fd
LGREBGaramondInitials-TLF.fd LGRRobotoSerif-TOsF.fd
./fira/ LGRRobotoSlab-TLF.fd
LGRFiraMono-Sup.fd ./sourcesanspro/
LGRFiraMono-TLF.fd LGRSourceSansPro-Dnom.fd
LGRFiraMono-TOsF.fd LGRSourceSansPro-Inf.fd
LGRFiraSans-LF.fd LGRSourceSansPro-LF.fd
LGRFiraSans-OsF.fd LGRSourceSansPro-Numr.fd
LGRFiraSans-Sup.fd LGRSourceSansPro-OsF.fd
LGRFiraSans-TLF.fd LGRSourceSansPro-Sup.fd
LGRFiraSans-TOsF.fd LGRSourceSansPro-TLF.fd
./garamond-libre/ LGRSourceSansPro-TOsF.fd
LGRGaramondLibre-Inf.fd ./step/
LGRGaramondLibre-LF.fd LGRSTEP-Inf.fd
LGRGaramondLibre-OsF.fd LGRSTEP-Sup.fd
LGRGaramondLibre-Sup.fd LGRSTEP-TLF.fd
./gofonts/ LGRSTEP-TOsF.fd
LGRGo-TLF.fd ./stepgreek/
LGRGoMono-TLF.fd LGRSTEPGreekTest-Sup.fd
./lato/ LGRSTEPGreekTest-TLF.fd
LGRlato-LF.fd LGRSTEPGreekTest-TOsF.fd
LGRlato-OsF.fd ./theanodidot/
LGRlato-TLF.fd LGRTheanoDidot-TLF.fd
LGRlato-TOsF.fd LGRTheanoDidot-TOsF.fd
./libertinegc/ ./theanomodern/
LGRLinuxLibertineT-LF.fd LGRTheanoModern-TLF.fd
LGRLinuxLibertineT-OsF.fd LGRTheanoModern-TOsF.fd
LGRLinuxLibertineT-TLF.fd ./theanooldstyle/
LGRLinuxLibertineT-TOsF.fd LGRTheanoOldStyle-TLF.fd
./libertinus-type1/ LGRTheanoOldStyle-TOsF.fd
LGRLibertinusSans-LF.fd LGRLibertinusSerif-TLF.fd
LGRLibertinusSans-OsF.fd LGRLibertinusSerif-TOsF.fd
LGRLibertinusSans-Sup.fd LGRLibertinusSerifDisplay-LF.fd
LGRLibertinusSans-TLF.fd LGRLibertinusSerifDisplay-OsF.fd
LGRLibertinusSans-TOsF.fd LGRLibertinusSerifDisplay-Sup.fd
LGRLibertinusSerif-LF.fd LGRLibertinusSerifDisplay-TLF.fd
LGRLibertinusSerif-OsF.fd LGRLibertinusSerifDisplay-TOsF.fd
LGRLibertinusSerif-Sup.fd LGRLibertinusSerifInitials-TLF.fd
And now for more, with lowercase `lgr' filenames: find . -name 'lgr*fd'
./txfontsb/lgrtxr.fd ./cm-lgc/lgrfcm.fd
./txfontsb/lgrtxrc.fd ./cm-lgc/lgrfct.fd
./txfontsb/lgrtxry.fd ./cm-lgc/lgrfcs.fd
./txfontsb/lgrtxryc.fd ./epigrafica/lgrepigrafica.fd
./gfsbodoni/lgrbodoni.fd ./gfssolomos/lgrsolomos.fd
./lxfonts/lgrllcmtt.fd ./tempora/lgrtempora-tlf.fd
./lxfonts/lgrllcmss.fd ./tempora/lgrtempora-tosf.fd
./kerkis/lgrkfn.fd ./gfscomplutum/lgrcomplutum.fd
./kerkis/lgrmaksf.fd ./gfsartemisia/lgrartemisiaeuler.fd
./kerkis/lgrmak.fd ./gfsartemisia/lgrartemisia.fd
./cbfonts-fd/lgrcmro.fd ./gentium-tug/lgrgentiumbook.fd
./cbfonts-fd/lgrcmss.fd ./gentium-tug/lgrgentium.fd
./cbfonts-fd/lgrlmr.fd ./gfsbaskerville/lgrgfsbaskerville.fd
./cbfonts-fd/lgrlcmtt.fd ./miama/lgrfmm.fd
./cbfonts-fd/lgrlmtt.fd ./gfsneohellenic/lgrneohellenic.fd
./cbfonts-fd/lgrlmss.fd ./gfsdidot/lgrudidot.fd
./cbfonts-fd/lgrlmro.fd ./gfsporson/lgrporson.fd
./cbfonts-fd/lgrlcmss.fd
./cbfonts-fd/lgrcmtt.fd
./cbfonts-fd/lgrcmr.fd
\end{verbatim}
\end{snugshade}
\item[upshape=\meta{shape}] Declares the shape to be used by the \cs{...up}
Greek letters and the \cs{lgrmathup} math alphabet. Defaults to `|n|'
(without the quotes).
\item[itshape=\meta{shape}] Declares the shape to be used by the \cs{...it}
Greek letters and the \cs{lgrmathit} math alphabet. Defaults to `|it|'.
\DeleteShortVerb{\|}
\item[style=\meta{\upshape\ttfamily ISO|UP|TeX}] specifies the shape style
of the Greek letters. \MakeShortVerb{\|}
|ISO| means `italic' for lowercase
and uppercase, |UP| means `upright' for lowercase and uppercase, |TeX|
means `italic' for lowercase and `upright' for uppercase. The lowercase
forms |iso|, |up| and |tex| are also accepted (or any mixed case).
One can also use |French| or |french| as an alias to |UP| or |up|.
This option will
override any |greek| or |Greek| option. The package defaults to |style=TeX|.
What `upright' and `italic' mean is configured by the |upshape| and
|itshape| respective settings.\DeleteShortVerb\|
\item[greek=\meta{\ttfamily\upshape up|it|...}] Says\MakeShortVerb{\|} whether
Greek letters will be `upright' or `italic' i.e.\@ whether they obey the
|upshape| or |itshape| setting, i.e.\@ whether \cs{alpha} et al.\@ are
\cs{let} to \cs{alphaup} (et al.) or to \cs{alphait} (et
al.).\MakeShortVerb{\|}
So |greek=it| is like |style=ISO|, and |greek=up| is like |style=French|.
Other
shape values, such as `|n|' and `|sl|' or even `|sc|', are accepted. For
more details, see the explanations for |Greek|. For example |greek=n| is
like |style=UP|.
This option is ignored if |style| is used (order does not matter).
\DeleteShortVerb\|
\item[Greek=\meta{\ttfamily\upshape up|it|...}] Says\MakeShortVerb{\|}
whether uppercase Greek
letters (and only them) will be `upright' or `italic' i.e.\@ whether they
use |upshape| or |itshape|, i.e.\@ whether \cs{Alpha} et al.\@ are \cs{let}
to \cs{Alphaup} (et al.) or to \cs{Alphait} (et al.).\MakeShortVerb{\|}
So to obtain lowercase to be `upright' and uppercase to be `italic', use
|greek=up| and then |Greek=it| (|Greek| must appear after |greek| else it will be
shadowed by it).
This option, like the |greek| option, is ignored if the |style| option is used.
Other
shape values, such as `|n|' and `|sl|', are accepted. They will then
override the |upshape| setting for it to match it. For example |Greek=sc|
will force |upshape| to be |sc|, because the assumed style is the \TeX{} one
of italic lowercase and upright uppercase, so setting the shape of uppercase
must update the |upshape| value.
\item[series=\meta{series}] This tells which series to use. The default is the
value of \cs{seriesdefault} at the time of loading the package. There is no
interface to configure distinct series for the `upright' and `italic'
shapes.
\item[boldseries=\meta{series}] This tells which series to use in bold
math. Default is \cs{bfdefault} at the time of loading the package. There
is no interface to configure distinct series for the `upright' and `italic'
shapes.
\item[alphabets] Says whether to define \cs{lgrmathup} and \cs{lgrmathit}.
\end{description}
\section{Commands of the \lgrmath package}
Here are the commands defined by the package:
\begin{description}
\item[\cs{lgrmathsetup}\marg{key=value,...}] The only allowed keys are
|style|, |greek| and |Greek|. And for the latter two only the values |up|
or |it| should be used (or values matching the |upshape| or |itshape|
settings), as it is only possible after package loading time to toggle
between `upright' and `italic' depending on whether the letter is uppercase
or lowercase, but one can not switch to an altogether different shape as
this would require re-declaring the symbol fonts.
If the |style| key is used, then |greek/Greek| are ignored. However,
one can always naturally reuse later \cs{lgrmathsetup} using only the
|greek| and/or |Greek| keys.
\item[\cs{lgrmathup}] This is a math alphabet. It is defined only if the
package received the |alphabets| option.
\item[\cs{lgrmathit}] This is a math alphabet. It is defined only if the
package received the |alphabets| option.
\item[\cs{lgrmathgreektable}\marg{family}\marg{series}\marg{shape}] Produces a
tabular display of the Greek letters available with this font. Here is for
example using%
%
\centeredline{|\lgrmathgreektable{Alegreya-TLF}{regular}{n}|}
%
\centeredline{\lgrmathgreektable{Alegreya-TLF}{regular}{n}}
We used |regular|
for the \meta{series} mandatory argument after seeing Font Info messages in
the |.log| file about the |m| series not being available and being
substituted for by |regular|, so we used |regular| to avoid those messages.
\item[\cs{lgrmathgreektableextra}\marg{family}\marg{series}\marg{shape}]
Produces a tabular with eight additional glyphs. Here is an example, using
%
\centeredline{|\lgrmathgreektableextra{LibertinusSans-TLF}{m}{n}|}
%
\centeredline{\lgrmathgreektableextra{LibertinusSans-TLF}{m}{n}} Beware that if
we had forgotten the |-TLF| suffix, the font would have been substituted in
favour of fall-back |lmr| by \LaTeX. Always check log for font substitutions
messages...
And see also the last remark below.
\end{description}
Miscellaneous remarks:
\begin{enumerate}
\item Even if not receiving the option |alphabets|, the package will declare
all Greek letters to be of type \cs{mathalpha}.
\item The \lgrmath package ignores global class options. It handles only
options originating from the \cs{usepackage} preamble declaration (or some
options handed over via \cs{PassOptionsToPackage} or options passed to
\cs{lgrmathsetup} in the preamble or body).
\item The \ctanpkg{libgreek} package defines \cs{mathchar}'s mapping to
lowercase Greek letters with diacritics, but for time being it has been
decided that \lgrmath would restrict its definitions to the 24+24 base glyphs
and the 8 ``extra'' ones for which there are slots in the LGR encoding table.
\item These 8 ``extra glyphs'' will not always be available, depending on the
font. Here is for example with |Alegreya-TLF|:
\centeredline{\lgrmathgreektableextra{Alegreya-TLF}{regular}{n}} Adding
|\tracinglostchars=3| will cause \TeX\ to raise an error in case such missing
characters are encountered.
\end{enumerate}
This is the end of the user documentation. The next section is a code listing
with some comments for the advanced users.
\StopEventually{\end{document}\endinput}
\cleardoublepage
%\newgeometry{hmarginratio=3:2}
\small
\makeatletter
\section{Implementation of the \lgrmath package}
% https://github.com/latex3/latex2e/issues/563
\AddToHook{env/macrocode/after}{\@nobreakfalse}
\AddToHook{env/macrocode/begin}{\partopsep0pt\relax}
% The catcode hackery next is to avoid to have the guard be listed
% in the commented source code... (here <*legacy>)
% (c) 2012/11/19 Jean-François Burnol ;-)
\def\gardesactifs {\catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11 }
\def\gardesinactifs {\catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\/=12 }
\gardesactifs
\let</dtx>\relax
\let<*sty>\gardesinactifs
\MakePercentIgnore
%</dtx>
%<*sty>
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{lgrmath}
[2022/11/16 1.0 Greek in math mode via LGR font of one's choice (JFB)]
% \end{macrocode}
% We will use \ctanpkg{kvoptions} to handle options with |key=value| syntax.
% \begin{macrocode}
\RequirePackage{kvoptions}
% \end{macrocode}
% To minimize the author's task, we keep close to |libgreek.sty| code with minimal
% adaptations. In particular I decided to keep the fact that |style| option
% makes the |Greek| and |greek| options ignored. But there are some
% complications originating in the addition of the \cs{lgrmathsetup}, which
% requires to keep a trace of various things, for example if |style| option is
% used at package level and then later on using \cs{lgrmathsetup} the user
% employs the |Greek/greek| options.
%
% This package assigns two symbol fonts, one for upright, the other one for
% italic-like.
%
% The |upshape| and |itshape| keys allow to configure what the \cs{...up}
% and \cs{...it} macros will actually use as shapes.
% \begin{macrocode}
\def\lgrmath@fontfamily{lmr}
\def\lgrmath@scale{1}
\def\lgrmath@upshape{n}
\def\lgrmath@itshape{it}
\newif\iflgrmath@upper@up\lgrmath@upper@uptrue
\newif\iflgrmath@lower@up
\edef\lgrmath@series{\seriesdefault}
\edef\lgrmath@boldseries{\bfdefault}
\def\lgrmath@upper@shape{\lgrmath@upshape}
\def\lgrmath@lower@shape{\lgrmath@itshape}
\def\lgrmath@style{TeX}
\newif\iflgrmath@sty
% \end{macrocode}
% We use the \ctanpkg{keyval} interface mostly to not have to rework
% everything, if at all possible, into the \ctanpkg{kvoptions} declarative
% interface. It is a very good thing that the latter package can be used
% without forcing on the user its own declarative interface...
% \begin{macrocode}
\define@key{lgrmath}{font}[lmr]{\def\lgrmath@fontfamily{#1}}
\define@key{lgrmath}{upshape}{\edef\lgrmath@upshape{#1}}
\define@key{lgrmath}{itshape}{\edef\lgrmath@itshape{#1}}
% \end{macrocode}
% Compared to |libgreek 1.1| I decide to use \cs{lowercase} and allow |UP| as
% alias of |French|.
% \begin{macrocode}
\define@key{lgrmath}{style}{%
\edef\lgrmath@style{#1}%
\lowercase\expandafter{\expandafter\def\expandafter\lgrmath@style
\expandafter{\lgrmath@style}}%
\lgrmath@stytrue
}
\define@key{lgrmath}{Greek}{\edef\lgrmath@upper@shape{#1}}
% \end{macrocode}
% Attention to not introduce a space token, as this may be used via
% \cs{lgrmathsetup} in document body.
% \begin{macrocode}
\define@key{lgrmath}{greek}{\edef\lgrmath@lower@shape{#1}%
\edef\lgrmath@upper@shape{#1}}
\define@key{lgrmath}{series}{\edef\lgrmath@series{#1}}
\define@key{lgrmath}{boldseries}{\edef\lgrmath@boldseries{#1}}
% \end{macrocode}
% The single Boolean option, a true one as it uses \ctanpkg{kvoptions} interface.
% \begin{macrocode}
\DeclareBoolOption[false]{alphabets}
% \end{macrocode}
% We need some auxiliaries to handle the |style| values. As mentioned
% already, some extra stuff is executed for reasons of various scenarii
% with \cs{lgrmathsetup}.
% \begin{macrocode}
\def\lgrmath@style@iso{%
\lgrmath@upper@upfalse
\lgrmath@lower@upfalse
\let\lgrmath@upper@shape\lgrmath@itshape
\let\lgrmath@lower@shape\lgrmath@itshape
}
\def\lgrmath@style@french{%
\lgrmath@upper@uptrue
\lgrmath@lower@uptrue
\let\lgrmath@upper@shape\lgrmath@upshape
\let\lgrmath@lower@shape\lgrmath@upshape
}
\let\lgrmath@style@up\lgrmath@style@french
\def\lgrmathk@style@tex{%
\lgrmath@upper@uptrue
\lgrmath@lower@upfalse
\let\lgrmath@upper@shape\lgrmath@upshape
\let\lgrmath@lower@shape\lgrmath@itshape
}
% \end{macrocode}
% This always resets the \cs{iflgrmath@sty} to false for \cs{lgrmathsetup}
% being usable with |greek| and |Greek| keys.
% \begin{macrocode}
\def\lgrmath@process@style{%
\lgrmath@styfalse
\ifcsname lgrmath@style@\lgrmath@style\endcsname
\csname lgrmath@style@\lgrmath@style\endcsname
\else
\PackageWarning{lgrmath}{Unknown (here, lowercased) style `\lgrmath@style'}%
\fi
}
% \end{macrocode}
% This stuff is a bit involved.
% \begin{macrocode}
\def\lgrmath@process@shapes{%
\edef\lgrmath@upper@shape{\lgrmath@upper@shape}%
\edef\lgrmath@lower@shape{\lgrmath@lower@shape}%
\ifx\lgrmath@upper@shape\lgrmath@upshape
\lgrmath@upper@uptrue
\else
\ifx\lgrmath@upper@shape\lgrmath@itshape
\lgrmath@upper@upfalse
\else
\expandafter\in@\expandafter{\expandafter.\lgrmath@upper@shape,}{.up,}%
\ifin@\lgrmath@upper@uptrue
\else
\expandafter\in@\expandafter{\expandafter.\lgrmath@upper@shape,}{.it,}%
\ifin@\lgrmath@upper@upfalse
\else
\lgrmath@process@upper@lastresort
\fi\fi\fi\fi
\ifx\lgrmath@lower@shape\lgrmath@itshape
\lgrmath@lower@upfalse
\else
\ifx\lgrmath@lower@shape\lgrmath@upshape
\lgrmath@lower@uptrue
\else
\expandafter\in@\expandafter{\expandafter.\lgrmath@lower@shape,}{.it,}%
\ifin@\lgrmath@lower@upfalse
\else
\expandafter\in@\expandafter{\expandafter.\lgrmath@lower@shape,}{.up,}%
\ifin@\lgrmath@lower@uptrue
\else
\lgrmath@process@lower@lastresort
\fi\fi\fi\fi
}%
\def\lgrmath@process@upper@lastresort{%
\lgrmath@upper@uptrue
\let\lgrmath@upshape\lgrmath@upper@shape
}
\def\lgrmath@process@lower@lastresort{%
\lgrmath@lower@upfalse
\let\lgrmath@itshape\lgrmath@lower@shape
}
% \end{macrocode}
% The fact that packages may be handed global options is rather dangerous.
% Fortunately \ctanpkg{kvoptions} has an interface to handle only local options.
% \begin{macrocode}
\ProcessLocalKeyvalOptions*
% \end{macrocode}
% We now do the post-processing regarding the shape configuration after
% option parsing. Once this is done we will reconfigure slightly
% \cs{lgrmath@process@shapes} for usability in the document preamble or body,
% after the symbol fonts have been declared. As is well-known the \LaTeX{}
% interface to math fonts is full of ``only-preamble'' restrictions.
% \begin{macrocode}
\iflgrmath@sty
\lgrmath@process@style
\else
\lgrmath@process@shapes
\fi
\def\lgrmath@process@upper@lastresort{%
\PackageWarning{lgrmath}{%
Too late for the shape `\lgrmath@upper@shape'\MessageBreak
originating in Greek or greek option. Ignored.\MessageBreak
Use `up' or `it'}%
}
\def\lgrmath@process@lower@lastresort{%
\PackageWarning{lgrmath}{%
Too late for the shape `\lgrmath@lower@shape'\MessageBreak
originating in greek option. Ignored.\MessageBreak
Use `up' or `it'}%
}
\def\lgrmathsetup#1{%
\setkeys{lgrmath}{#1}%
\iflgrmath@sty\lgrmath@process@style\else\lgrmath@process@shapes\fi
\lgrmath@setgreekcs
}
% \end{macrocode}
% Almost all options must be restricted to the package loading time only.
% \begin{macrocode}
\DisableKeyvalOption{lgrmath}{font}
\DisableKeyvalOption{lgrmath}{upshape}
\DisableKeyvalOption{lgrmath}{itshape}
\DisableKeyvalOption{lgrmath}{series}
\DisableKeyvalOption{lgrmath}{boldseries}
\DisableKeyvalOption{lgrmath}{alphabets}
% \end{macrocode}
% Declarations of the two symbol fonts, one for `upright' (or whatever is
% configured by the |upshape| key), one for `italic' (or whatever is configured
% by the |itshape| key). One can not specify distinct series, both
% `upright' and `italic' use the same font series. This could be added but I
% doubt anyone will use the package to start with...
%
% The \ctanpkg{libgreek} of |2022/11/11| extracted the |-TLF| postfix from the
% font family name, to reinsert it here explicitly, the options |serif/sans|
% deciding whether to use |LibertinusSerif-TLF| or |LibertinusSans-TLF| for
% reasons now escaping me. I vaguely remember it was useful at some point
% during development. Ah yes, now I remember this separation was for the
% handling of the |scale| option. And we haven't one here.
% \begin{macrocode}
\DeclareFontEncoding{LGR}{}{}
\DeclareSymbolFont{lgrmathup}{LGR}{\lgrmath@fontfamily}
{\lgrmath@series}
{\lgrmath@upshape}
\SetSymbolFont{lgrmathup}{bold}{LGR}{\lgrmath@fontfamily}
{\lgrmath@boldseries}
{\lgrmath@upshape}
\DeclareSymbolFont{lgrmathit}{LGR}{\lgrmath@fontfamily}
{\lgrmath@series}
{\lgrmath@itshape}
\SetSymbolFont{lgrmathit}{bold}{LGR}{\lgrmath@fontfamily}
{\lgrmath@boldseries}
{\lgrmath@itshape}
% \end{macrocode}
% As all Greek letters are already available in \cs{...up} and \cs{...it}
% variants, it is indeed not immediately pressing to have math alphabets, so
% let's not do it by default.
% \begin{macrocode}
\iflgrmath@alphabets
\DeclareSymbolFontAlphabet{\lgrmathup}{lgrmathup}
\DeclareSymbolFontAlphabet{\lgrmathit}{lgrmathit}
\fi
% \end{macrocode}
% Definition of the `|up|' \cs{mathchar}'s. There are 48 `standard'
% ones plus 8 extras.^^A and 11 with diacritics for a total of 67 ones.
%
% Hesitation whether I should declare with \cs{mathalpha} \emph{only} if
% |alphabets| is passed to the package.
% \begin{macrocode}
\DeclareMathSymbol{\Alphaup}{\mathalpha}{lgrmathup}{65}
\DeclareMathSymbol{\Betaup}{\mathalpha}{lgrmathup}{66}
\DeclareMathSymbol{\Gammaup}{\mathalpha}{lgrmathup}{71}
\DeclareMathSymbol{\Deltaup}{\mathalpha}{lgrmathup}{68}
\DeclareMathSymbol{\Epsilonup}{\mathalpha}{lgrmathup}{69}
\DeclareMathSymbol{\Zetaup}{\mathalpha}{lgrmathup}{90}
\DeclareMathSymbol{\Etaup}{\mathalpha}{lgrmathup}{72}
\DeclareMathSymbol{\Thetaup}{\mathalpha}{lgrmathup}{74}
\DeclareMathSymbol{\Iotaup}{\mathalpha}{lgrmathup}{73}
\DeclareMathSymbol{\Kappaup}{\mathalpha}{lgrmathup}{75}
\DeclareMathSymbol{\Lambdaup}{\mathalpha}{lgrmathup}{76}
\DeclareMathSymbol{\Muup}{\mathalpha}{lgrmathup}{77}
\DeclareMathSymbol{\Nuup}{\mathalpha}{lgrmathup}{78}
\DeclareMathSymbol{\Xiup}{\mathalpha}{lgrmathup}{88}
\DeclareMathSymbol{\Omicronup}{\mathalpha}{lgrmathup}{79}
\DeclareMathSymbol{\Piup}{\mathalpha}{lgrmathup}{80}
\DeclareMathSymbol{\Rhoup}{\mathalpha}{lgrmathup}{82}
\DeclareMathSymbol{\Sigmaup}{\mathalpha}{lgrmathup}{83}
\DeclareMathSymbol{\Tauup}{\mathalpha}{lgrmathup}{84}
\DeclareMathSymbol{\Upsilonup}{\mathalpha}{lgrmathup}{85}
\DeclareMathSymbol{\Phiup}{\mathalpha}{lgrmathup}{70}
\DeclareMathSymbol{\Chiup}{\mathalpha}{lgrmathup}{81}
\DeclareMathSymbol{\Psiup}{\mathalpha}{lgrmathup}{89}
\DeclareMathSymbol{\Omegaup}{\mathalpha}{lgrmathup}{87}
\DeclareMathSymbol{\alphaup}{\mathalpha}{lgrmathup}{97}
\DeclareMathSymbol{\betaup}{\mathalpha}{lgrmathup}{98}
\DeclareMathSymbol{\gammaup}{\mathalpha}{lgrmathup}{103}
\DeclareMathSymbol{\deltaup}{\mathalpha}{lgrmathup}{100}
\DeclareMathSymbol{\epsilonup}{\mathalpha}{lgrmathup}{101}
\DeclareMathSymbol{\zetaup}{\mathalpha}{lgrmathup}{122}
\DeclareMathSymbol{\etaup}{\mathalpha}{lgrmathup}{104}
\DeclareMathSymbol{\thetaup}{\mathalpha}{lgrmathup}{106}
\DeclareMathSymbol{\iotaup}{\mathalpha}{lgrmathup}{105}
\DeclareMathSymbol{\kappaup}{\mathalpha}{lgrmathup}{107}
\DeclareMathSymbol{\lambdaup}{\mathalpha}{lgrmathup}{108}
\DeclareMathSymbol{\muup}{\mathalpha}{lgrmathup}{109}
\DeclareMathSymbol{\nuup}{\mathalpha}{lgrmathup}{110}
\DeclareMathSymbol{\xiup}{\mathalpha}{lgrmathup}{120}
\DeclareMathSymbol{\omicronup}{\mathalpha}{lgrmathup}{111}
\DeclareMathSymbol{\piup}{\mathalpha}{lgrmathup}{112}
\DeclareMathSymbol{\rhoup}{\mathalpha}{lgrmathup}{114}
\DeclareMathSymbol{\sigmaup}{\mathalpha}{lgrmathup}{115}
\DeclareMathSymbol{\tauup}{\mathalpha}{lgrmathup}{116}
\DeclareMathSymbol{\upsilonup}{\mathalpha}{lgrmathup}{117}
\DeclareMathSymbol{\phiup}{\mathalpha}{lgrmathup}{102}
\DeclareMathSymbol{\chiup}{\mathalpha}{lgrmathup}{113}
\DeclareMathSymbol{\psiup}{\mathalpha}{lgrmathup}{121}
\DeclareMathSymbol{\omegaup}{\mathalpha}{lgrmathup}{119}
% \end{macrocode}
% Defintion of the `|it|' \cs{mathchar}'s.
% \begin{macrocode}
\DeclareMathSymbol{\Alphait}{\mathalpha}{lgrmathit}{65}
\DeclareMathSymbol{\Betait}{\mathalpha}{lgrmathit}{66}
\DeclareMathSymbol{\Gammait}{\mathalpha}{lgrmathit}{71}
\DeclareMathSymbol{\Deltait}{\mathalpha}{lgrmathit}{68}
\DeclareMathSymbol{\Epsilonit}{\mathalpha}{lgrmathit}{69}
\DeclareMathSymbol{\Zetait}{\mathalpha}{lgrmathit}{90}
\DeclareMathSymbol{\Etait}{\mathalpha}{lgrmathit}{72}
\DeclareMathSymbol{\Thetait}{\mathalpha}{lgrmathit}{74}
\DeclareMathSymbol{\Iotait}{\mathalpha}{lgrmathit}{73}
\DeclareMathSymbol{\Kappait}{\mathalpha}{lgrmathit}{75}
\DeclareMathSymbol{\Lambdait}{\mathalpha}{lgrmathit}{76}
\DeclareMathSymbol{\Muit}{\mathalpha}{lgrmathit}{77}
\DeclareMathSymbol{\Nuit}{\mathalpha}{lgrmathit}{78}
\DeclareMathSymbol{\Xiit}{\mathalpha}{lgrmathit}{88}
\DeclareMathSymbol{\Omicronit}{\mathalpha}{lgrmathit}{79}
\DeclareMathSymbol{\Piit}{\mathalpha}{lgrmathit}{80}
\DeclareMathSymbol{\Rhoit}{\mathalpha}{lgrmathit}{82}
\DeclareMathSymbol{\Sigmait}{\mathalpha}{lgrmathit}{83}
\DeclareMathSymbol{\Tauit}{\mathalpha}{lgrmathit}{84}
\DeclareMathSymbol{\Upsilonit}{\mathalpha}{lgrmathit}{85}
\DeclareMathSymbol{\Phiit}{\mathalpha}{lgrmathit}{70}
\DeclareMathSymbol{\Chiit}{\mathalpha}{lgrmathit}{81}
\DeclareMathSymbol{\Psiit}{\mathalpha}{lgrmathit}{89}
\DeclareMathSymbol{\Omegait}{\mathalpha}{lgrmathit}{87}
\DeclareMathSymbol{\alphait}{\mathalpha}{lgrmathit}{97}
\DeclareMathSymbol{\betait}{\mathalpha}{lgrmathit}{98}
\DeclareMathSymbol{\gammait}{\mathalpha}{lgrmathit}{103}
\DeclareMathSymbol{\deltait}{\mathalpha}{lgrmathit}{100}
\DeclareMathSymbol{\epsilonit}{\mathalpha}{lgrmathit}{101}
\DeclareMathSymbol{\zetait}{\mathalpha}{lgrmathit}{122}
\DeclareMathSymbol{\etait}{\mathalpha}{lgrmathit}{104}
\DeclareMathSymbol{\thetait}{\mathalpha}{lgrmathit}{106}
\DeclareMathSymbol{\iotait}{\mathalpha}{lgrmathit}{105}
\DeclareMathSymbol{\kappait}{\mathalpha}{lgrmathit}{107}
\DeclareMathSymbol{\lambdait}{\mathalpha}{lgrmathit}{108}
\DeclareMathSymbol{\muit}{\mathalpha}{lgrmathit}{109}
\DeclareMathSymbol{\nuit}{\mathalpha}{lgrmathit}{110}
\DeclareMathSymbol{\xiit}{\mathalpha}{lgrmathit}{120}
\DeclareMathSymbol{\omicronit}{\mathalpha}{lgrmathit}{111}
\DeclareMathSymbol{\piit}{\mathalpha}{lgrmathit}{112}
\DeclareMathSymbol{\rhoit}{\mathalpha}{lgrmathit}{114}
\DeclareMathSymbol{\sigmait}{\mathalpha}{lgrmathit}{115}
\DeclareMathSymbol{\tauit}{\mathalpha}{lgrmathit}{116}
\DeclareMathSymbol{\upsilonit}{\mathalpha}{lgrmathit}{117}
\DeclareMathSymbol{\phiit}{\mathalpha}{lgrmathit}{102}
\DeclareMathSymbol{\chiit}{\mathalpha}{lgrmathit}{113}
\DeclareMathSymbol{\psiit}{\mathalpha}{lgrmathit}{121}
\DeclareMathSymbol{\omegait}{\mathalpha}{lgrmathit}{119}
% \end{macrocode}
% Extras: alternate shapes and other glyphs, `upright'.
% \begin{macrocode}
\DeclareMathSymbol{\varsigmaup}{\mathalpha}{lgrmathup}{99}
\DeclareMathSymbol{\varvarsigmaup}{\mathalpha}{lgrmathup}{6}
\DeclareMathSymbol{\varSigmaup}{\mathalpha}{lgrmathup}{22}
\DeclareMathSymbol{\Sampiup}{\mathalpha}{lgrmathup}{23}
\DeclareMathSymbol{\sampiup}{\mathalpha}{lgrmathup}{27}
\DeclareMathSymbol{\digammaup}{\mathalpha}{lgrmathup}{147}
\DeclareMathSymbol{\Digammaup}{\mathalpha}{lgrmathup}{195}
\DeclareMathSymbol{\koppaup}{\mathalpha}{lgrmathup}{18}
% \end{macrocode}
% Extras: alternate shapes and other glyphs, `italic'.
% \begin{macrocode}
\DeclareMathSymbol{\varsigmait}{\mathalpha}{lgrmathit}{99}
\DeclareMathSymbol{\varvarsigmait}{\mathalpha}{lgrmathit}{6}
\DeclareMathSymbol{\varSigmait}{\mathalpha}{lgrmathit}{22}
\DeclareMathSymbol{\Sampiit}{\mathalpha}{lgrmathit}{23}
\DeclareMathSymbol{\sampiit}{\mathalpha}{lgrmathit}{27}
\DeclareMathSymbol{\digammait}{\mathalpha}{lgrmathit}{147}
\DeclareMathSymbol{\Digammait}{\mathalpha}{lgrmathit}{195}
\DeclareMathSymbol{\koppait}{\mathalpha}{lgrmathit}{18}
% \end{macrocode}
% Some glyphs with diacritics. I decided not to keep this
% in \lgrmath. Let's wait for extremely improbable feature request, as I won't
% do the feature request and will probably remain the sole user. Actually I
% don't think I will ever use this package as contexts where
% it could be useful are those where I would use \ctanpkg{mathastext} and its
% |LGRgreek| option and \cs{MTgreekfont} command...
% \makeatletter\codeline@indexfalse
% \begin{macrocode}
% \DeclareMathSymbol{\alphatonosup}{\mathalpha}{lgrmathup}{136}
% \DeclareMathSymbol{\epsilontonosup}{\mathalpha}{lgrmathup}{232}
% \DeclareMathSymbol{\etatonosup}{\mathalpha}{lgrmathup}{160}
% \DeclareMathSymbol{\iotatonosup}{\mathalpha}{lgrmathup}{208}
% \DeclareMathSymbol{\omicrontonosup}{\mathalpha}{lgrmathup}{236}
% \DeclareMathSymbol{\upsilontonosup}{\mathalpha}{lgrmathup}{212}
% \DeclareMathSymbol{\omegatonosup}{\mathalpha}{lgrmathup}{184}
% \DeclareMathSymbol{\upsilondieresistonosup}{\mathalpha}{lgrmathup}{246}
% \DeclareMathSymbol{\iotadieresisup}{\mathalpha}{lgrmathup}{240}
% \DeclareMathSymbol{\iotadieresistonosup}{\mathalpha}{lgrmathup}{242}
% \DeclareMathSymbol{\upsilondieresisup}{\mathalpha}{lgrmathup}{244}
% \DeclareMathSymbol{\alphatonosit}{\mathalpha}{lgrmathit}{136}
% \DeclareMathSymbol{\epsilontonosit}{\mathalpha}{lgrmathit}{232}
% \DeclareMathSymbol{\etatonosit}{\mathalpha}{lgrmathit}{160}
% \DeclareMathSymbol{\iotatonosit}{\mathalpha}{lgrmathit}{208}
% \DeclareMathSymbol{\omicrontonosit}{\mathalpha}{lgrmathit}{236}
% \DeclareMathSymbol{\upsilontonosit}{\mathalpha}{lgrmathit}{212}
% \DeclareMathSymbol{\omegatonosit}{\mathalpha}{lgrmathit}{184}
% \DeclareMathSymbol{\upsilondieresistonosit}{\mathalpha}{lgrmathit}{246}
% \DeclareMathSymbol{\iotadieresisit}{\mathalpha}{lgrmathit}{240}
% \DeclareMathSymbol{\iotadieresistonosit}{\mathalpha}{lgrmathit}{242}
% \DeclareMathSymbol{\upsilondieresisit}{\mathalpha}{lgrmathit}{244}
% \end{macrocode}
% \codeline@indextrue
% Definition of the \cs{mathchar}'s without `|up/it|' postfix. There are 27=24+3
% uppercase and 29=24+5 lowercase letters, for a total of 56=48+8 glyphs. Actually,
% I had done some work with LGR in September 2011. I kept
% the file around. But
% at no point did I go back to check if I had done exhaustive work in 2011 and
% whether some other glyphs could be accounted for by LGR (not using
% ligatures) (I did re-check an
% old file about the LGR encoding I had from that 2011 work, but did not try
% to check for updates). Anyway, it is very doubtful whether it made any
% sense for \lgrmath to define control sequences for Greek letters with
% diacritics...
% \begin{macrocode}
\def\lgrmath@setgreekcs{%
\iflgrmath@upper@up
\let\Alpha\Alphaup
\let\Beta\Betaup
\let\Gamma\Gammaup
\let\Delta\Deltaup
\let\Epsilon\Epsilonup
\let\Zeta\Zetaup
\let\Eta\Etaup
\let\Theta\Thetaup
\let\Iota\Iotaup
\let\Kappa\Kappaup
\let\Lambda\Lambdaup
\let\Mu\Muup
\let\Nu\Nuup
\let\Xi\Xiup
\let\Omicron\Omicronup
\let\Pi\Piup
\let\Rho\Rhoup
\let\Sigma\Sigmaup
\let\Tau\Tauup
\let\Upsilon\Upsilonup
\let\Phi\Phiup
\let\Chi\Chiup
\let\Psi\Psiup
\let\Omega\Omegaup
\let\Sampi\Sampiup
\let\Digamma\Digammaup
\let\varSigma\varSigmaup
\else
\let\Alpha\Alphait
\let\Beta\Betait
\let\Gamma\Gammait
\let\Delta\Deltait
\let\Epsilon\Epsilonit
\let\Zeta\Zetait
\let\Eta\Etait
\let\Theta\Thetait
\let\Iota\Iotait
\let\Kappa\Kappait
\let\Lambda\Lambdait
\let\Mu\Muit
\let\Nu\Nuit
\let\Xi\Xiit
\let\Omicron\Omicronit
\let\Pi\Piit
\let\Rho\Rhoit
\let\Sigma\Sigmait
\let\Tau\Tauit
\let\Upsilon\Upsilonit
\let\Phi\Phiit
\let\Chi\Chiit
\let\Psi\Psiit
\let\Omega\Omegait
\let\Sampi\Sampiit
\let\Digamma\Digammait
\let\varSigma\varSigmait
\fi
\iflgrmath@lower@up
\let\alpha\alphaup
\let\beta\betaup
\let\gamma\gammaup
\let\delta\deltaup
\let\epsilon\epsilonup
\let\zeta\zetaup
\let\eta\etaup
\let\theta\thetaup
\let\iota\iotaup
\let\kappa\kappaup
\let\lambda\lambdaup
\let\mu\muup
\let\nu\nuup
\let\xi\xiup
\let\omicron\omicronup
\let\pi\piup
\let\rho\rhoup
\let\sigma\sigmaup
\let\tau\tauup
\let\upsilon\upsilonup
\let\phi\phiup
\let\chi\chiup
\let\psi\psiup
\let\omega\omegaup
\let\varsigma\varsigmaup
\let\varvarsigma\varvarsigmaup
\let\sampi\sampiup
\let\digamma\digammaup
\let\koppa\koppaup
% \end{macrocode}
% The \ctanpkg{doc} |macrocode| makes no provision for being interrupted
% invisibly, it is very complicated (but possible) to do this (see
% \centeredline{\url{https://github.com/latex3/latex2e/issues/847}}
% ), but simplest is to babble something here like this paragraph.
% \codeline@indexfalse
% \begin{macrocode}
% \let\alphatonos\alphatonosup
% \let\epsilontonos\epsilontonosup
% \let\etatonos\etatonosup
% \let\iotatonos\iotatonosup
% \let\omicrontonos\omicrontonosup
% \let\upsilontonos\upsilontonosup
% \let\omegatonos\omegatonosup
% \let\upsilondieresistonos\upsilondieresistonosup
% \let\iotadieresis\iotadieresisup
% \let\iotadieresistonos\iotadieresistonosup
% \let\upsilondieresis\upsilondieresisup
% \end{macrocode}
% babble\codeline@indextrue
% \begin{macrocode}
\else
\let\alpha\alphait
\let\beta\betait
\let\gamma\gammait
\let\delta\deltait
\let\epsilon\epsilonit
\let\zeta\zetait
\let\eta\etait
\let\theta\thetait
\let\iota\iotait
\let\kappa\kappait
\let\lambda\lambdait
\let\mu\muit
\let\nu\nuit
\let\xi\xiit
\let\omicron\omicronit
\let\pi\piit
\let\rho\rhoit
\let\sigma\sigmait
\let\tau\tauit
\let\upsilon\upsilonit
\let\phi\phiit
\let\chi\chiit
\let\psi\psiit
\let\omega\omegait
\let\varsigma\varsigmait
\let\varvarsigma\varvarsigmait
\let\sampi\sampiit
\let\digamma\digammait
\let\koppa\koppait
% \end{macrocode}
% babble\codeline@indexfalse
% \begin{macrocode}
% \let\alphatonos\alphatonosit
% \let\epsilontonos\epsilontonosit
% \let\etatonos\etatonosit
% \let\iotatonos\iotatonosit
% \let\omicrontonos\omicrontonosit
% \let\upsilontonos\upsilontonosit
% \let\omegatonos\omegatonosit
% \let\upsilondieresistonos\upsilondieresistonosit
% \let\iotadieresis\iotadieresisit
% \let\iotadieresistonos\iotadieresistonosit
% \let\upsilondieresis\upsilondieresisit
% \end{macrocode}
% babble\codeline@indextrue
% \begin{macrocode}
\fi
}%
\lgrmath@setgreekcs
% \end{macrocode}
% Finally we define \cs{lgrmathgreektable} and \cs{lgrmathgreektableextra}.
% \begin{macrocode}
\def\lgrmathgreektable#1#2#3{%
\begingroup
\def\s##1{{\usefont{T1}{mlmtt}{m}{n}\string##1}}%
\usefont{LGR}{#1}{#2}{#3}%
\begin{tabular}{|lc|lc|lc|lc|}
\hline
\s\Alpha &A &\s\Nu &N &\s\alpha &a &\s\nu &n \\
\s\Beta &B &\s\Xi &X &\s\beta &b &\s\xi &x \\
\s\Gamma &G &\s\Omicron&O &\s\gamma &g &\s\omicron&o \\
\s\Delta &D &\s\Pi &P &\s\delta &d &\s\pi &p \\
\s\Epsilon&E &\s\Rho &R &\s\epsilon&e &\s\rho &r \\
\s\Zeta &Z &\s\Sigma &S &\s\zeta &z &\s\sigma &s \\
\s\Eta &H &\s\Tau &T &\s\eta &h &\s\tau &t \\
\s\Theta &J &\s\Upsilon&U &\s\theta &j &\s\upsilon&u \\
\s\Iota &I &\s\Phi &F &\s\iota &i &\s\phi &f \\
\s\Kappa &K &\s\Chi &Q &\s\kappa &k &\s\chi &q \\
\s\Lambda &L &\s\Psi &Y &\s\lambda &l &\s\psi &y \\
\s\Mu &M &\s\Omega &W &\s\mu &m &\s\omega &w \\
\hline
\end{tabular}
\endgroup
}%
\def\lgrmathgreektableextra#1#2#3{%
\begingroup
\def\s##1{{\usefont{T1}{mlmtt}{m}{n}\string##1}}%
\usefont{LGR}{#1}{#2}{#3}%
\begin{tabular}{lclclc}
\s\varsigma &\char99 &\s\digamma&\char147 &\s\varSigma&\char22 \\
\s\varvarsigma&\char6 &\s\koppa &\char18 &\s\Sampi &\char23 \\
\s\sampi &\char27 & & &\s\Digamma &\char195\relax
\end{tabular}
\endgroup
}%
% \end{macrocode}
% And we have now reached the end of the \lgrmath package code. The actual
% |.sty| file will contain an \cs{endinput} added by the DocStrip extraction.
%\MakePercentComment
%</sty>
%<*dtx>
\Finale
%%
%% End of file `lgrmath.dtx'.
|