summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/mismath/mismath.dtx
blob: b40e0d7211b4489bb8941bf5785ee31aaa194bc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
% \iffalse meta-comment
%
% Copyright (C) 2019-2024 by Antoine Missier <antoine.missier@ac-toulouse.fr>
%
% This file may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, either version 1.3 of this license
% or (at your option) any later version.  The latest version of this
% license is in:
%
%   http://www.latex-project.org/lppl.txt
%
% and version 1.3 or later is part of all distributions of LaTeX version
% 2005/12/01 or later.
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{mismath.dtx}
%</driver>
%<*package> 
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{mismath}   
    [2024/02/20 v2.10 .dtx Miscellaneous mathematical macros]
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[charter]{mathdesign} % in case of font change, modify 2.1 (3rd §)
\usepackage[ibrackets]{mismath}
%\usepackage{amssymb} incompatible with mathdesign
\usepackage{multicol}
\usepackage[Symbol]{upgreek}
\usepackage{sectsty}
\usepackage{xcolor}
\usepackage{spacingtricks}
\usepackage{array}
\usepackage{metalogo} % for logos of XeLaTeX et LuaLaTeX

\definecolor{darkbrown}{rgb}{0.5,0.1,0.1}
\allsectionsfont{\color{darkbrown}}
\MathUp{i} \pinumber[piup]
% I need italicized e in vectors section
% For using in this doc only:
\usepackage[LGR,T1]{fontenc}
\DeclareSymbolFont{UpGr}{LGR}{lmr}{m}{n}
\DeclareMathSymbol{\mypi}\mathalpha{UpGr}{"70}
% For showing original \i and \j in text mode:
\DeclareTextFontCommand{\extrafont}{\fontfamily{lmr}\selectfont}

\DisableCrossrefs         
%\CodelineIndex
%\RecordChanges
\usepackage{hyperref}
\hypersetup{%
    colorlinks, 
    linkcolor=blue,
    citecolor=red,   
    pdftitle={mismath}, 
    pdfsubject={LaTeX package}, 
    pdfauthor={Antoine Missier}
}
\begin{document}
  \DocInput{mismath.dtx}
  %\PrintChanges
  %\PrintIndex
\end{document}
%</driver>
% \fi
%
% \CheckSum{691}
%
% \CharacterTable
%  {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
%   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
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \changes{v0.1}{2011/12/27}{First personal version}
%
% \changes{v1.0}{2019/04/11}{
%    - Initial published version: creating dtx and ins files}
%
% \changes{v1.1}{2019/04/20}{
%    - Some forgotten french 'et' -> 'and', citecolor=blue,
%    - changing the default font for pinumber Euler -> Symbol}
%
% \changes{v1.2}{2019/04/26}{
%    - Works fine with beamer now, 
%    - AtBeginDocument for enumber, inumber, jnumber, 
%    - creating general mm@operator macro, 
%    - using mathup instead of mathrm}
% \changes{v1.2}{2019/04/27}{
%    - Added mathtools package, 
%    - font definition Roman -> up, 
%    - changes in documentation, 
%    - replacing the PEroman macro by PEupright}
%
% \changes{v1.3}{2019/05/05}{
%    - Using bslash in the internal mm@warning macro, 
%    - loading of mathfixs package}
% \changes{v1.3}{2019/05/08}{
%    - Many corrections in documentation}
%
% \changes{v1.4}{2019/05/22}{
%    - Changing font definition up -> UpSh, due to incompatibility with unicode-math}
%
% \changes{v1.5}{2019/05/30}{
%    - A solution for using mul with frac -> braces, 
%    - addition of paren macro}
% \changes{v1.5}{2019/06/22}{
%    - Small corrections in documentation}
%
% \changes{v1.6}{2019/09/06}{
%    - Removing mathfixs package, problems with fractions}
%
% \changes{v1.7}{2019/12/27}{
%    - Adding a table of contents to the documentation}
%
% \changes{v1.8}{2020/11/15}{
%    - Incompatibility mentioned when using `i' with accent in beamer titles -> use \^i, 
%    - small changes in documentation}
%
% \changes{v1.9}{2020/10/17}{
%    - UpSh replaced by "operators" font in math mode, 
%    - PackageWarning `command exist' replaced by PackageWarningNoLine,
%    - medspace replaced by thickspace in the lfrac command,
%    - changing font in documentation, lmodern -> Palatino (mathpazo)}
%
% \changes{v1.10}{2020/10/25}{\
%    - pinumber command code adapted to avoid incompatibility with the new frenchmath, 
%    - default option (in upgreek) changed from Symbol to Euler.}
%
% \changes{v2.0}{2022/11/11}{
%    - pinumber command has been improved to use other Greek letter packages,
%        (and LGR encoding pi by default), it is no longer compatible with the older, 
%    - paren command has been removed, 
%    - hvect and hlbar have been slighlty modified (phantom t instead of phantom h),
%    - several changes in documentation, 
%    - now using the Charter font (with the package mathdesign)}
%
% \changes{v2.1}{2022/12/26}{
%    - Improved management of square brackets with the ibrackets package,
%    - new macros codim, sinc, var, eqdef*, 
%    - removing the systematic warning for paren command,
%    - a small change in norm command -> bars in small size,
%    - several changes in documentation}
%
% \changes{v2.2}{2023/01/06}{
%    - Loading of ibrackets package is now optional, due to an error
%        when using DeclarePairedDelimiter with square brackets.}
%
% \changes{v2.3}{2023/02/06}{
%    - Introducing keyval options for enumber, inumber, jnumber, PEupright
%        (corresponding old commands are maintained for now),
%    - and also for ibrackets, boldvect and arrowvect}
% \changes{v2.3}{2023/02/09}{
%    - Documentation update}
%
% \changes{v2.4}{2023/02/18}{
%    - New powerful macros MathUp, MathIt and also MathNumbers, MathProba, MathNormal,
%    - keyval options are no longer useful and have been deleted,
%    - loading package ifthen has been forgotten in v2.3 (causing possible errors),
%    - no more incompatibility when using `i' with accent in beamer titles}
%
% \changes{v2.5}{2023/02/23}{
%    - Unification of the code of MathUp and MathIt,
%    - a powerful macro `apply' is used in MathNormal to act on a list,
%    - a new `tensor' command,
%    - small changes in the documentation}
%
% \changes{v2.6}{2023/03/01}{
%    - A bug correction in mm@macro
%    - incompatibility of \C macro solved, when using babel with russian
%        (thanks to Murray Eisenberg for this bug report on TeX StackExchange)
%    - mathrm added in macro eqdef* (useful if italicized Greek uppercase Delta)
%    - Tiny changes in the documentation}
%
% \changes{v2.7}{2023/03/05}{
%    - Macros for sets of numbers (\R, \C,...) now available only in math mode
%        (following remarks by David Carlisle and Enrico Gregorio)
%    - special (not generic) warning when loading babel with russian
%        (\C will not be defined in that case)}
%
% \changes{v2.8}{2023/07/26}{
%    - Some small changes in the documentation
%    - New macro `onlymathC' designed for using '\C' when Russian language is loaded}
%
% \changes{v2.9}{2023/12/19}{
%    - New option decimalcomma
%    - Some small changes in the documentation}
%
% \changes{v2.10}{2024/02/19}{
%    - Better compatibility with unicode-math: 
%        for the options ibrackets, decimalcomma and the commands MathUp, MathIt
%    - Explicit error message when using mathcols without loading the multicol package} 
%
% \GetFileInfo{mismath.sty}
%
% \title{\textsf{mismath}\\ Miscellaneous mathematical macros\thanks{This document
% corresponds to \textsf{mismath}~\fileversion, dated \filedate. 
% Thanks to François Bastouil for initial help in English translation.}}
% \author{Antoine Missier \\ \texttt{antoine.missier@ac-toulouse.fr}}
% \date{February 20, 2024}
%
% \maketitle
% \tableofcontents
%
% \section{Introduction}
%
% According to the International Standards ISO~31-0:1992 to ISO~31-13:1992, 
% superseded by ISO~80000-2:2009, mathematical constants $\e$, $\i$, $\pi$ 
% should be typeset in roman (upright shape) and not in italic (sloping shape) like
% variables (see~\cite{TYPMA}~\cite{NIST}~\cite{SI}~\cite{ICTNS}).
% This package provides some tools to achieve this automatically.
%
% \medskip
% Even though it is recommended to typeset vectors names 
% in bold italic style~\cite{NIST}~\cite{ICTNS}, 
% they are often represented with arrows 
% (especially in school documents or in physics). 
% To draw visually appealing arrows above vectors, we use the \textsf{esvect} package 
% by Eddie Saudrais~\cite{VECT}.
% Additionally we provide a few more macros related to vectors with arrows, 
% particularly to enhance the typesetting of the norm: $\norm{\vect{AB}}$ 
% instead of \LaTeX\ version $\lVert\vect{AB}\rVert$ which is not vertically adjusted,
% or worse $\left\Vert \vect{AB} \right\Vert$.
% 
% \smallskip
% The package also offers other macros for:
% \begin{itemize}
% \item tensors,
% \item some common operator names,
% \item a few useful aliases,
% \item enhancing spacing in mathematical formulas,
% \item systems of equations and small matrices,
% \item displaymath in double columns for lengthy calculations.
% \end{itemize}
%
% To avoid compatibility issues,
% most of our macros will only be defined 
% if there isn't already a command with the same name in the packages loaded 
% before \textsf{mismath}. If a macro is already defined,
% a warning message will be displayed and the \textsf{mismath} definition 
% will be ignored. If you wish to keep the \textsf{mismath} or the existing command,
% you can use |\let\|\meta{command}|\relax|, before loading \textsf{mismath}, or after.
%
% \medskip
% \DescribeEnv{\oarg{options}}
% The \textsf{mismath} package loads the \textsf{amsmath} package~\cite{AMS}
% without any options.
% If you want to use \textsf{amsmath} with specific options (refer to its documentation),
% you can include these options when calling \textsf{mismath}, or 
% you can load \textsf{amsmath} 
% with the desired options before loading \textsf{mismath}.
% \emph{When using the package \textsf{unicode-math}~\cite{UNIC}, \textsf{mismath} 
% must be loaded before \textsf{unicode-math}}, just like \textsf{amsmath}.
%
% \medskip
% In addition \textsf{mismath} loads the \textsf{mathtools} package 
% by Morten Høgholm and Lars Madsen~\cite{TOOL}. 
% This package offers numerous helpful macros and improvements of the \textsf{amsmath} package.
%
% \medskip
% A recommendation, although rarely followed, is to typeset uppercase 
% Greek letters in italic shape,
% similar to other variables~\cite{ICTNS}. This can be automatically achieved,
% for some particular fonts, with packages 
% such as \textsf{fixmath} by Walter Schmidt~\cite{FIXM},
% \mbox{\textsf{isomath}} by Günter Milde~\cite{ISOM} 
% or \textsf{pm-isomath} by Claudio Beccari~\cite{PMISO} and optionally with many others
% (such as \textsf{mathpazo} or \textsf{mathptmx} with the option \texttt{slantedGreek}).
% However this feature is not implemented here due to a conflicting rule in France,
% where all capital letters in mathematics
% are required to be typeset in upright shape
% \footnote{The \textsf{frenchmath} package~\cite{FR}
% ensures to follow the recommended French rules.}.
% ^^A The decision to load any of these packages is left to the user's discretion.
%
% \section{Usage}
%
% \subsection{Mathematical constants} 
%
% \DescribeMacro{\mathup} 
% As for classic functions identifiers, \emph{predefined} mathematical constants
% should be typeset in upright shape (typically in roman family), 
% even though this practice is not very common and can be tedious
% to adhere to. A first solution is to use the |\mathup| macro, 
% which is superior to |\mathrm|
% \footnote{The \texttt{\string \mathup} macro is based on \texttt{\string \operatorfont}, 
% which comes from the
% \textsf{amsopn} package, automatically loaded by \textsf{amsmath}. 
% In \textsf{beamer}, the default math font is sans serif, 
% but \texttt{\string \mathrm} produces a font with serifs, which might not match the 
% overall style of the presentation. Hence, using \texttt{\string \mathup} is indeed 
% a better choice in \textsf{beamer} presentations to ensure that mathematical 
% constants are typeset in upright shape and consistent 
% with the default sans serif math font.},
% for setting any math text in upright shape. For example you can use
% |\mathup{e}| to get the Euler's number.
%
% \medskip
% \DescribeMacro{\e} \DescribeMacro{\i}  \DescribeMacro{\j} 
% To avoid cluttering a document that contains many occurrences of Euler's number (e) 
% or imaginary numbers (i) with |\mathup{e}| or |\mathup{i}|, 
% the package provides the |\e| command for Euler’s number 
% and |\i| or |\j| for imaginary numbers.
% Let us notice that |\i| and |\j| already exist in LaTeX. In LR (left-to-right) mode, 
% they produce `\extrafont{\i,\ \j}' without the dot, allowing you to place accents on them. 
% However, in mathematical mode, they produce the warning 
% ``\texttt{LaTeX Warning: Command \string \i\space invalid in math mode on input line}
% \meta{line}''. 
% With the new definition provided by the package, |\i| and |\j| will be redefined 
% specifically for mathematical mode.
%
% \medskip
% \DescribeMacro{\MathUp} 
% Indeed, typing a lot of backslashes for constants like $\e$, $\i$, or $\j$
% in a document with numerous formulas can become tiresome. 
% To alleviate this, the package proposes a powerful solution with the macro |\MathUp|\marg{char}.
% For example, when |\MathUp{e}| is called, any subsequent occurrence of $\e$
% will automatically be set in roman (upright shape), 
% without the need to type |\e| explicitly. The effect of this macro 
% can be either global or local, depending on whether it is used outside or inside an
% environment or braces.
% Furthermore, you can call this macro in the preamble to apply the change 
% from the beginning of the document. This powerful feature allows you 
% to bring a document up to the standards effortlessly. 
% In fact, |\MathUp| can be applied to any valid single character, 
% offering flexibility for various use cases (another use of it with probability 
% will be presented in section \ref{operators}).
%
% \medskip
% \DescribeMacro{\MathIt}
% When there are other occurrences of $\mathit{e}$, $\mathit{i}$ or $j$ as variables, 
% you can still obtain italicized $\mathit{e}$, $\mathit{i}$ or $\mathit{j}$ using \LaTeX\
% commands |\mathit| or |\mathnormal|, which are useful for a single use. 
% However, you also have the option to use the inverse switch |\MathIt|\marg{char},
% which has a global effect when used outside environments or braces, 
% or a local effect when used inside them. 
% Similar to |\MathUp|, |\MathIt| can be applied to any single character.
%
% \medskip
% \DescribeMacro{\MathNumbers} \DescribeMacro{\MathNormal}
% These macros enable you to set upright or normal (italic) typesetting 
% for multiple letters in a single command. 
% For instance, |\MathNumbers{e,i}| is equivalent to |\MathUp{e}\MathUp{i}|.
% In |\MathNumbers|, the comma separator between letters can be modified 
% or removed as needed. In fact, this macro only affects the letters e, i, or j; 
% it has no effect on other characters.
% On the other hand, |\MathNormal| can be utilized for probability as well 
% (refer to section \ref{operators}), and it accepts any comma-separated list of arguments.
% This means you can apply the normal italic math mode typesetting to various letters 
% at once using |\MathNormal|.
% 
% \medskip
% \DescribeMacro{\pinumber[\meta{command}]}
% The mathematical constant $\pi$  should also be typeset in upright shape 
% (see~\cite{TYPMA}, \cite{NIST}, \cite{ICTNS}), which is different from italicized $\itpi$. 
% However, this recommendation is even less commonly followed compared to the one 
% concerning  $\e$ and $\i$~\cite{TYPMA}.
% Several packages enable the typesetting of mathematical Greek letters in upright shape. 
% Notably, let us mention \textsf{upgreek}~\cite{GREEK}, \textsf{mathdesign}~\cite{DESIGN} 
% (used in the present document), \mbox{\textsf{kpfonts}}~\cite{KPF}, 
% \textsf{fourier}~\cite{FOUR},
% \textsf{libertinust1math},
% \textsf{pxgreeks}, \textsf{txgreeks}
% \footnote{When using \textsf{pxgreeks} or \textsf{txgreeks},
% they should be loaded \emph{after} \textsf{mismath} to avoid an error
% due to conflict with the existing macros \texttt{\string\iint}, \texttt{\string\iiint},
% \texttt{\string\iiiint}, \texttt{\string\idotsint} in \textsf{amsmath}.}, 
% \textsf{libgreek}, etc.
% A special mention goes to \textsf{lgrmath} of Jean-François Burnol~\cite{LGR}
% which allows the use of any Greek LGR-encoded font in math mode. 
% These packages provide commands like |\uppi| (\textsf{upgreek}), 
% |\piup| (\textsf{mathdesign}, \textsf{kpfonts}, \textsf{lgrmath}), 
% |\otherpi| (\textsf{fourier}), etc.
% \footnote{They also have options to typeset all the Greek lowercase 
% letters in upright shape by default, but this in not our goal here.}
% To preserve default italic style for lowercase Greek letters,
% with the exception of pi, and to
% avoid the need to type a lot of |\uppi| or |\piup|, we offer the 
% macro |\pinumber|[\meta{command}].
% This macro redefines |\pi| to match
% the optional command  name provided (without a backslash), such as |piup|, 
% assuming that the appropriate package has been loaded beforehand
% \footnote{The macro \texttt{\string \pinumber} doesn't work with   
% \textsf{unicode-math}, but, with this package, you can use \texttt{\string \uppi} instead
% (or set all greek lowercase letters in upright shape with the option 
% \texttt{math-style=french}).}.
%
% By using the preliminary code |\MathNumbers{ei}\pinumber[piup]| 
% (assuming the \textsf{mathdesign} package is loaded)
% you can achieve the following result:
% \begin{center}
% |$e^{i\pi} = -1$| \quad which yields \quad   $\e^{i\pi}=-1$.
% \end{center}
%
% When you call |\pinumber| without any argument,
% it defines |\pi| using the default LGR font encoding for Greek letters,
% resulting in the character $\mypi$. In this case the appropriate option \texttt{LGR}
% for the \textsf{fontenc} package will be automatically loaded
% if the |\pinumber| command is called in the preamble (at least the first time it is used). 
% The pi character obtained with this setting will look the same as the one provided by
% Günter Milde's \textsf{textalpha} package~\cite{ALPHA}.
% This $\mypi$ character is particularly well-suited
% for use with the default Computer Modern or Latin Modern font family
% \footnote{This default $\mypi$ character may not always fit well with various text fonts, 
% especially those that are bolder or different from the default Computer Modern font.
% The \textsf{upgreek} package~\cite{GREEK} provides a better $\uppi$ character 
% with the Symbol option, utilizing the Adobe Symbol font. This $\uppi$ character 
% matches well with several text fonts, such as Times.}.
%
% \medskip
% \DescribeMacro{\itpi}
% When you activate |\pinumber|, the original italic $\itpi$ 
% is still accessible using |\itpi|.
%
% \DescribeMacro{\pinormal}
% In fact |\pinumber| acts as a switch, enabling the upright $\pi$.
% Additionally, there is an inverse switch, 
% |\pinormal|, which you can call anywhere to revert to the original behavior
% of the |\pi| command (italic $\itpi$).
%
% \subsection{Vectors (and tensors)}
%
% \DescribeMacro{\vect}
% By default, the |\vect| command
% \footnote{The definition of most macros in this package, 
% will only take effect if the macro has not been previously
% defined by another package. This ensures compatibility and avoids conflicts 
% when using the \textsf{mismath} package with other \LaTeX\ packages.},
% produces vectors with arrows
% (thanks to the \textsf{esvect} package by Eddie Saudrais
% \footnote{\textsf{esvect} provides the \texttt{\string \vv} macro 
% used by \texttt{\string \vect}.})
% which are more elegant than those produced by \LaTeX's |\overrightarrow| command.
% The \textsf{esvect} package has an optional argument 
% (a single letter between \texttt{a} and \texttt{h}) to define 
% the desired type of arrow (see~\cite{VECT}).
% In \textsf{mismath}, \textsf{esvect} is loaded with the option \texttt{b}:
% |\vect{AB}| gives $\vect{AB}$.
% If you wish to use a different type of arrow, you must call \textsf{esvect}
% with the appropriate option \emph{before} loading \textsf{mismath}.  
% For example, using |\usepackage[d]{esvect}|
% will provide the arrows produced by default in~\cite{VECT}.
%
% \medskip 
% \DescribeMacro{\boldvect}
% The |\vect| macro allows vector names to be typeset using bold italic font,
% as recommended by ISO~\cite{NIST}~\cite{SI}, instead of using arrows. 
% By using the |\boldvect| command, you can modify the behavior of |\vect|
% locally or globally, depending on its placement in the document (inside or outside
% a group or an environment):\\[2ex]
% \begin{minipage}{8cm}
% \begin{verbatim} 
%\[ \boldvect \vect{v}
%   =\lambda\vect{e}_x+\mu\vect{e}_y. \]
% \end{verbatim}
% \end{minipage} 
% \begin{minipage}{4cm}\vspace{-2ex}
% $\boldvect \vect{v}=\lambda\vect{e}_x +\mu\vect{e}_y$.
% \end{minipage}
%
% \DescribeMacro{\boldvectcommand}
% By default |\boldvect| uses the |\boldsymbol| command
% \footnote{\texttt{\string \mathbf} produces upright bold font, 
% even when used in combination with \texttt{\string \mathit}.}
% from the \textsf{amsbsy} package, which is automatically loaded by \textsf{amsmath}.
% However, you may prefer other packages that produce bold italic fonts, 
% such as \textsf{fixmath} with the |\mathbold| command,
% \textsf{isomath} with |\mathbfit| 
% or \textsf{bm} with the |\bm| command;
% \textsf{unicode-math} provides the |\symbfit| command.
% To use an alternative command instead of |\boldsymbol| in \textsf{mismath}, 
% redefine |\boldvectcommand|, 
% for instance after loading \textsf{fixmath}: 
% \begin{center} |\renewcommand\boldvectcommand{\mathbold}|. \end{center}
%
% According to ISO rules, symbols for matrices are also in bold italic.
% Therefore you can use the same |\boldvect| command or create another alias.
%
% \medskip
% \DescribeMacro{\arrowvect}
% At any moment, you can revert to the default behavior using the inverse switch
% |\arrowvect|. 
% These switches can be placed anywhere, whether
% inside mathematical mode or within an environment (with a local effect) or outside 
% (with a global effect).
%
% \medskip
% \DescribeMacro{\hvect}
% When vectors with arrows are typeset side by side,
% the arrows can be set up slightly higher using |\hvect|
% (which places a vertical phantom box containing ``$t$'') 
% to avoid inelegant effects. For example, writing
% \begin{itemize}
% \item $\vect{AB}=\hvect{u}+ \vect{AC}$, obtained with |\hvect{u}|,
% is better than $\vect{AB}=\vect{u}+ \vect{AC}$;
% \item $\hvect{a} \cdot \vect{b}=0$, obtained with |\hvect{a}|,
% is better thant $\vect{a} \cdot \vect{b}=0$.
% \end{itemize}
% This adjustment ensures a more visually pleasing appearance when vectors 
% with arrows are combined in an equation.
% The |\boldvect| and |\arrowvect| switches have the same effect on |\hvect| 
% as they do on |\vect|.
%
% \DescribeMacro{\hvec}
% In a similar way, |\hvec| raises the little arrow produced by
% the \LaTeX\ command |\vec|, to the height of the letter ``$t$''
% (but |\boldvect| have no effect here):
% \begin{itemize}
% \item $\mathcal{P}=\vec{f}\cdot\hvec{v}$, obtained with |\hvec{v}|,
% is better than $\mathcal{P}=\vec{f}\cdot\vec{v}$.
% \item $\vec{f} =m \hvec{a}$, obtained with |\hvec{a}|,
% is better than $\vec{f} =m \vec{a}$.
% \end{itemize}
%
% \DescribeMacro{\norm}
% The norm of a vector is conventionally represented using the delimiters |\lVert| and |\rVert|
% (or |\|$\mid$ unless a plus (+) or minus (-) sign follows the opening delimiter)
% or |\left\Vert| and |\right\Vert| 
% for adaptive delimiters. Unfortunately, these delimiters 
% are always vertically centered, relatively to the middle of the base line, 
% whereas vectors with arrows are asymmetric objects.
% The code |$\norm{\vec{h}}$| raises a smaller double bar to produce $\norm{\vec{h}}$
% instead of $\left\Vert \vec{h} \right\Vert$.
% Let's notice that the height of the bars don't adjust to content, 
% but however to context: main text, subscripts or exponents, 
% \eg $\e^{\norm{\vec{h}}}$. 
% This macro is useful only for arguments of special height, such as $\vec{h}$ or $\vect{AB}$
% and may give bad results in other situations.
%
% \medskip
% \DescribeMacro{\mathbfsfit}\DescribeMacro{\tensor}
% For tensors symbols, ISO rules recommend using
% sans serif bold italic, but there
% is no such math alphabet in the default \TeX\  mathematical style.
% However, the \textsf{mismath} package defines this alphabet 
% (assuming the font encoding and package you use permits it) 
% and provides the macro |\mathbfsfit| or its alias |\tensor|.
% By using |\tensor{T}| you can produce $\tensor{T}$.
%
% \subsection{Standard operator names}\label{operators}
%
% \DescribeMacro{\di}
% The \emph{differential} operator should be typeset in upright shape, not in
% italics, to distinguish it from variables 
% (as mentioned in \cite{TYPMA}~\cite{NIST}~\cite{ICTNS}~\cite{LSHORT}).
% To achieve this, we provide the |\di| command.
% Take a look at the following examples (notice the thin spaces before the d, 
% just like with classic function's names): \\[2ex]
% \begin{minipage}{7cm}
% \begin{verbatim} 
%\[ \iint xy\di x\di y \]
% \end{verbatim}
% \end{minipage}
% \begin{minipage}{5cm}
% \[ \iint xy\di x\di y \]
% \end{minipage}
% \\[0.5ex]
% \begin{minipage}{7cm}
% \begin{verbatim} 
%\[ m\frac{\di^2x}{\di t^2}
%   + h\frac{\di x}{\di t} + kx = 0 \]
% \end{verbatim}
% \end{minipage}
% \begin{minipage}{5cm}
% \[m\frac{\di^2x}{\di t^2}+h\frac{\di x}{\di t}+kx=0\]
% \end{minipage}
%
% This command can also represent \emph{distance} (hence its name):
% \[\lambda\di(A, \mathcal{F})+\mu\di(B, \mathcal{H}).\]
%
% \DescribeMacro{\P} \DescribeMacro{\E}
% To refer to probability
% \footnote{\LaTeX\ provides also \texttt{\string Pr} which gives $\Pr$.}
% and expectation the proper use is to typeset the capital letters $\P$, $\E$ 
% in roman just like any standard function identifier.
% This can be achieved with |\P| and |\E| commands.
%
% \DescribeMacro{\Par}
% The |\P| command already existed to refer to the end of paragraph symbol \Par\ 
% and has been redefined, but this symbol can still be obtained with |\Par|.
%
% \medskip
% \DescribeMacro{\V}
% Variance is generally denoted by $\var$ or $\Var$ (see table below),
% but some authors prefer to use $\V$, which can be produced using |\V|.
%
% \DescribeMacro{\MathProba}\DescribeMacro{\MathNormal}
% In the same way as for $\e$, $\i$ or $\j$, you can use |\MathUp{P}|, |\MathUp{E}| 
% or |\MathUp{V}| to avoid typing many |\P|, |\E| or |\V|. 
% However you can also achieve this in a single command with |\MathProba|, 
% for example |\MathProba{P,E}|. We get the inverse switch with
% |\MathIt| for any individual letter or |\MathNormal| for a list.
%
% \medskip
% \DescribeMacro{\probastyle}
% Some authors use ``blackboard bold'' font to represent probability, expectation 
% and variance: $\mathbb{P}, \mathbb{E}, \mathbb{V}$.
% The |\probastyle| macro sets the appearance of |\P|, |\E| and |\V|.
% For instance |\renewcommand\probastyle{\mathbb}|
% \footnote{The effect of this redefinition is global or local to the container environment 
% in which it is used.}
% brings the previous ``openwork'' letters.
% The |\mathbb| command comes from \textsf{amsfonts} package
% (loaded by \textsf{amssymb} but also available standalone)
% which needs to be called in the preamble.
%
% \medskip
% The following standard operator names are defined in \textsf{mismath}:
% \begin{center}
% \begin{tabular}{rlrlrl}
% |\adj| & $\adj$ \qquad\mbox{} & |\erf| & $\erf$ \qquad\mbox{} & |\Re| & $\Re$ \\
% |\Aut| & $\Aut$ & |\grad| & $\grad$ & |\rot| & $\rot$ \\
% |\codim| & $\codim$ & |\id| & $\id$ & |\sgn| & $\sgn$ \\
% |\Conv| & $\Conv$ & |\Id| & $\Id$ & |\sinc| & $\sinc$ \\
% |\cov| & $\cov$ & |\im| & $\im$ & |\spa| & $\spa$ \\
% |\Cov| & $\Cov$ & |\Im| & $\Im$ & |\tr| & $\tr$ \\
% |\curl| & $\curl$ & |\lb| & $\lb$ & |\var| & $\var$ \\
% |\divg| & $\divg$ & |\lcm| & $ \lcm$ & |\Var| & $\Var$  \\
% |\End| & $\End$ & |\rank| & $\rank$ & |\Zu| & $\Zu$
% \end{tabular}
% \end{center}
%
% By default, operators returning vectors,  |\grad| and |\curl| (or its synonym |\rot|
% rather used in Europe), are written with an arrow on the top.
% When |\boldvect| is activated, they are typeset in bold style:
% $\boldvect \grad, \curl, \rot$.
% For the variance, the covariance and the identity function, 
% two notations are proposed, with or without a first capital letter, 
% because both are very common.
% On the other hand, `$\im$' stands for the image of a linear transformation 
% (like `$\ker$' for the kernel)
% whereas `$\Im$' is the imaginary part of a complex number.
% Please note that |\div| already exists ($\div$) and |\span| is a \TeX\ primitive;
% they haven't been redefined. Therefore the provided macros are called |\divg| (divergence) 
% and |\spa| (span of a set of vectors).
% Furthermore |\Z| is used to denote the set of integers (see \ref{aliases}), 
% which is why we used |\Zu|,
% to designate the center of a group: $\Zu(G)$ (from German Zentrum).
%
%\medskip
% \DescribeMacro{\oldRe} \DescribeMacro{\oldIm}
% The |\Re| and |\Im| macros already existed to refer to real and imaginary part 
% of a complex number, producing outdated symbols $\oldRe$ and $\oldIm$.
% However, they have been redefined according to current usage, 
% as mentioned in the above table. Nevertheless,
% it is still possible to obtain the old symbols with |\oldRe| and |\oldIm|.
%
% \medskip
% The package \textsf{mismath} also provides some (inverse) circular or hyperbolic functions, 
% that are missing in \LaTeX:
% \begin{center}
% \begin{tabular}{rlrlrl}
% |\arccot| & $\arccot$\qquad\mbox{} & |\arsinh| & $\arsinh$\qquad\mbox{} 
%    & |\arcoth| & $\arcoth$ \\
% |\sech| & $\sech$ & |\arcosh| & $\arcosh$ & |\arsech| & $\arsech$ \\
% |\csch| & $\csch$ & |\artanh| & $\artanh$ & |\arcsch| & $\arcsch$
% \end{tabular}
% \end{center} 
%
% \DescribeMacro{\bigO} \DescribeMacro{\bigo} \DescribeMacro{\lito}
% Asymptotic comparison operators (in Landau notation) are obtained with
% |\bigO| or |\bigo| and |\lito| commands: 
% \[ n^2+\bigO(n\log n) \txt{or} n^2+\bigo(n\log n)\txt{and} \e^x=1+x+\lito(x^2).\]
%
% \subsection{A few useful aliases} \label{aliases}
% 
% In the tradition of Bourbaki and D.~Knuth, proper use requires 
% that classic sets of numbers are typeset in bold roman:
% $\R, \C, \Z, \N, \Q$, 
% whereas ``openwork'' letters ($\mathbb{R}, \mathbb{Z}, \ldots$) 
% are reserved for writing at the blackboard~\cite{LSHORT}.
% Similarly, to designate a field we use $\F$ or $\K$ (Körper in German).
% We get obtain these symbols with the following macros:
% \begin{center}
% |\R|, |\C|, |\Z|, |\N|, |\Q|, |\F|, |\K|.
% \end{center}
%
% \DescribeMacro{\mathset}
% The |\mathset| command enables you to change the behavior 
% of all these macros in a global way. 
% By default, |\mathset| is an alias for |\mathbf|, but if you prefer openwork letters, 
% you can simply place |\renewcommand\mathset{\mathbb}| where you want, 
% for instance in the preamble after loading the \textsf{amsfonts} package 
% (which provides the ``blackboard bold'' typeface,
% also loaded by \textsf{amssymb}).
%
% \smallskip
% \DescribeMacro{\onlymathC}
% The macro |\onlymathC| is designed for cases when |\C| is already defined,
% but only in text mode (usually when loading the Russian language with \textsf{babel}
% or \textsf{polyglossia}). The macro preserves the original definition for text mode
% and allows you to use |\C| for the complex number set in math mode.
% For this purpose, simply call |\onlymathC| once in the preamble or anywhere in the document.
%
% \medskip
% \DescribeMacro{\ds}
% The |\displaystyle| command is very common, so the |\ds| alias is provided.
% Not only it eases typing but also it makes source code more readable.
%
% \medskip
% Symbols with limits behave differently for in-line formulas or for displayed equations. 
% In the latter case, ``limits'' are placed under or above the symbol 
% whereas for in-line math mode, 
% they are placed on the right, as a subscript or exponent. Compare:
% $\zeta(s)=\sum_{n=1}^{\infty    }\frac{1}{n^s}$ with
% \[\zeta(s)=\sum_{n=1}^{\infty}\frac{1}{n^s}.\]
%
% \DescribeMacro{\dlim} \DescribeMacro{\dsum} \DescribeMacro{\dprod}
% \DescribeMacro{\dcup} \DescribeMacro{\dcap}
% With in-line math mode, displaymath can be forced with |\displaystyle|
% or its alias |\ds|. However, when using these commands, all the rest of the current
% mathematical environment will be set in displaymath mode 
% (as shown in the previous example, where the fraction will be expanded).
% To limit the display style effect to the affected symbol only, 
% similar the the  \textsf{amsmath} command |\dfrac|, 
% we can use the following macros:
% |\dlim|, |\dsum|, |\dprod|, |\dcup|, |\dcap|.
% So 
% \begin{center}
% |$\dlim_{x\to +\infty}\frac{1}{x}$| \quad  yields \quad  $\dlim_{x \to +\infty}\frac{1}{x}$.
% \end{center}
%
% \DescribeMacro{\lbar} \DescribeMacro{\hlbar}
% Large bars over expressions are obtained with |\overline|
% or its alias |\lbar|, to get for instance $\lbar{z_1z_2}$.
% Similar to vectors, you can raise the bar (from the height of ``$h$'') with
% the |\hlbar| command, to correct uneven bars heights.
% \begin{center}
% $\lbar{z+z'}=\hlbar{z}+\lbar{z'}$, obtained with |\hlbar{z}|,
% is better than $\lbar{z+z'}=\lbar{z}+\lbar{z'}$.
% \end{center}
%
% \DescribeMacro{\eqdef} \DescribeMacro{\eqdef*}
% The |\eqdef| macro writes the equality symbol topped with `def',
% or with `$\scriptstyle \Delta$' for |\eqdef*|
% (thanks to the \LaTeX\ command |\stackrel|):\\[2ex] 
% \begin{minipage}{7cm}
% \begin{verbatim} 
%\[ \e^{\i\theta} \eqdef 
%   \cos\theta + \i\sin\theta \]
% \end{verbatim}
% \end{minipage}
% \begin{minipage}{5cm}\vspace{-3ex}
% \[\e^{\i\theta}\eqdef\cos\theta + \i\sin\theta\]
% \end{minipage}
%
% \noindent\begin{minipage}{7cm}
% \begin{verbatim} 
%\[ \e^{\i\theta} \eqdef* 
%   \cos\theta + \i\sin\theta \]
% \end{verbatim}
% \end{minipage}
% \begin{minipage}{5cm}\vspace{-3ex}
% \[\e^{\i\theta}\eqdef*\cos\theta + \i\sin\theta\]
% \end{minipage}
%
% \DescribeMacro{\unbr}
% |\unbr| is an alias for |\underbrace|
% \footnote{The \textsf{mathtools} package by Morten Høgholm 
% and Lars Madsen~\cite{TOOL} provides a new and improved version 
% of the \texttt{\string \underbrace} command, along with many other useful macros.
% It is loaded by \textsf{mismath}.}, 
% making source code more compact.\\[2ex]
% \begin{minipage}{6.8cm}
% \begin{verbatim}
%\[ (QAP)^n = \unbr{QAP\mul QAP\mul
%   \cdots\mul QAP}_{n\text{ times}} \]
% \end{verbatim}
% \end{minipage}
% \begin{minipage}{6.2cm}\vspace{-3ex}
% \[ (QAP)^n = \unbr{QAP\mul QAP\mul\cdots\mul QAP}_{n\text{ times}} \]
% \end{minipage}
%
% \DescribeMacro{\iif}
% |\iif| is an alias for ``\iif'', to be used in text mode.
%
% \subsection{Improved spacing in mathematical formulas}
%
% \DescribeMacro{\then} 
% The |\then| macro produces the symbol $\Longrightarrow$ surrounded by large spaces
% just like the standard macro |\iff| does it with $\Longleftrightarrow$.
% Similarly, the |\txt|, \DescribeMacro{\txt}
% based on the |\text| macro from the \textsf{amstext} package
% (loaded by \textsf{amsmath}),
% leaves em quad spaces (|\quad|) around the text. See the following example:
% \begin{center}
% |\[ \ln x=a \then x=\e^a, \txt{rather than}| \\
% | \ln x=a \Longrightarrow x=\e^a \]| \\[1ex]
% $ \ln x=a \then x=\e^a, \txt{rather than}    \ln x=a \Longrightarrow x=\e^a$
% \end{center}
%
% \DescribeMacro{\mul}
% The multiplication symbol obtained with |\times| produces the same spacing as addition
% or subtraction operators, whereas division obtained with $/$ is closer to its operands.
% This actually hides the priority of multiplication over $+$ and $-$.
% That's why we provide the |\mul| macro, behaving like $/$ 
% (ordinary symbol) and leaving less space around than |\times|:
% \begin{center}
% $\lambda+\alpha \mul b-\beta \mul c$, obtained with |\mul|,
% is better than $\lambda+\alpha \times b-\beta \times c$.
% \end{center}
%
% When using |\mul| before a function name or around a |\left...\right| structure, 
% the space may be too large on one side of |\mul|.
% To ensure the same amount of space on both sides of |\mul|, 
% you can use thin negative spaces |\!| 
% or enclose the function or structure with braces:
% \begin{center}
% $x\mul{\sin x}$, obtained with |x\mul{\sin x}|, is slightly better than $x\mul\sin x$.\\[1ex]
% |$\sin\!{\left( \frac{\pi}{3} \right)} \mul 2$|\\
% gives $\sin\!{\left(\frac{\pi}{3}\right)}\mul 2$, which is better than
% $\sin\left(\frac{\pi}{3}\right)\mul 2$. 
% \end{center}
% The thin negative space after the function name is not relative to |\mul|,
% but is due to the fact that spaces around a |\left...\right| structure
% are bigger than those produced by single parenthesis |(...)|.
%
% \medskip
% \DescribeMacro{\pow}
% In the same way, when typesetting an exponent after a closing \emph{big} 
% parenthesis produced by |\right)|,
% the exponent appears to be a little to far from the parenthesis.
% To address this issue, the |\pow|\marg{expr}\marg{pow} command is provided, which sets
% \meta{expr} between parentheses and adjusts the positioning of the exponent \meta{pow}
% slightly closer to the right parenthesis
% \footnote{This macro gives bad results with normal-sized parenthesis.}. 
% Compare:
% \[ \e^a \sim\pow{1+\frac{a}{n}}{n} \txt{which may be better than} 
% \e^a \sim\left(1+\frac{a}{n}\right)^{n}.\]
%
% \DescribeMacro{\abs}
% The correct typesetting of absolute value (or modular for a complex number) is achieved
% using |\lvert| \ldots |\rvert|, rather than $\mid$, as the latter doesn't maintain 
% proper spacing in some situations (when a sign follows the open delimiter).
% For bars whose height has to adapt to the content, 
% we can use |\left\vert| \ldots |\right\vert| or, more simply, 
% the |\abs|\{\ldots\} command, which is equivalent
% \footnote{Another solution is to define \texttt{\string \abs} 
% using the \texttt{\string \DeclarePairedDelimiter} command 
% from the \mbox{\textsf{mathtools}} package~\cite{TOOL}.}.
%
% \medskip
% \DescribeMacro{\lfrac}
% The |\lfrac| macro behaves like |\frac|
% but with thicker spaces around the arguments,
% making the corresponding fraction bar slightly longer:\\[2ex]
% \begin{minipage}{8cm}
% \begin{verbatim}
%\[ \lbar{Z} = 
%   \lfrac{\lbar{z_1-z_2}}{\lbar{z_1+z_2}} \]
% \end{verbatim}
% \end{minipage}
% \begin{minipage}{4cm}\vspace{-3ex}
% \[ \lbar{Z} = \lfrac{\lbar{z_1-z_2}}{\lbar{z_1+z_2}} \]
% \end{minipage}
%
% \medskip
% \DescribeMacro{[ibrackets]}
% Open intervals are commonly represented with parenthesis, \eg $(0, +\infty)$,
% but sometimes square brackets are used, especially in French mathematics: $]0, +\infty[$.
% In that specific case, the space around the square brackets is often inappropriate, 
% as in the expression $x \in \mathclose{]} 0, +\infty[$.
% To address this issue, we have redefined the brackets in the \textsf{ibrackets}
% package~\cite{BRACKET} 
% which can be optionally
% \footnote{This functionality is optional because there is a conflict
% when using another command for open intervals with square brackets defined by 
% \texttt{\string \DeclarePairedDelimiter} from \textsf{mathtools}~\cite{TOOL}.}
% loaded by \textsf{mismath} using the \texttt{ibrackets} package option.
% Thus |$x\in ]-\pi,0[ \cup ]2\pi,3\pi[$|
% \begin{align*}
% \mbox{yields \ } 
% x\in ]-\pi, 0[ \cup ]2\pi, 3\pi[ & \mbox{\ with \textsf{ibrackets}}, \\
% \mbox{instead of \ }
% x\in \mathclose{]}-\pi, 0 \mathopen{[} \cup \mathclose{]} 2\pi, 3\pi \mathopen{[} 
% &\mbox{\ without \textsf{ibrackets}}.
% \end{align*}
%
% In our code, the symbols $[$ and $]$ are set as `active' characters, 
% behaving like ordinary characters and not as delimiters in most cases. 
% Therefore, a line break could occur between the two brackets, but
% it is always possible to transform them 
% into delimiters using |\left| and |\right|.
%
% However, when a bracket is \emph{immediately} followed by a + or - character,
% it becomes an open delimiter.
% Therefore, when the left bound contains an operator sign,
% \emph{you don't have to leave a space between the first bracket and the sign},
% otherwise, the spaces surrounding the operator will be too large.
% For example if you write |$x \in ] -\infty, 0]$|, it yields $x \in  ] -\infty, 0]$
% instead of $x \in  ]-\infty, 0]$.
% Conversely, when dealing with algebraic expressions involving intervals,
% \emph{you must leave a blank space between the second bracket and the} +/- 
% \emph{operation}.
% For instance |$[a,b] + [c,d]$| yields $[a,b] + [c,d]$
% but |$[a,b]+ [c,d]$| yields $[a, b]+ [c, d]$.
%
% Besides, there are other approaches, for example the |\interval| macro
% from the \textsf{interval} package~\cite{INT},
% or |\DeclarePairedDelimiters| from the \textsf{mathtools} package~\cite{TOOL}
% (but the latter is incompatible with \textsf{ibrackets}
% for managing brackets).
%
% \medskip
%\DescribeMacro{[decimalcomma]}
% In many countries, except notably in English-speaking countries, 
% the comma is used as a decimal separator for numbers. 
% However, in the math mode of \LaTeX, the comma is always, by default, 
% treated as a punctuation symbol and therefore is followed by a space. 
% This is appropriate in intervals: |$[a,b]$| results in $[a,b]$,
% but is not appropriate for numbers where the comma represents the decimal separator. 
% For example, |$12,5$| is displayed as $12, 5$ instead of $12{,}5$.
%
% Two very convenient packages allow handling the decimal comma in math mode:
% \textsf{icomma} by Walter Schmidt~\cite{ICOMMA} and 
% \textsf{ncccomma} by Alexander I.~Rozhenko~\cite{NCC}.
% The second package takes a more generic approach,
% however it poses several compatibility issues, 
% in particular when compiling with Lua\LaTeX, using \textsf{unicode-math}
% and calling |\setmathfont|.
% Therefore we propose the \textsf{decimalcomma} package~\cite{DEC},
% functionally identical to that of \textsf{ncccomma} but with lighter code 
% and without the aforementioned incompatibility.
% It can be loaded by \textsf{mismath} using the \texttt{decimalcomma}
% package option\footnote{\texttt{ibrackets} and \texttt{decimalcomma} are the only
% options specific to the \textsf{mismath} package.}.
%
% \subsection{Environments for systems of equations and small matrices}
%
% \DescribeEnv{system}
% The \texttt{system} environment, defined in the \textsf{mismath} package, 
% is used to represent a system of equations:\\[2ex]
% \begin{minipage}{6.5cm}
% \begin{verbatim}
%\[ \begin{system} 
%       x=1+2t \\ y=2-t \\ z=-3-t 
%   \end{system} \]
% \end{verbatim}
% \end{minipage}
% \begin{minipage}{5cm} \vspace{-3ex}
% \[ \begin{system} x=1+2t \\ y=2-t \\z=-3-t \end{system} \]
% \end{minipage}
%
% \medskip
% \DescribeMacro{\systemsep}
% This first example could also have been achieved using the \texttt{cases} environment
% from the \textsf{amsmath} package, although \texttt{cases} places mathematical expressions 
% closer to the bracket.
% The |\systemsep| command allows you to adjust the gap between 
% the bracket and the expressions. 
% By default, the gap is set to |\medspace|. You can reduce the gap by redefining the command,
% for instance: |\renewcommand{\systemsep}{\thinspace}|.
% Alternatively you can increase the gap using |\thickspace| 
% (and with |\renewcommand\systemsep}{}| you can achieve the same spacing as the
% \texttt{cases} environment).
% The |\systemsep| command allows for greater flexibility in adjusting the spacing 
% within the \texttt{system} environment.
%
% \medskip
% \DescribeEnv{system\oarg{coldef}}
% By default, a system is written like an \texttt{array} environment with only one column, 
% left aligned. However the \texttt{system} environment has an optional 
% argument that allows to create systems with multiple columns,
% specifying their alignment using the same syntax as the \texttt{array} environment in
% \LaTeX. For instance, using |\begin{system}[cl]| will produce a two-column system, 
% with the first column centered and
% the second column left-aligned, as shown in the following example:\\[2ex]
% \begin{minipage}{7cm}
% \begin{verbatim}
%\[ \begin{system}[cl] 
%       y & =\dfrac{1}{2}x-2 \\[1ex] 
%       (x,y) & \neq (0,-2) 
%   \end{system} \]
% \end{verbatim}
% \end{minipage}
% \begin{minipage}{5cm}\vspace{-2ex}
% \[ \begin{system}[cl] y&=\dfrac{1}{2}x-2 \\[1ex] (x,y)&\neq (0,-2) \end{system}\]
% \end{minipage}
%
% \DescribeMacro{\systemstretch}
% The default spacing between the lines of a \texttt{system} environment has been slightly 
% enlarged compared to the one used in \texttt{array} environments (using a factor of 1.2). 
% This can be adjusted by using
% |\renewcommand{\systemstretch}|\marg{stretch}, where \meta{stretch} is the desired value
% for the spacing. You can place this command 
% inside the current mathematical environment for a local change, or outside 
% for a global change. The default value for is 1.2.
% Furthermore you can also use the end of the line with a spacing option, as 
% demonstrated above with |\\[1ex]|, to control the spacing between specific lines in
% the system.
%
% Another example with |\begin{system}[rl@{\quad}l]|
% \footnote{\texttt{@\{\ldots\}} sets inter-column space.}:
% \begin{equation*}
%    \begin{system}[rl@{\quad}l]
%        x+3y+5z&=0 & R_1\\ 2x+2y-z&=3 & R_2\\ 3x-y+z&=2 & R_3
%    \end{system}
%    \iff
%    \begin{system}[rl@{\quad}l]
%        x+3y+5z&=0 & R_1\\
%        4y+11z&=3 & R_2 \gets 2R_1-R_2 \\
%        5y+7z&=-1 & R_3 \gets \frac{1}{2}\left(3R_1-R_3\right)
%    \end{system}
% \end{equation*}
% 
% Let's also mention the \textsf{systeme} package~\cite{SYST} which provides 
% a lighter syntax and automatic alignments for linear systems.
% Additionally, there is the \textsf{spalign} package~\cite{SPAL},
% which offers a convenient and easy syntax for systems and matrices with
% visually appealing alignments.
%
% \medskip
% \DescribeEnv{spmatrix}
% The \textsf{amsmath} package offers several environments to typeset matrices :
% For example, the \texttt{pmatrix} environment surrounds the matrix with parenthesis,
% and the \texttt{smallmatrix} environment creates a smaller matrix suitable for insertion 
% within a text line. We provide a combination of the these both 
% functionalities with the \texttt{spmatrix} environment:
% |$\vec{u}\begin{spmatrix}-1\\2\end{spmatrix}$| yielding
% $\vec{u}\begin{spmatrix}-1\\2\end{spmatrix}$.
%
% The \textsf{mathtools} package enhances the \textsf{amsmath} matrix environments
% and also provides a small matrix environment with parenthesis: \texttt{psmallmatrix}.
% Moreover, with the starred version |\begin{psmallmatrix*}|\oarg{col},
% you can choose the alignment inside the columns (\texttt{c}, \texttt{l} or \texttt{r}).
% However, the space before the left parenthesis is unfortunately too narrow
% compared to the space inside the parenthesis.
% To illustrate this, consider the following comparison:
% $\vec{u}\begin{spmatrix}-1\\2\end{spmatrix}$ (using \textsf{mismath}'s \texttt{spmatrix})
% vs.\@ $\vec{u}\begin{psmallmatrix}-1\\2\end{psmallmatrix}$ 
% (using \textsf{mathtools} \texttt{psmallmatrix}).
%
% \medskip
% For typesetting  various kinds of matrices, let's mention the excellent 
% \textsf{nicematrix} package by François Pantigny~\cite{NMATX}.
%
% \subsection{Displaymath in double columns}
%
% \DescribeEnv{mathcols}
% The \texttt{mathcols} environment allows you to arrange 
% ``long'' calculations in double columns, separated with a central rule, 
% as shown in the following example.
% However, to use this feature, the \textsf{multicol} package must be loaded in the preamble.
% The \texttt{mathcols} environment activates mathematical mode
% in display style and uses an \texttt{aligned} environment.
% \begin{mathcols}
%           & \frac{1}{2 \mul {\pow{\frac{1}{4}}{n}} + 1} \geq 0.999 \\
%     \iff\ & 1 \geq 1.998  \pow{\frac{1}{4}}{n} + 0.999 \\
%     \iff\ & 0.001 \geq \frac{1.998}{4^n} \\
% \changecol
%     & \iff 4^n \geq 1998 \\
%     & \iff n \ln 4 \geq \ln(1998) \\
%     & \iff n \geq \frac{\ln(1998)}{\ln 4} \approx 5.4 \\
%     & \iff n \geq 6
% \end{mathcols}
%
% \DescribeMacro{\changecol}
% The |\changecol| macro is used to switch to the next column,
% and alignments within the columns is done using the classic delimiters 
% |&|, to separate entries, and |\\|, to start a new row.
% 
% \begin{verbatim}
%\begin{mathcols}
%          & \frac{1}{2 \mul {\pow{\frac{1}{4}}{n}} + 1} \geq 0.999 \\
%    \iff\ & 1 \geq 1.998  \pow{\frac{1}{4}}{n} + 0.999 \\
%    \iff\ & 0.001 \geq \frac{1.998}{4^n} \\
%\changecol
%    & \iff 4^n \geq 1998 \\
%    & \iff n \ln 4 \geq \ln(1998) \\
%    & \iff n \geq \frac{\ln(1998)}{\ln 4} \approx 5.4 \\
%    & \iff n \geq 6
%\end{mathcols}
% \end{verbatim}
%
% \vspace{-4ex}
% \subsection{Old commands}
%
% Here is a summary table of old commands that were used until version 2.2.
% These commands are still functional and will be maintained for the time being,
% but a warning message indicates the new alternative.
% They used to work only in the preamble, affecting the entire document globally, 
% and lacked an inverse switch.
% These old commands can now be replaced by the more 
% versatile and powerful |\MathUp| macro, which can be used anywhere 
% in the document or preamble and has an inverse switch |\MathIt|. 
%
% \begin{center} 
% \setlength{\extrarowheight}{1pt}
% \begin{tabular}{ll}
% \hline
% Old command & New alternative \\
% \hline
% |\enumber| & |\MathUp{e}| \\
% |\inumber| & |\MathUp{i}| \\
% |\jnumber| & |\MathUp{j}| \\
% |\PEupright| & |\MathUp{P}\MathUp{E}| \\
% \hline
% \end{tabular}
% \end{center}
%
% \medskip
% You can also utilize|\MathNumbers| instead of |\MathUp| with an argument containing
% all the constants you want to be typeset in roman (among `e, i, j').
% Additionally |\MathProba{P,E}| can be used instead of |\MathUp{P}\MathUp{E}|,
% and you can include V in its argument to refer to variance.
%
% \medskip
% In version 2.3 we attempted to replace these old commands
% with package options based on keyval. However, we found that this method was
% less efficient and have decided to abandon it.
% As a result, the command |\mismathset| is now obsolete.
% Additionally, the command, |\paren|, which was used before version 2.0, 
% is no longer supported.
%
% \StopEventually{}
% \section{Implementation}
%
% We load certain packages conditionally to avoid 'option clash' errors in cases
% where these packages have been previously loaded with other options.
%    \begin{macrocode}
\newif\ifmm@ibrackets % initialized to false
\newif\ifmm@decimalcomma
\DeclareOption{ibrackets}{\mm@ibracketstrue}
\DeclareOption{decimalcomma}{\mm@decimalcommatrue}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{amsmath}}
\ProcessOptions \relax
\@ifpackageloaded{amsmath}{}{\RequirePackage{amsmath}}
\@ifpackageloaded{mathtools}{}{\RequirePackage{mathtools}}
\@ifpackageloaded{esvect}{}{\RequirePackage[b]{esvect}}
\RequirePackage{ifthen}
\RequirePackage{xparse} % provides \NewDocumentCommand
\RequirePackage{xspace}
\RequirePackage{iftex}
\RequirePackage{etoolbox} % provides \AtEndPreamble

%    \end{macrocode}
%
% The package \textsf{unicode-math} causes some compatibility issues
% with the options ibrackets or decimalcomma: the respective packages
% must be loaded \emph{after} \textsf{unicode-math},
% but \textsf{mismath} (like \textsf{amsmath}) must be loaded \emph{before} 
% \textsf{unicode-math}.
% And to complicate matters, \textsf{unicode-math} defines (or redefines) all its commands 
% by |\AtBeginDocument|.
% Therefore we used the command |\AtBeginDocument| within
% |\AtEndPreamble| (from the \textsf{etoolbox} package).
%
% Moreover the command |\mathbfsfit| (used for tensors) is already defined
% in \textsf{unicode-math} and will not be redefined if \textsf{unicode-math}
% is loaded.
%    \begin{macrocode}
\newif\ifmm@unicodemath
\newif\ifmm@multicol
\AtEndPreamble{% necessary to work with unicode-math
    \@ifpackageloaded{multicol}{\mm@multicoltrue}{\mm@multicolfalse}
    \@ifpackageloaded{unicode-math}{\mm@unicodemathtrue}{
        \mm@unicodemathfalse
        \DeclareMathAlphabet{\mathbfsfit}{\encodingdefault}%
            {\sfdefault}{bx}{it}}
    \AtBeginDocument{% necessary to work with unicode-math
        \ifmm@ibrackets\RequirePackage{ibrackets}\fi
        \ifmm@decimalcomma\RequirePackage{decimalcomma}\fi
    }
}

%    \end{macrocode}
%
% \medskip
% \DescribeMacro{\bslash}
% The |\bslash| macro originates from Frank Mittelbach's \textsf{doc.sty} package. 
% It can be employed in other documents as an alternative to |\textbackslash|,
% especially in situations where |\textbackslash| does not work correctly, such as
% inside warning messages.
%    \begin{macrocode}
{\catcode`\|=\z@ \catcode`\\=12 |gdef|bslash{\}} % \bslash command

%    \end{macrocode}
%
% \medskip
% \DescribeMacro{\mm@warning} \DescribeMacro{\mm@macro} \DescribeMacro{\mm@operator} 
% The next three internal macros serve as meta commands for
% conditionally defining macros while providing a warning message if the macro already exists.
% These macros can be useful in other packages as well.
% \medskip
%    \begin{macrocode}
\newcommand\mm@warning[1]{
    \PackageWarningNoLine{mismath}{
        Command \bslash #1 already exist and will not be redefined}
}
\newcommand\mm@macro[2]{
    \@ifundefined{#1}{
        \expandafter\def\csname #1\endcsname{#2}
    }{\mm@warning{#1}}
}
\NewDocumentCommand\mm@operator{O{#3}mm}{%
    \@ifundefined{#1}{
        \DeclareMathOperator{#2}{#3}
    }{\mm@warning{#1}}
}
    
%    \end{macrocode}
%
% To produce the correct upright shape font when working 
% with the \textsf{beamer} package, you don't have to use |\mathrm|
% but rather |\mathup| (based on |\operatorfont| from the \textsf{amsopn} package).
% This command also works fine with other sans serif fonts like \textsf{cmbright}.
%
% Moreover for \textsf{beamer}, which changes the default font family (to sans serif),
% |\e|, |\i|, |\j| have no effect without |\AtBeginDocument|.
% |\AtBeginDocument| is also necessary to redefine |\i| when calling 
% the \textsf{hyperref} package which overwrites the |\i| definition.
% \medskip
%    \begin{macrocode}
\@ifundefined{mathup}{
    \providecommand*{\mathup}[1]{{\operatorfont #1}}
    }{\mm@warning{mathup} } % also in kpfonts (and unicode-math)
\mm@macro{e}{\mathup{e}}
\AtBeginDocument{\let\oldi\i \let\oldj\j
    \renewcommand{\i}{\TextOrMath{\oldi}{\mathup{i}}}
    \renewcommand{\j}{\TextOrMath{\oldj}{\mathup{j}}} }

%    \end{macrocode}
%
% \DescribeMacro{\MathFamily}
% The following macros |\MathUp| and |\MathIt| are switches that transform 
% any chosen letter in math mode to roman or italic style. 
% These switches can be used anywhere in the document or preamble.
% They are based on the generic macro |\MathFamily|.
% To obtain a letter in roman style instead of italic, we need to change the 
% mathcode digit that represents the font family: 1 to 0.
%
% For example, except for \LuaLaTeX, mathcode of the `e' letter is:
% `e="7165 (decimal 29029), with the second digit `1' indicating ``italic'' style.
% To get a roman `e', we need to change its mathcode to "7065.
%
% When used in the preamble, we call |\MathFamily| by |\AtBeginDocument|
% for working with the \textsf{beamer} package.
% Let's notice that |\MathFamily| has an erratic behavior when \textsf{unicode-math}
% is loaded, but fortunately, in that case, the |\DeclareMathSymbol| can be
% used instead, even outside the preamble.
% \medskip
%    \begin{macrocode}
\newcount\mm@charcode
\newcount\mm@charclass
\newcount\mm@charfam
\newcount\mm@charslot

\newcommand*\MathFamily[2]{%
    \mm@charfam=#2
    \ifluatex
        \mm@charclass=\Umathcharclass`#1
        %\mm@charfam=\Umathcharfam`#1
        \mm@charslot=\Umathcharslot`#1
        \Umathcode`#1= \mm@charclass \mm@charfam \mm@charslot
    \else
        \mm@charcode=\mathcode`#1
        % extract charclass
        \@tempcnta=\mm@charcode
        \divide\@tempcnta by "1000
        \multiply\@tempcnta by "1000 % charclass
        \mm@charclass=\@tempcnta
        % extract charslot
        \@tempcnta=\mm@charcode
        \@tempcntb=\mm@charcode
        \divide\@tempcnta by "100
        \multiply\@tempcnta by "100 % charclass + charfam
        \advance\@tempcntb by -\@tempcnta % charslot
        \mm@charslot=\@tempcntb
        % construct charcode
        \mm@charcode=\mm@charclass
        \multiply\mm@charfam by "100
        \advance\mm@charcode by \mm@charfam
        \advance\mm@charcode by \mm@charslot
        \mathcode`#1=\mm@charcode
    \fi
}

\newcommand*\MathUp[1]{%
    \ifx\@onlypreamble\@notprerr % not in preamble
        \ifmm@unicodemath
            \DeclareMathSymbol{#1}{\mathalpha}{operators}{`#1}
        \else
            \MathFamily{#1}{0}
        \fi
    \else % in preamble
      \AtBeginDocument{
        \ifmm@unicodemath
            \DeclareMathSymbol{#1}{\mathalpha}{operators}{`#1}
        \else
            \MathFamily{#1}{0}
        \fi
      }
    \fi
}

\newcommand*\MathIt[1]{%
    \ifx\@onlypreamble\@notprerr % not in preamble
        \ifmm@unicodemath
            \DeclareMathSymbol{#1}{\mathalpha}{letters}{`#1}
        \else
            \MathFamily{#1}{1}
        \fi
    \else % in preamble
      \AtBeginDocument{
        \ifmm@unicodemath
            \DeclareMathSymbol{#1}{\mathalpha}{letters}{`#1}
        \else
            \MathFamily{#1}{1}
        \fi
      }
    \fi
}

%    \end{macrocode}
% With a similar approach we could also create additional macros to set any letter
% in bold or sans serif. However, there is no default family number associated 
% with these typefaces. The family number depends on the font package being loaded and
% may vary depending on specific |\DeclareSymbolFont| used.
% Therefore, setting letters in bold or sans serif requires additional consideration 
% and may not have a straightforward solution.
%
% \medskip
% In addition to |\MathUp| and |\MathIt|, we also offer the following two commands
% to set a group of letters in roman typeface: one for for mathematical constants,
% among `e, i, j', and the other for probability operators, among or `P, E, V'.
%
% \medskip
%    \begin{macrocode}
\newcommand*\MathNumbers[1]{%
    \in@{e}{#1} \ifin@ \MathUp{e} \fi
    \in@{i}{#1} \ifin@ \MathUp{i} \fi
    \in@{j}{#1} \ifin@ \MathUp{j} \fi
}

\newcommand*\MathProba[1]{%
    \in@{P}{#1} \ifin@ \MathUp{P} \fi
    \in@{E}{#1} \ifin@ \MathUp{E} \fi
    \in@{V}{#1} \ifin@ \MathUp{V} \fi
}

%    \end{macrocode}
% \DescribeMacro{\apply}
% With the inverse switch |\MathNormal|, you can apply the normal (italic) style 
% on any comma-separated list of characters. This is achieved using
% the |\apply| macro, \eg |\apply\macro{arg1,arg2}|
% expands to |\macro{arg1}\macro{arg2}|.
% Thus |\apply\MathUp{e,i,j}| is equivalent to |\MathUp{e}\MathUp{i}\MathUp{j}|.
% I discovered this powerfull macro on \texttt{iterate190.rssing.com} by searching for 
% ``TeX How to iterate over a comma separated list''.
% The answer was posted under the pseudonym `wipet' on 2021/02/26.
% Let its author, Petr Olšák, be thanked.
% This macro allows to accomplish tasks that
% usual loop instructions like |\@for| or |\foreach| cannot achieve due to
% errors like ``!~Improper alphabetic constant''.
% For instance, if you try |\def\letter{A} \MathUp{\letter}| it will fail
% because the control sequence |\letter| is not strictly
% equivalent here to the single character `A'.
%
% \medskip
%    \begin{macrocode}
\def\apply#1#2{\apply@#1#2,\apply@,}
\def\apply@#1#2,{\ifx\apply@#2\empty
    \else #1{#2}\afterfi@{\apply@#1}\fi}
\def\afterfi@#1#2\fi{\fi#1}

\newcommand*\MathNormal[1]{% list argument
    \apply\MathIt{#1} 
}

%    \end{macrocode}
%
% The following commands were used until version 2.2 but still work.
% They were intended to set some letters in upright shape
% in math mode, but only worked in the preamble.
% This is now managed by the more powerful |\MathUp| command, and
% the old commands are maintained for compatibility reasons.
% \medskip
%
%    \begin{macrocode}
\newcommand{\enumber}{%
    \PackageWarning{mismath}{Old command \string\enumber\space
        is used. \MessageBreak
        It can be replaced by \string\MathUp{e}}
    \MathUp{e}
}
\newcommand{\inumber}{%
    \PackageWarning{mismath}{Old command \string\inumber\space
        is used. \MessageBreak
        It can be replaced by \string\MathUp{i}}
    \MathUp{i}
}    
\newcommand{\jnumber}{
    \PackageWarning{mismath}{Old command \string\jnumber\space
        is used. \MessageBreak
        It can be replaced by \string\MathUp{j}}
    \MathUp{j}
}   
\newcommand{\PEupright}{
    \PackageWarning{mismath}{Old command \string\PEupright\space
        is used. \MessageBreak
        It can be replaced by \string\MathUp{P}\space 
        and \string\MathUp{E}}
    \MathUp{P}\MathUp{E}
}

%    \end{macrocode}
%
% Obtaining an upright Greek letter $\pi$ must be handled differently. 
% The switches are called |\pinumber| and |\pinormal|.
% When given without an argument, |\pinumber| uses the LGR font encoding.
% A particularity of the \textsf{fontenc} package is that it can be loaded 
% several times with different options without triggering an ``option clash'' error.
% This macro doesn't work with \textsf{unicode-math}, which provides
% the |\uppi| command but it cannot be redefined in |\pi|.
% \medskip
%    \begin{macrocode}
\newcommand*\pinumber[1][]{
    \ifmm@unicodemath
        \PackageError{mismath}{Command \string\pinumber\space 
            is incompatible with unicode-math. \MessageBreak
            Use \string\uppi\space to get the upright pi}{}
    \fi
    \@ifundefined{itpi}{\let\itpi\pi}{}
    \ifthenelse{\equal{#1}{}}{
      \ifx\@onlypreamble\@notprerr % not in preamble
        \@ifundefined{savedpi}{
            \PackageWarning{mismath}{%
                \string\pinumber\space without argument\MessageBreak
                must be used in the preamble first\MessageBreak
                to load LGR fontenc for upright pi}
        }{\let\pi\savedpi}
      \else % in the preamble
        \RequirePackage[LGR,T1]{fontenc}
        \DeclareSymbolFont{UpGr}{LGR}{lmr}{m}{n}
        \let\pi\relax 
        \DeclareMathSymbol{\pi}\mathalpha{UpGr}{"70}
        \let\savedpi\pi
      \fi
    }{
      \@ifundefined{#1}{
          \PackageWarning{mismath}{%
              #1 must be a valid command name\MessageBreak 
              for pinumber, but command \bslash #1
              is undefined.\MessageBreak
              Perhaps a missing package}
      }{\renewcommand{\pi}{% 
          \csname #1\endcsname}
      }
    }
} 

\newcommand{\pinormal}{\@ifundefined{itpi}{}{\let\pi\itpi}}

%    \end{macrocode}
%
% And now the commands for vectors (and tensors).
% \medskip
%    \begin{macrocode}
\newboolean{arrowvect}
\setboolean{arrowvect}{true}
\newcommand{\arrowvect}{\setboolean{arrowvect}{true}} 
\newcommand{\boldvect}{\setboolean{arrowvect}{false}}
\newcommand{\boldvectcommand}{\boldsymbol} % from amsbsy package
\mm@macro{vect}{\ifthenelse{\boolean{arrowvect}}{
        \vv}{\boldvectcommand}} % doesn't work well with \if... \fi
\newcommand*{\hvect}[1]{\vect{\vphantom{t}#1}}
\newcommand*{\hvec}[1]{\vec{\vphantom{t}#1}}

\newcommand*{\@norm}[1]{
    \mbox{\raisebox{1.75pt}{\small$\bigl\Vert$}} #1
    \mbox{\raisebox{1.75pt}{\small$\bigr\Vert$}} }
% works better than with relative length
\newcommand*{\@@norm}[1]{
    \mbox{\footnotesize\raisebox{1pt}{$\Vert$}} #1
    \mbox{\footnotesize\raisebox{1pt}{$\Vert$}} }
\newcommand*{\@@@norm}[1]{
    \mbox{\tiny\raisebox{1pt}{$\Vert$}} #1
    \mbox{\tiny\raisebox{1pt}{$\Vert$}} }
\@ifundefined{norm}{\providecommand*{\norm}[1]{
    \mathchoice{\@norm{#1}}{\@norm{#1}}{\@@norm{#1}}{\@@@norm{#1}} 
    }
}{\mm@warning{norm}} % bad result with libertinust1math

\newcommand{\tensor}{\mathbfsfit} % isomath uses \mathsfbfit

%    \end{macrocode}
%
% Classic identifiers are presented below.
% \medskip
%    \begin{macrocode}
\mm@macro{di}{\mathop{}\!\mathup{d}}
\newcommand\probastyle{}
\let\Par\P % end of paragraph symbol
\renewcommand{\P}{\operatorname{\probastyle{P}}}
\mm@macro{E}{\operatorname{\probastyle{E}}}
\mm@macro{V}{\operatorname{\probastyle{V}}}

\mm@operator{\adj}{adj}
\mm@operator{\Aut}{Aut}
\mm@operator{\codim}{codim}
\mm@operator{\Conv}{Conv}
\mm@operator{\cov}{cov}
\mm@operator{\Cov}{Cov}
\mm@macro{curl}{\operatorname{\vect{\mathup{curl}}}}
\mm@operator[divg]{\divg}{div}
\mm@operator{\End}{End}

\mm@operator{\erf}{erf}
\mm@macro{grad}{\operatorname{\vect{\mathup{grad}}}}
\mm@operator{\id}{id} % mathop or mathord?
\mm@operator{\Id}{Id}
\mm@operator{\im}{im}
\let\oldIm\Im \renewcommand{\Im}{\operatorname{Im}}
\mm@operator{\lb}{lb}
\mm@operator{\lcm}{lcm}

\mm@operator{\rank}{rank}
\let\oldRe\Re \renewcommand{\Re}{\operatorname{Re}}
\mm@macro{rot}{\operatorname{\vect{\mathup{rot}}}}
\mm@operator{\sgn}{sgn}
\mm@operator{\sinc}{sinc}
\mm@operator[spa]{\spa}{span}
\mm@operator{\tr}{tr}
\mm@operator{\var}{var}
\mm@operator{\Var}{Var}
\mm@operator[Zu]{\Zu}{Z}

\mm@operator{\arccot}{arccot}
\mm@operator{\sech}{sech}
\mm@operator{\csch}{csch}
\mm@operator{\arsinh}{arsinh}
\mm@operator{\arcosh}{arcosh}
\mm@operator{\artanh}{artanh}
\mm@operator{\arcoth}{arcoth}
\mm@operator{\arsech}{arsech}
\mm@operator{\arcsch}{arcsch}

\mm@operator[bigO]{\bigO}{\mathcal{O}}
\mm@operator[bigo]{\bigo}{O}
\mm@operator[lito]{\lito}{o}

%    \end{macrocode}
% And finally we present the remaining macros.
%
% With Cyrillic languages, the command |\C| may already be defined (only for text mode).
% Thus, it will not be redefined by \textsf{mismath}. However, one may still want
% to use our |\C| macro only for math mode without interfering the definition of 
% the text |\C|, therefore the |\onlymathC| macro. 
% \medskip
%    \begin{macrocode}
\mm@macro{mathset}{\mathbf}
\mm@macro{R}{\mathset{R}}
\mm@macro{C}{\mathset{C}}
\providecommand\onlymathC{\let\oldC\C 
    \renewcommand{\C}{\TextOrMath{\oldC}{\mathset{C}}} }
\mm@macro{N}{\mathset{N}}
\mm@macro{Z}{\mathset{Z}}
\mm@macro{Q}{\mathset{Q}}
\mm@macro{F}{\mathset{F}}
\mm@macro{K}{\mathset{K}}

\mm@macro{ds}{\displaystyle}
\mm@macro{dlim}{\lim\limits}
\mm@macro{dsum}{\sum\limits}
\mm@macro{dprod}{\prod\limits}
\mm@macro{dcup}{\bigcup\limits}
\mm@macro{dcap}{\bigcap\limits}

\mm@macro{lbar}{\overline}
\@ifundefined{hlbar}{
    \providecommand*{\hlbar}[1]{\overline{\vphantom{t}#1}}}{
    \mm@warning{hlbar} }
\newcommand\@eqdef{\stackrel{\mathup{def}}{=}}
\newcommand\@@eqdef{\stackrel{\mathrm{\Delta}}{=}}
\mm@macro{eqdef}{\@ifstar{\@@eqdef}{\@eqdef}}
\mm@macro{unbr}{\underbrace}
\mm@macro{iif}{if and only if\xspace}

%    \end{macrocode}
% Above, we have used |\mathrm| before |\Delta| in case of defining capital Greek letters
% in italics (for example with the \textsf{fixmath} package).
%
% The use of |\mbox{}| ensures that the space produced by |\| in the |\then| macro 
% is not suppressed in tables.
% \medskip
%    \begin{macrocode}
\mm@macro{then}{\ \Longrightarrow \ \mbox{} } 
\@ifundefined{txt}{
    \providecommand*{\txt}[1]{\quad\text{#1}\quad} }{
    \mm@warning{txt} }
\mm@macro{mul}{\mathord{\times}}
\@ifundefined{pow}{
    \providecommand*{\pow}[2]{\left( #1 \right)^{\!#2}} }{
    \mm@warning{pow} }
\@ifundefined{abs}{
    \providecommand*{\abs}[1]{\left\vert#1\right\vert} }{
    \mm@warning{abs} }
\@ifundefined{lfrac}{
    \providecommand*{\lfrac}[2]{\frac{\;#1\;}{\;#2\;}} }{
    \mm@warning{lfrac} }

\newcommand{\systemstretch}{1.2}
\newcommand{\systemsep}{\medspace}
\newenvironment{system}[1][l]{
    \renewcommand{\arraystretch}{\systemstretch}
    \setlength{\arraycolsep}{0.15em}
    \left\{\begin{array}{@{\systemsep}#1@{}} %
}{\end{array}\right.}

\newenvironment{spmatrix}{
    \left(\begin{smallmatrix}
}{\end{smallmatrix}\right)}

\newenvironment{mathcols}{% needs multicol package
  \ifmm@multicol
    \renewcommand{\columnseprule}{0.1pt}
    \begin{multicols}{2}
        \par\noindent\hfill
        \begin{math}\begin{aligned}\displaystyle
  \else
    \PackageError{mismath}{The mathcols environment
        needs the multicol package}{Add the package multicol
        to your preamble.}
  \fi
}{%
        \end{aligned}\end{math} \hfill\mbox{}
    \end{multicols}
}
\newcommand{\changecol}{%
    \end{aligned}\end{math} \hfill\mbox{}
    \par\noindent\hfill
    \begin{math}\begin{aligned}\displaystyle 
}   
%    \end{macrocode}
%
% \begin{thebibliography}{28}
% \begin{raggedright}
% \bibitem{TYPMA} \emph{Typesetting mathematics for science and technology according 
% to ISO 31/XI}, Claudio Beccari, TUGboat Volume 18 (1997), No.~1.
% \url{http://www.tug.org/TUGboat/tb18-1/tb54becc.pdf}.
% \bibitem{NIST} \emph{Typefaces for Symbols in Scientific Manuscripts},
% \url{https://www.physics.nist.gov/cuu/pdf/typefaces.pdf}.
% \bibitem{SI} \emph{Guide for the Use of the International System of Units (SI)},
% NIST (National Institute of Standards and Technology), updated March 4, 2020 
% \url{https://www.nist.gov/pml/special-publication-811}.
% \bibitem{ICTNS} \emph{On the Use of Italic and up Fonts for Symbols in Scientific Text},
% I.M.~Mills and W.V.~Metanomski, ICTNS (Interdivisional Committee 
% on Terminology, Nomenclature and Symbols), dec 1999,
% \url{https://old.iupac.org/standing/idcns/italic-roman_dec99.pdf}.
% \bibitem{VECT} \emph{\textsf{esvect}  -- Typesetting vectors with beautiful 
% arrow with \LaTeXe}, Eddie Saudrais, CTAN, v1.3 2013/07/11.
% \bibitem{AMS} \emph{\textsf{amsmath} -- \AmS\ mathmatical facilities for \LaTeX},
% Frank Mittelbach, Rainer Schöpf, Michael Downes, Davis M.~Jones, David Carlisle, 
% CTAN, v2.17n 2022/04/08.
% \bibitem{UNIC} \emph{Experimental Unicode mathematical typesetting: 
% The \textsf{unicode-math} package}, Will Robertson, Philipp Stephani, Joseph Wright, 
% Khaled Hosny, and others, CTAN, v0.8r 2023/08/13.
% \bibitem{TOOL} \emph{The \textsf{mathtools} package}, Morten Høgholm, Lars Madsen, CTAN,
% v1.29 2022/06/29.
% \bibitem{FIXM} \emph{The \textsf{fixmath} package for \LaTeXe}, Walter Schmidt, 
% CTAN, v0.9 2000/04/11.
% \bibitem{ISOM} \emph{\textsf{isomath} -- Mathematical style for science and technology},
% Günter Milde, CTAN, v0.6.1 2012/09/04.
% \bibitem{PMISO} \emph{\textsf{PM-ISOmath}, The Poor Man ISO math bundle}, 
% the \textsf{pm-isomath} package by Claudio Beccari, CTAN, v1.2.00 2021/08/04.
% \bibitem{GREEK} \emph{The \textsf{upgreek} package for \LaTeXe}, Walter Schmidt,
% CTAN, v2.0 2003/02/12.
% \bibitem{DESIGN} \emph{The \textsf{mathdesign} package},
% Paul Pichaureau, CTAN, v2.31 2013/08/29.
% \bibitem{ALPHA} \emph{The \textsf{textalpha} package}
% (part of the \textsf{greek-fontenc} bundle), Günter Milde, CTAN, v2.1 14/06/2022.
% \bibitem{KPF} \emph{\textsf{Kp-Fonts} -- The Johannes Kepler project},
% Christophe Caignaert, CTAN, v3.34 20/09/2022.
% \bibitem{FOUR} \textsf{Fourier-GUT\hspace{-0.1em}\emph{enberg}},
% Michel Bovani, CTAN, v1.3 30/01/2005.
% \bibitem{LGR} \emph{The \textsf{lgrmath} package}, Jean-François B., CTAN, v1.0 2022/11/16.
% \bibitem{INT} \emph{The \textsf{interval} package}, Lars Madsen, CTAN,
% v0.4 2019/03/06.
% \bibitem{ICOMMA} \emph{The \textsf{icomma} package for \LaTeXe},
% Walter Schmidt, CTAN, v2.0 2002/03/10.
% \bibitem{NCC} \emph{The \textsf{ncccomma} package}, Alexander I.~Rozhenko, 
% CTAN, v1.0 2005/02/10.
% \bibitem{DEC} \emph{The \textsf{decimalcomma} package}, Antoine Missier,
% CTAN, v1.4 2023/12/30.
% \bibitem{SYST} \emph{L'extension pour \TeX\ et \LaTeX\ \textsf{systeme}},
% Christian Tellechea, CTAN, v0.32 2019/01/13.
% \bibitem{SPAL} \emph{The \textsf{spalign} package}, Joseph Rabinoff, CTAN, 2016/10/05.
% \bibitem{NMATX} \emph{The package \textsf{nicematrix}}, François Pantigny, CTAN,
% v6.14 2023/02/18.
% \bibitem{FR} \emph{L'extension \textsf{frenchmath}}, Antoine Missier, CTAN, v2.8 2024/01/22.
% \bibitem{BRACKET} \emph{Intelligent brackets -- The \textsf{ibrackets} package},
% Antoine Missier, CTAN, v1.2, 2023/07/26.
% \bibitem{LSHORT} \emph{The Not So Short Introduction to \LaTeXe}, 
% the \textsf{lshort} package by
% Tobias Oetiker, Hubert Partl, Irene Hyna and Elisabeth Schlegl, CTAN, v6.4 2021/04/09.
% \url{http://tug.ctan.org/info/lshort/english/lshort.pdf}.
% \bibitem{COMP} \emph{The \LaTeX\ Companion}, Frank Mittelbach, Michel Goossens, 
% Johannes Braams, David Carlisle, Chris Rowley, 2nd edition, Pearson Education, 2004.
% \end{raggedright}
% \end{thebibliography}

% \Finale
\endinput