summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/mismath/mismath.dtx
blob: b7ffaeb874b13c1d6778cb454673c242d038e444 (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
% \iffalse meta-comment
%
% Copyright (C) 2019-2022 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}   
    [2022/11/11 v2.0 .dtx mismath file]
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%\usepackage{textcomp}
\usepackage[english]{babel}
\usepackage[charter]{mathdesign} % if changing font, modify 2.1 (3rd §)
\usepackage{mismath}
%\usepackage{amssymb} incompatible with mathdesign
\usepackage{multicol}
\usepackage[Euler]{upgreek}
%\enumber % commented because I need italicized e in vectors section
\inumber
\pinumber[piup]
% 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}
% For an example in this doc we substitute [ and ] by \OB and \CB:
\DeclareMathSymbol{\OB}\mathclose{operators}{093}
\DeclareMathSymbol{\CB}\mathopen{operators}{091}

\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{440}
%
% \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}
% \changes{v1.1}{2019/04/20}{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 @moperator macro, using mathup instead of mathrm}
% \changes{v1.2}{2019/04/27}{Added mathtools package, font definition Roman -> up, 
% changes in documentation, removing the PEroman macro}
% \changes{v1.3}{2019/05/05}{Using bslash in the internal @mwarning 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, addition of paren macro}
% \changes{v1.5}{2019/06/22}{small corrections in documentation}
% \changes{v1.6}{2019/09/06}{Removing mathfixs package}
% \changes{v1.7}{2019/12/27}{Adding a table of contents to the documentation}
% \changes{v1.8}{2020/11/15}{Incompatibility and solution mentioned when using i 
% with accent in beamer titles small changes in documentation}
% \changes{v1.9}{2020/10/17}{UpSh replaced by "operators" font in math mode, 
% PackageWarning "command exist" replaced by PackageWarningNoLine,
% and also used by commands with arguments, 
% medspace replaced by thickspace in the \bslash lfrac command,
% changing font in documentation, now Palatino (mathpazo)}
% \changes{v1.10}{2020/10/25}{\bslash pinumber command code adapted to avoid
% incompatibility with the new release of frenchmath, 
% default option (in upgreek) changed from Symbol to Euler.}
% \changes{v2.0}{2022/11/11}{pinumber command has been improved using by default
% LGR encoding, 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 (mathdesign).}
%
% \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 help in English translation.}}
% \author{Antoine Missier \\ \texttt{antoine.missier@ac-toulouse.fr}}
% \date{November 11, 2022}
%
% \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 if it is recommended to typeset vectors names 
% in bold italic style~\cite{NIST}~\cite{ICTNS}, 
% they are often represented with arrows 
% (particularly in school documents or in physics). 
% To draw pretty arrows above vectors, we use the \textsf{esvect} package 
% by Eddie Saudrais~\cite{VECT} 
% and we provide a few more macros related to vectors with arrows, 
% in particular to improve 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 provides other macros for:
% \begin{itemize}
% \item some standard operator names,
% \item a few useful aliases,
% \item improving some spacing in mathematical formulas,
% \item systems of equations and small matrices,
% \item displaymath in double columns for long calculation.
% \end{itemize}
%
% To avoid incompatibility,
% a large majority of our macros will be defined only 
% if there is not another command with the same name in the packages loaded 
% before \textsf{mismath}. If a macro is already defined,
% compilation will produce a warning message and \textsf{mismath} definition 
% will simply be ignored. To keep \textsf{mismath} command, 
% either load \textsf{mismath} before the other package 
% with which it is in conflict for the name of that command 
% (assuming the other package supports it), or use 
% |\let\|\meta{command}|\relax| before loading \textsf{mismath}.
%
% \medskip
% \DescribeEnv{\meta{options}}
% The \textsf{amsmath} package is loaded by \textsf{mismath} without option.
% For using \textsf{amsmath} with options (see~\cite{AMS}),
% these options can be added when calling \textsf{mismath}, or 
% \textsf{amsmath} has to be loaded 
% with the required options before \textsf{mismath}.
%
% Another package, 
% \textsf{mathtools} by Morten Høgholm and Lars Madsen~\cite{TOOL}
% is also loaded. It provides many useful macros.
%
% \medskip
% A recommendation, seldom observed, is to typeset uppercase Greek letters in italic shape 
% like other variables~\cite{ICTNS}. This is automatically done with the packages 
% \textsf{fixmath} by Walter Schmidt~\cite{FIXM}
% or \textsf{isomath} by Günter Milde~\cite{ISOM} and many others
% (for instance \textsf{mathpazo} or \textsf{mathptmx} with the option \texttt{slantedGreek}),
% but this feature is not implemented here because this rule is conflicting 
% to the one used in France where all mathematics capitals 
% have to be typeset in upright shape\footnote{The \textsf{frenchmath} package~\cite{FR} 
% takes this rule into account.}.
% The choice of loading or not one of these packages remains thus to the user.
%
% \section{Usage}
%
% \subsection{Mathematical constants}
%
% \DescribeMacro{\mathup} 
% \DescribeMacro{\e} \DescribeMacro{\i}  \DescribeMacro{\j} 
% As for classic functions identifiers, \emph{predefined} mathematical constants
% should be typeset in upright shape (generally in roman family), 
% even if this practice is not really common and tedious
% to respect. To avoid to stuff a document with |\mathrm{e}| or |\mathrm{i}|
% (or better |\mathup{e}| and |\mathup{i}|\footnote{\texttt{\bslash mathup}
% is based on \texttt{\bslash operatorfont} 
% (from \textsf{amsopn} package, automatically loaded by \textsf{amsmath}).
% The \textsf{beamer} 
% package uses a default sans serif math font, but \texttt{\bslash mathrm}
% produces a font with serif in \textsf{beamer}. This problem is solved by
% using \texttt{\bslash mathup} instead 
% of \texttt{\bslash mathrm}.}),
% the package provides |\e| command for the base of the natural logarithm
% and |\i| or |\j| for imaginary numbers. 
% Let's notice that |\i| and |\j| already exist in \LaTeX: 
% using in LR mode, they produce ``\extrafont{\i,\ \j}'' without the point, 
% so you can place accents on them, and in mathematical mode they produce 
% ``\texttt{LaTeX Warning: Command \bslash i invalid in math mode on input line} \meta{line}''. 
% Te new definition of |\i| and |\j| concerns only mathematical mode\footnote{Due to this
% \texttt{\bslash i} command redefinition, there is an incompatibility with
% \textsf{beamer} when using i with accents in beamer titles.
% A solution is to use the classic \texttt{\bslash \textasciicircum i} 
% command to produce î in beamer titles for example.}.
%
% \medskip
% \DescribeMacro{\enumber} \DescribeMacro{\inumber} \DescribeMacro{\jnumber}
% Nevertheless, it can be tiresome to type a lot of backslashes in a document 
% with many formulas containing $\e$ or $\i$.
% So a way is proposed here to free of it by placing |\enumber|, |\inumber| or |\jnumber|
% in the preamble: 
% $\e$, $i$ or $\j$ will then automatically be set in roman
% in the whole document, no need to type |\e|, |\i| or |\j|,
% let's hope that there are not many other $\mathit{e}$, $\mathit{i}$ or $j$ as variables.
% However, you can still get italicized
% $\mathit{e}$, $\mathit{i}$ or $\mathit{j}$ with \LaTeX\ command
% |\mathit| or |\mathnormal|. Of course, this does not fully comply with \LaTeX\ philosophy:
% in the document body, objects should be pointed out 
% by their nature rather than their typographical characteristics, 
% defined in the preamble. But these macros are really handy and 
% thanks to them it is possible to bring a document up to the standards 
% afterwards; moreover anyone is free to use them or not.
%
% \medskip
% \DescribeMacro{\pinumber\oarg{command}}
% The mathematical constant $\pi$  should also be typeset in upright shape 
% (see~\cite{TYPMA}, \cite{NIST}, \cite{ICTNS}), which differs from italicized $\itpi$. 
% This recommendation is even less observed than the one concerning  
% $\e$ and $\i$~\cite{TYPMA}.
% Several packages allow to typeset mathematical Greek letters in upright shape, 
% let us mention \textsf{upgreek}~\cite{GREEK}, \textsf{mathdesign}~\cite{DESIGN} 
% (used here), \textsf{kpfonts}, \textsf{fourier}, \textsf{libertinust1math},
% \textsf{pxgreeks}, \textsf{txgreeks}, \textsf{libgreek} etc.
% These packages provide commands like |\uppi| (\textsf{upgreek}), 
% |\piup| (\textsf{mathdesign}, \textsf{kpfonts}), 
% |\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 sloped lowercase Greek letters except for pi, and to
% avoid typing a lot of |\uppi| or |\piup|, we provide the |\pinumber| macro, 
% which has to be put in the preamble. This command redefines |\pi| to match
% the optional command given, for instance |piup|, assuming the appropriate
% package has been loaded before. 
%
% By activating |\enumer|, |\inumber| and |\pinumber[piup]| in the preamble,
% you can get for instance :
% \begin{center}
% |$e^{i\pi} = -1$| \enskip  \hspace{3em} \enskip $\e^{i\pi}=-1$.
% \end{center}
%
% When no argument is given, |\pinumber| defines |\pi| with an LGR encoding of Greek letters
% to produce $\mypi$. It looks the same as the one supplied with
% the \textsf{textalpha} package by Günter Milde~\cite{ALPHA}.
% This $\mypi$ is particularly suitable
% for use with the default Computer Modern or Latin Modern font\footnote{This 
% default $\mypi$ doesn't fit well with many text fonts, more bold than Computer Modern;
% the \textsf{upgreek} package~\cite{GREEK} provides often a better $\uppi$
% and it has also a \texttt{Symbol} option (using Adobe Symbol font) 
% that fits well with several text fonts, for instance Times.}.
%
% \DescribeMacro{\itpi}
% When |\pinumber| is activated, the original italic $\itpi$ is still available with |\itpi|.
%
% \subsection{Vectors}
%
% \DescribeMacro{\vect}
% By default, the |\vect| command\footnote{As for many macros of this package, 
% the definition will take effect only if this macro is not defined before 
% by another package.},
% produces vectors with arrows
% (thanks to the \textsf{esvect} package by Eddie Saudrais\footnote{\textsf{esvect} 
% provides \texttt{\bslash vv} macro used by \texttt{\bslash vect}.})
% which are much more elegant than those produced by \LaTeX\ |\overrightarrow| command 
% (giving $\overrightarrow{AB}$).
% The \textsf{esvect} package has an optional argument 
% (one letter between \texttt{a} and \texttt{h}) defining 
% the required type of arrow (see~\cite{VECT}).
% In \textsf{mismath}, \textsf{esvect} is loaded with the option \texttt{b}:
% |\vect{AB}| gives $\vect{AB}$.
% To choose another type of arrow, \textsf{esvect} must be called 
% with the required option \emph{before} \textsf{mismath}, 
% e.g.\@ |\usepackage[d]{esvect}|
% will give the arrows produced by default in~\cite{VECT}.
%
% \medskip 
% \DescribeMacro{\boldvect}
% The |\vect| macro allow to typeset vector's names using bold italic
% (according to ISO recommendation~\cite{NIST}~\cite{SI}) rather than arrows. 
% For this, calling |\boldvect| will modify the behavior of |\vect|,
% globally or locally, depending on where |\boldvect| is placed:\\[1ex]
% \begin{minipage}{8cm}
% \begin{verbatim} 
%\[ \boldvect \vect{v}
%   =\lambda\vect{e}_x+\mu\vect{e}_y. \]
% \end{verbatim}
% \end{minipage} 
% \begin{minipage}{6cm}
% $\boldvect \vect{v}=\lambda\vect{e}_x +\mu\vect{e}_y$.
% \end{minipage}
%
% \DescribeMacro{\boldvectcommand}
% By default |\boldvect| uses the |\boldsymbol| 
% command\footnote{\texttt{\bslash mathbf} gives upright bold font, 
% even if used in combination with \texttt{\bslash mathit}.}
% from \textsf{amsbsy} package, loaded by \textsf{amsmath}.
% But other packages producing bold italic can be preferred, e.g.\@
% \texttt{\bslash bm} from \textsf{bm} package or |\mathbold| from \textsf{fixmath}
% package or |\mathbfit| from \textsf{isomath}.
% For that, redefine |\boldvectcommand|, for instance: 
% \begin{center} |\renewcommand\boldvectcommand{\mathbold}|. \end{center}
%
% By setting |\boldvectcommand| to |\mathbf|, |\vect| produces vectors 
% in bold \emph{upright} shape, 
% which tends to be used instead of bold \emph{italic}
% (but probably for bad reasons).
%
% \medskip
% \DescribeMacro{\arrowvect}
% At any moment, you can get back to the default behavior with the inverse switch
% |\arrowvect|. These switches can be placed anywhere: 
% inside mathematical mode or inside an environment (with local effect) or outside 
% (with global effect).
%
% \medskip
% \DescribeMacro{\hvect}
% When vectors with arrows are typeset side by side,
% arrows can be set up a bit higher (with a vertical phantom box containing $t$) 
% to avoid inelegant effects:
% \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}
% The |\boldvect| switch has the same effect on |\hvect| than on |\vect|.
%
% \medskip 
% \DescribeMacro{\hvec}
% In a similar way, |\hvec| raises the little arrow produced by
% the \LaTeX\ command |\vec| (from height of $t$ letter):
% \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 classically produced by the delimiters |\lVert| and |\rVert|
% (rather than \texttt{\bslash}$\mid$) or |\left\Vert| and |\right\Vert| 
% for delimiters adapting to the content. Unfortunately, these delimiters 
% are always vertically centered, relatively to the middle of the base line, 
% whereas vectors with arrows are asymmetric objects, 
% the height above the middle of the base line
% being superior to the depth under it.
% The code |$\norm{\vec{h}}$| raises the double bar to produce $\norm{\vec{h}}$.
% Let's notice that the height of the bars don't adjust to content, 
% but however to context: main text, subscripts or exponents.
%
% \subsection{Standard operator names}
%
% \DescribeMacro{\di}
% The \emph{differential} operator should be typeset in upright shape and not in
% italic, to make it different from variables 
% (as mentioned in \cite{TYPMA}~\cite{NIST}~\cite{ICTNS}~\cite{LSHORT}).
% For this, we provide the |\di| command.
% See the following examples (notice the thin spaces before the d, 
% as for classic function's names): \\
% \begin{minipage}[t]{7cm}
% \begin{verbatim} 
%\[ \iint xy\di x\di y \]
% \end{verbatim}
% \end{minipage}
% \begin{minipage}{6cm}
% \[ \iint xy\di x\di y \]
% \end{minipage}
% \\
% \begin{minipage}[t]{7cm}
% \begin{verbatim} 
%\[ m\frac{\di^2x}{\di t^2}
%   + h\frac{\di x}{\di t} + kx = 0 \]
% \end{verbatim}
% \end{minipage}
% \begin{minipage}[t]{6cm}
% \[m\frac{\di^2x}{\di t^2}+h\frac{\di x}{\di t}+kx=0\]
% \end{minipage}
%
% This command can also stand for \emph{distance} (hence its name):
% \[\lambda\di(A,\mathcal{F})+\mu\di(B,\mathcal{H}).\]
%
% \DescribeMacro{\P} \DescribeMacro{\E} \DescribeMacro{\V}
% To refer to probability\footnote{\LaTeX\ provides 
% also \texttt{\bslash Pr} which gives $\Pr$.}
% and expectation the proper use is to typeset capital letters $\P$, $\E$ 
% in upright shape as for any standard function identifier.
% This is obtained with |\P| and |\E|.
% Variance is normally denoted by $\Var$ (see further),
% but in some countries we can find $\V$ produced by |\V|.
%
% \medskip
% \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{\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{As for
% \texttt{\bslash boldvect} and \texttt{\bslash arrowvect},
% effect is local to the container environment.}
% brings the previous ``openwork'' letters.
% |\mathbb| comes from \textsf{amsfonts} package
% (loaded by \textsf{amssymb} 
% but also available standalone)
% which has to be called in the preamble.
%
% \medskip
% The following operator names are also defined in \textsf{mismath}:
% \begin{center}
% \begin{tabular}{rlrlrl}
% |\adj| & $\adj$ \qquad\mbox{} & |\erf| & $\erf$ \qquad\mbox{} & |\rank| & $\rank$ \\
% |\Aut| & $\Aut$ & |\grad| & $\grad$ & |\Re| & $\Re$ \\
% |\Conv| & $\Conv$ & |\id| & $\id$ & |\rot| & $\rot$ \\
% |\cov| & $\cov$ & |\Id| & $\Id$ & |\sgn| & $\sgn$ \\
% |\Cov| & $\Cov$ & |\im| & $\im$ & |\spa| & $\spa$ \\
% |\curl| & $\curl$ & |\Im| & $\Im$ & |\tr| & $\tr$ \\
% |\divg| & $\divg$ & |\lb| & $\lb$ & |\Var| & $\Var$ \\
% |\End| & $\End$ & |\lcm| & $ \lcm$ & |\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 covariance and the identity function, 
% two notations are proposed, with or without a first capital letter, 
% because they are both very common.
% On the other hand, ``$\im$'' stands for the image of a linear transformation 
% (like ``$\ker$'' for the kernel)
% but ``$\Im$'' is the imaginary part of a complex number.
% Notice that |\div| and |\span| already exist
% and haven't been redefined, therefore the |\divg| and |\spa| macros;
% |\Z| is used otherwise (see further), therefore |\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$.
% They have been redefined according to actual use, as mentioned in the above table, 
% but it's still possible to get the old symbols with |\oldRe| and |\oldIm|.
%
% \medskip
% Some (inverse) circular or hyperbolic functions, missing
% in \LaTeX, are also provided by \textsf{mismath}:
% \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}
% 
% 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 blackboard~\cite{LSHORT};
% and likewise to designate a field: $\F$ or $\K$ (Körper in German).
% We get these symbols with the macros:
% \begin{center}
% |\R|, |\C|, |\Z|, |\N|, |\Q|, |\F|, |\K|.
% \end{center}
%
% \DescribeMacro{\mathset}
% The |\mathset| command enables 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, 
% just place |\renewcommand\mathset{\mathbb}| in the preamble,
% after loading \textsf{amsfonts} package (which provides the ``blackboard bold'' typeface,
% also loaded by \textsf{amssymb}).
%
% \medskip
% \DescribeMacro{\ds}
% The |\displaystyle| command being very common, alias |\ds| 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 put under or above whereas for in-line math mode, 
% they are placed on the right, as 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}.\]
%
% With in-line math mode, displaymath behavior can be forced with |\displaystyle|
% or its alias |\ds|, but then, all the rest of the current mathematical 
% environment will be set in displaymath mode too (in the previous example, 
% the fraction will be expanded).
% \DescribeMacro{\dlim} \DescribeMacro{\dsum} \DescribeMacro{\dprod}
% \DescribeMacro{\dcup} \DescribeMacro{\dcap}
% Just as the \textsf{amsmath} command |\dfrac|
% only transforms the required fraction in display style, we can limit 
% the display style effect to the affected symbol, by using the following macros:
% |\dlim|, |\dsum|, |\dprod|, |\dcup|, |\dcap|.
% So |$\dlim_{x\to +\infty}\frac{1}{x}$| gives $\dlim_{x \to +\infty}\frac{1}{x}$.
%
% \bigskip 
% \DescribeMacro{\lbar} \DescribeMacro{\hlbar}
% Large bars over expressions are obtained with |\overline|
% or, shorter, its alias |\lbar|, to get for instance $\lbar{z_1z_2}$.
% Such as for vectors, you can raise the bar (from the height of $h$) with
% the |\hlbar| command, in order 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}
% The |\eqdef| macro writes equality symbol topped with ``def''
% (thanks to the \LaTeX\ command |\stackrel|):\\
% \begin{minipage}[t]{8cm}
% \begin{verbatim} 
% $ \e^{\i\theta} \eqdef 
%   \cos\theta + \i\sin\theta $
% \end{verbatim}
% \end{minipage}
% \begin{minipage}{6cm}
% $\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 improved version of \texttt{\bslash underbrace} command
% (as many other usefull macros);
% it is loaded by \textsf{mismath}.}, making source code more compact.\\[2ex]
% \begin{minipage}{6.75cm}
% \begin{verbatim}
%$ (QAP)^n = \unbr{QAP\mul QAP\mul
%  \cdots\mul QAP}_{n\text{ times}} $
% \end{verbatim}
% \end{minipage}
% \begin{minipage}{6.5cm}
% $ (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{Improving some spacing in mathematical formulas}
%
% \DescribeMacro{\then} 
% The |\then| macro produces the symbol $\Longrightarrow$ surrounded by large spaces
% as the standard macro |\iff| does it with $\Longleftrightarrow$.
% In a similar way, |\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 than addition
% or subtraction operators, whereas division obtained with $/$ is closer to its operands.
% This actually hides the priority of the multiplication on $+$ and $-$.
% This is 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 get the same amount of space on the two sides of |\mul|, 
% you can use thin negative spaces |\!| 
% or enclose the function or the structure with brackets:
% \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 is little to far from the parenthesis.
% The command |\pow|\marg{expr}\marg{pow} sets
% \meta{expr} between parentheses and puts 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{may be better than} 
% \e^a \sim\left(1+\frac{a}{n}\right)^n.\]
%
% \DescribeMacro{\abs}
% Absolute value (or modular for a complex number) should be typeset with
% |\lvert| \ldots |\rvert| rather than $\mid$ which doesn't respect correct 
% spaces for delimiters; for bars whose height has to adapt to content, 
% we use |\left\vert| \ldots |\right\vert| or, more simply, 
% the |\abs|\{\ldots\} command which is equivalent\footnote{Another 
% solution is to define \texttt{\bslash abs} with the 
% \texttt{\bslash DeclarePairedDelimiter} command 
% from the \textsf{mathtool} package~\cite{TOOL}.}.
%
% \medskip
% \DescribeMacro{\lfrac}
% This macro behaves like |\frac|
% but with thick spaces around the arguments,
% so the corresponding fraction bar is perceptibly a little bit longer:\\
% \begin{minipage}[t]{8cm}
% \begin{verbatim}
%\[ \lbar{Z} = 
%   \lfrac{\lbar{z_1-z_2}}{\lbar{z_1+z_2}} \]
% \end{verbatim}
% \end{minipage}
% \begin{minipage}[t]{4cm}
% \[ \lbar{Z} = \lfrac{\lbar{z_1-z_2}}{\lbar{z_1+z_2}} \]
% \end{minipage}
%
% \DescribeMacro{[ ]}
% Open intervals may be represented with parenthesis but sometimes we find also
% brackets. In that case the space before them is often unsuitable.
% Brackets symbols $[$ and $]$ have been redefined for mathematical mode\footnote{We
% could also use the macro \texttt{\bslash DeclarePairedDelimiters} from
% the \textsf{mathtools} package ; let us also mention
% the \textsf{interval} package~\cite{INT} with his
% \texttt{\bslash interval} macro.}:
% \begin{center}
% |$x\in ]0,\pi[ \cup ]2\pi,3\pi[$| \\[1ex]
% $\begin{cases}
% x\in \OB 0,\pi \CB \cup \OB2\pi, 3\pi \CB &\text{ without \textsf{mismath}}\\
% x\in ]0, \pi[ \cup ]2\pi, 3\pi[ &\text{ with \textsf{mismath}}
% \end{cases}$
% \end{center}
% In our code, $[$ and $]$  symbols are not defined anymore as delimiters. 
% Thereby a line break could occur between the two brackets, but
% it is always possible to transform them 
% into delimiters with |\left| and |\right|.
% Another problem occurs when the left boundary contains an operator sign ;
% the spaces surrounding the operator will then be too large :
% |$[-1, 1]$| yields $[-1, 1]$ instead of $[{-1}, 1]$\footnote{A problem pointed out
% by J.F.\@ Burnol, which does not detract from the interest of this redefinition.}.  
% To get correct spaces, we have to surround
% the sign $-$ or $-1$ by braces, or use |\left| and |\right|.
%
% \subsection{Environments for systems of equations and small matrices}
%
% \DescribeEnv{system}
% The \texttt{system} environment produces a system of equations:\\
% \begin{minipage}[t]{6.5cm}
% \begin{verbatim}
%$\begin{system} 
%    x=1+2t \\ y=2-t \\ z=-3-t 
%\end{system}$
% \end{verbatim}
% \end{minipage}
% \begin{minipage}[t]{5cm} 
% \[ \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 produced with \texttt{cases} environment
% from \textsf{amsmath} package, although \texttt{cases} places mathematical expressions 
% closer to the bracket (which makes sense considering it's use).
% |\systemsep| enables to set the gap between the bracket and the expressions, 
% set by default to |\medspace|. This gap may be reduced, for instance:
% |\renewcommand{\systemsep}{\thinspace}|,
% or enlarged with |\thickspace| (and with |\renewcommand\systemsep}{}|
% we obtain what \texttt{cases} do).
%
% \medskip
% \DescribeEnv{system\oarg{coldef}}
% By default, a system is written like an \texttt{array} environment with only one column, 
% left aligned. The environment has an optional argument to create several columns,
% specifying their alignment, with the same syntax than the \texttt{array} environment of
% \LaTeX : |\begin{system}[cl]| produces a two-column system, the first one being centered, 
% the second being left aligned, such as in the following example:\\
% \begin{minipage}[t]{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}[t]{5cm}
% \[ \begin{system}[cl] y&=\dfrac{1}{2}x-2 \\[1ex] (x,y)&\neq (0,-2) \end{system}\]
% \end{minipage}
%
% \DescribeMacro{\systemstretch}
% Default spacing between the lines of a \texttt{system} environment has been slightly 
% enlarged compared to the one from \texttt{array} environments (from 1.2 factor). 
% This spacing may be changed by typing |\renewcommand{\systemstretch}|\marg{stretch},
% inside the current mathematical environment (for a local change) or outside 
% (for a global change). By default, stretch's value is 1.2.
% In addition we can use the end of line with a spacing option such 
% as it has been done above with |\\[1ex]|.
%
% 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 mention the \textsf{systeme} package~\cite{SYST} which deals with linear systems
% with a lighter syntax and automatic alignments on $+$, $-$, $=$,
% and also the \textsf{spalign} package~\cite{SPAL} which moreover produces nice alignments 
% for matrices (with spaces and semi­colons as de­lim­iters).
%
% \medskip
% \DescribeEnv{spmatrix}
% The \textsf{amsmath} package provides various environments to typeset matrices: 
% for instance \texttt{pmatrix} surrounds the matrix with parenthesis
% or \texttt{smallmatrix} typesets a small matrix that can even be inserted 
% in a text line. We provide a combination of the two with \texttt{spmatrix}:\\
% |$\vec{u}\begin{spmatrix}-1\\2\end{spmatrix}$| yielding
% $\vec{u}\begin{spmatrix}-1\\2\end{spmatrix}$.
%
% The \textsf{mathtools} package enhance \textsf{amsmath} matrices environments
% and provides also a small matrix environment with parenthesis.
% Furthermore, with starred version |\begin{psmallmatrix*}|\oarg{col},
% you can choose the alignment inside the columns (\texttt{c}, \texttt{l} or \texttt{r}).
% But sadly, the space before the left parenthesis is too narrow
% regarding to the space inside the parenthesis.
% Compare previous $\vec{u}\begin{spmatrix}-1\\2\end{spmatrix}$
% with $\vec{u}\begin{psmallmatrix}-1\\2\end{psmallmatrix}$.
%
% \subsection{Displaymath in double columns}
%
% \DescribeEnv{mathcols}
% The \texttt{mathcols} environment activates mathematical mode and enables to arrange 
% ``long''calculation in double columns, separated with a central rule, 
% as shown in the following example.
% But you have to load the \textsf{multicol} package in the preamble.
% \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 causes a change of column;
% alignment is produced using the classic delimiters |&| and |\\|.
% 
% \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}
%
% \StopEventually{}
% \section{Implementation}
%
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{amsmath}}
\ProcessOptions \relax
\@ifpackageloaded{amsmath}{}{\RequirePackage{amsmath}}
\@ifpackageloaded{esvect}{}{\RequirePackage[b]{esvect}}
\RequirePackage{ifthen}
\RequirePackage{xspace}
\RequirePackage{mathtools}
%    \end{macrocode}
% The above conditional packages loading avoids ``option clash'' errors if the packages 
% have been previously loaded with (other) options.
%
% \medskip
% The three following internal commands are meta commands for a
% conditional macro definition with a warning message if the macro already exists.
% \DescribeMacro{\bslash}
% The |\bslash| macro comes from \textsf{doc.sty} package by Frank Mittelbach. 
% It can also be used in other documents instead of |\textbackslash|
% (which doesn't work here).
%    \begin{macrocode}
{\catcode`\|=\z@ \catcode`\\=12 |gdef|bslash{\}} % \bslash command
\newcommand\@mwarning[1]{
    \PackageWarningNoLine{mismath}{
        Command \bslash #1 already exist and will not be redefined}
}
\newcommand\@mmacro[2]{
    \@ifundefined{#1}{
        \expandafter\def\csname #1\endcsname{#2}
    }{\@mwarning{#1}}
}
\newcommand\@moperator[3][]{% this macro is ugly, by default #1=#3
    \ifthenelse{\equal{#1}{}}{
        \@ifundefined{#3}{
            \DeclareMathOperator{#2}{#3}
        }{\@mwarning{#3}}
    }{
        \@ifundefined{#1}{
            \DeclareMathOperator{#2}{#3}
        }{\@mwarning{#1}}
    } 
}
    
%    \end{macrocode}
%
% To produce the correct upright shape font even when working 
% with the \textsf{beamer} package, we did not use |\mathrm|
% but |\mathup| (based on |\operatorfont| from the \textsf{amsopn} package).
% This command works also fine with other sans serif fonts like \textsf{cmbright}.
% Moreover for \textsf{beamer}, |\enumber| must be typeset in
% the family default font (sans serif),
% therefore the |\AtBeginDocument| inside the macro (otherwise it has no effect).
% The same holds for |\inumber| and |\jnumber|.
%
% |\AtBeginDocument| is also necessary to redefine |\i| when calling 
% the \textsf{hyperref} package which overwrites the |\i| definition.
%
% \medskip
%    \begin{macrocode}
\providecommand{\mathup}[1]{{\operatorfont #1}} % also in kpfonts
\@mmacro{e}{\mathup{e}}
\AtBeginDocument{\let\oldi\i \let\oldj\j
    \renewcommand{\i}{\TextOrMath{\oldi}{\mathup{i}}}
    \renewcommand{\j}{\TextOrMath{\oldj}{\mathup{j}}} }

\newcommand{\enumber}{
    \AtBeginDocument{\DeclareMathSymbol{e}\mathalpha{operators}{`e}}}
\newcommand{\inumber}{
    \AtBeginDocument{\DeclareMathSymbol{i}\mathalpha{operators}{`i}}}
\newcommand{\jnumber}{
    \AtBeginDocument{\DeclareMathSymbol{j}\mathalpha{operators}{`j}}}
\newcommand*{\pinumber}[1][defaultpi]{
    \@ifundefined{itpi}{\let\itpi\pi}{\@mwarning{itpi}}
    \ifthenelse{\equal{#1}{defaultpi}}{
        \usepackage[LGR,T1]{fontenc}
        \DeclareSymbolFont{UpGr}{LGR}{lmr}{m}{n}
        \DeclareMathSymbol{\pi}\mathalpha{UpGr}{"70}
    }{
        \@ifundefined{#1}{
            \PackageWarningNoLine{mismath}{
                \bslash pinumber command has changed since v2.0, 
                \MessageBreak
                option #1 must be a command name \MessageBreak
                (look at the documentation),
                but command \bslash #1 is undefined, \MessageBreak
                I cannot use it for replacement to \bslash pi.
                \MessageBreak
                Perhaps a missing package}       
            }{\renewcommand{\pi}{\csname #1\endcsname}}
    }
}

\newboolean{arrowvect}
\setboolean{arrowvect}{true}
\newcommand{\arrowvect}{\setboolean{arrowvect}{true}} 
\newcommand{\boldvect}{\setboolean{arrowvect}{false}}
\newcommand{\boldvectcommand}{\boldsymbol} % from amsbsy package
\@mmacro{vect}{\ifthenelse{\boolean{arrowvect}}{
        \vv}{\boldvectcommand}}
\newcommand*{\hvect}[1]{\vect{\vphantom{t}#1}}
\newcommand*{\hvec}[1]{\vec{\vphantom{t}#1}}

\newcommand*{\@norm}[1]{
    \mbox{\raisebox{1.75pt}{$\bigl\Vert$}} #1
    \mbox{\raisebox{1.75pt}{$\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}} 
        }
    }{\@mwarning{norm} } % bad result with libertinust1math

\@mmacro{di}{\mathop{}\!\mathup{d}}
\newcommand\probastyle{}
\let\Par\P % end of paragraph symbol
\renewcommand{\P}{\operatorname{\probastyle{P}}}
\@mmacro{E}{\operatorname{\probastyle{E}}}
\@mmacro{V}{\operatorname{\probastyle{V}}}
\newcommand{\PEupright}{
    \AtBeginDocument{% necessary for working with beamer
        \DeclareMathSymbol{P}\mathalpha{operators}{`P}
        \DeclareMathSymbol{E}\mathalpha{operators}{`E}
    }
}

\@moperator{\adj}{adj}
\@moperator{\Aut}{Aut}
\@moperator{\Conv}{Conv}
\@moperator{\cov}{cov}
\@moperator{\Cov}{Cov}
\@mmacro{curl}{\operatorname{\vect{\mathup{curl}}}}
\@moperator[divg]{\divg}{div}
\@moperator{\End}{End}

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

\@moperator{\rank}{rank}
\let\oldRe\Re \renewcommand{\Re}{\operatorname{Re}}
\@mmacro{rot}{\operatorname{\vect{\mathup{rot}}}}
\@moperator{\sgn}{sgn}
\@moperator[spa]{\spa}{span}
\@moperator{\tr}{tr}
\@moperator{\Var}{Var}
\@moperator[Zu]{\Zu}{Z}

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

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

\@mmacro{mathset}{\mathbf}
\@mmacro{R}{\ensuremath{\mathset{R}}\xspace} 
\@mmacro{C}{\ensuremath{\mathset{C}}\xspace}
\@mmacro{N}{\ensuremath{\mathset{N}}\xspace}
\@mmacro{Z}{\ensuremath{\mathset{Z}}\xspace}
\@mmacro{Q}{\ensuremath{\mathset{Q}}\xspace}
\@mmacro{F}{\ensuremath{\mathset{F}}\xspace}
\@mmacro{K}{\ensuremath{\mathset{K}}\xspace}

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

\@mmacro{lbar}{\overline}
\@ifundefined{hlbar}{
    \providecommand*{\hlbar}[1]{\overline{\vphantom{t}#1}}}{
    \@mwarning{hlbar} }
\@mmacro{eqdef}{\stackrel{\mathup{def}}{=}}
\@mmacro{unbr}{\underbrace}
\@mmacro{iif}{if and only if\xspace}

\@mmacro{then}{\ \Longrightarrow \ \mbox{} } 
%    \end{macrocode}
% Without |\mbox{}|, the space produced by |\| would be suppressed in tables.
% \medskip
%    \begin{macrocode}
\@ifundefined{txt}{
    \providecommand*{\txt}[1]{\quad\text{#1}\quad} }{
    \@mwarning{txt} }
\@mmacro{mul}{\mathord{\times}}
\PackageWarningNoLine{mismath}{Command \bslash paren 
    is no longer supported}
\@ifundefined{pow}{
    \providecommand*{\pow}[2]{\left( #1 \right)^{\!#2}} }{
    \@mwarning{pow} }
\@ifundefined{abs}{
    \providecommand*{\abs}[1]{\left\vert#1\right\vert} }{
    \@mwarning{abs} }
\@ifundefined{lfrac}{
    \providecommand*{\lfrac}[2]{\frac{\;#1\;}{\;#2\;}} }{
    \@mwarning{lfrac} }
\DeclareMathSymbol{]}\mathord{operators}{093} % originally \mathclose
\DeclareMathSymbol{[}\mathord{operators}{091} % originally \mathopen

\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
    \renewcommand{\columnseprule}{0.1pt}
    \begin{multicols}{2}
        \par\noindent\hfill
        \begin{math}\begin{aligned}\displaystyle
}{%
        \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}
% \bigskip
% \begin{thebibliography}{17}
% \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{Typesetting vectors with beautiful arrow with \LaTeXe}.
% \textsf{esvect} package by Eddie Saudrais, CTAN, v1.3 2013/07/11.
% \bibitem{AMS} \emph{The \textsf{amsmath} package}. Frank Mittelbach, Rainer Schöpf, 
% Michael Downes, Davis M.~Jones, David Carlisle, CTAN, v2.17b 2018/12/01.
% \bibitem{TOOL} \emph{The \textsf{mathtool} package}. Morten Høgholm, Lars Madsen, CTAN,
% v1.21 2018/01/08.
% \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}, 
% \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{INT} \emph{The \textsf{interval} package}. Lars Madsen, CTAN,
% v0.4 2019/03/06.
% \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{FR} \emph{L'extension \textsf{frenchmath}}. Antoine Missier, CTAN, v2.1 2022/11/11.
% \bibitem{LSHORT} \emph{The Not So Short Introduction to \LaTeXe}. \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