% \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}   
    [2023/01/06 v2.2 .dtx mismath file]
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%\usepackage{textcomp}
\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[Euler]{upgreek}
\usepackage{sectsty}
\usepackage{xcolor}

\definecolor{darkbrown}{rgb}{0.5,0.1,0.1}
\allsectionsfont{\color{darkbrown}}
%\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}

\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{459}
%
% \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 @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 -> 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 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)}
%
% \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.}
%
% \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{January 6, 2023}
%
% \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$ (and even ugly with Latin Modern font family).
% 
% \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 and improvements of \textsf{amsmath} package.
%
% \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},
% \textsf{isomath} by Günter Milde~\cite{ISOM} 
% or \textsf{pm-isomath} by Claudio Beccari~\cite{PMISO} and optionally with 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}~\cite{KPF}, \textsf{fourier}~\cite{FOUR},
% \textsf{libertinust1math},
% \textsf{pxgreeks}, \textsf{txgreeks}, \textsf{libgreek}, etc.
% A special mention to \textsf{lgrmath} of Jean-François Burnol~\cite{LGR}
% which allow to use, in math mode, any Greek LGR-encoded font.
% 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 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
% Günter Milde's \textsf{textalpha} package~\cite{ALPHA}.
% This $\mypi$ is particularly suitable
% for use with the default Computer Modern or Latin Modern font family\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 of Eddie Saudrais\footnote{\textsf{esvect} 
% provides \texttt{\bslash vv} macro used by \texttt{\bslash vect}.})
% which are more elegant than those produced by \LaTeX's |\overrightarrow| command.
% 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 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, 
% e.g. $\e^{\norm{\vec{h}}}$.
%
% \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{\PEupright} \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 roman as for any standard function identifier.
% This is obtained with |\P| and |\E|.
% In the same way as for $\i$ and $\j$, you can use |\PEupright| in the preamble 
% to avoid typing many |\P| or |\E|. 
% Variance is generally denoted by $\var$ or $\Var$ (see table below),
% but some authors prefer to use $\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 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 they are both 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.
% Notice that |\div| already exist ($\div$) and |\span| is a \TeX\ primitive
% (used in |\multicolumn|);
% they haven't been redefined, therefore the macros |\divg| (divergence) 
% and |\spa| (span of a set of vectors) ;
% |\Z| is used for the set of integers (see \ref{aliases}), therefore 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$.
% 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} \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 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}| where you want, for instance 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}.\]
%
% \DescribeMacro{\dlim} \DescribeMacro{\dsum} \DescribeMacro{\dprod}
% \DescribeMacro{\dcup} \DescribeMacro{\dcap}
% 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).
% 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} \DescribeMacro{\eqdef*}
% The |\eqdef| macro writes equality symbol topped with ``def''
% or with ``$\scriptstyle \Delta$'' for |\eqdef*|
% (thanks to the \LaTeX\ command |\stackrel|): 
%
% \noindent\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}{7.5cm}
% \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{Improved 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 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 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{[ibrackets]}
% Open intervals are usually represented with parenthesis, e.g.\@ $(0, +\infty)$,
% but sometimes we find also
% square brackets, for example in French mathematics.
% In that case the space around them is often unsuitable, 
% e.g.\@ $x \in \mathclose{]} 0, +\infty[$.
%
% We have redefine brackets in the \textsf{ibrackets} package~\cite{BRACKET} 
% which can be optionally\footnote{This functionality is optional because it causes
% error when using a command defined by \texttt{\bslash DeclarePairedDelimiter}~\cite{TOOL}
% with square brackets.}
% loaded by \textsf{mismath}.
% Simply type |$x\in ]-\pi,0[ \cup ]2\pi,3\pi[$| to get
% \begin{align*} 
% x\in ]-\pi, 0[ \cup ]2\pi, 3\pi[ &\mbox{\quad with \textsf{ibrackets}}, \\
% \mbox{instead of \quad}
% x\in \mathclose{]}-\pi, 0 \mathopen{[} \cup \mathclose{]} 2\pi, 3\pi \mathopen{[} 
% &\mbox{\quad without \textsf{ibrackets}}.
% \end{align*}
% In our code, $[$ and $]$  symbols become ``active'' 
% and are not defined by default 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|.
%
% With \textsf{ibrackets}: a bracket becomes an ordinary character 
% but an open delimiter when it is immediately followed by a + or - character.
% Thus, 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:
% e.g.\@ |$x \in ] -\infty, 0]$| yields $x \in  ] -\infty, 0]$.
% Contrariwise, when you want to write algebra on intervals then
% \emph{you must leave a blank space between the second bracket and the} +/- 
% \emph{operations},
% e.g.\@ |$[a, b] + [c, d]$| yields $[a, b] + [c, d]$
% but |$[a, b]+ [c, d]$| yields $[a, b]+ [c, d]$.
%
% Let us also mention other approaches with the |\interval| macro
% from the \textsf{interval} package~\cite{INT},
% or |\DeclarePairedDelimiters| from the \textsf{mathtool} package~\cite{TOOL}
% (but the latter is incompatible with \textsf{ibrackets}
% for brackets management).
%
% \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}
\RequirePackage{ifthen}
\newboolean{ibrackets}
\DeclareOption{ibrackets}{\setboolean{ibrackets}{true}}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{amsmath}}
\ProcessOptions \relax
\@ifpackageloaded{amsmath}{}{\RequirePackage{amsmath}}
\@ifpackageloaded{esvect}{}{\RequirePackage[b]{esvect}}
\RequirePackage{xspace}
\RequirePackage{mathtools}
\ifthenelse{\boolean{ibrackets}}{\RequirePackage{ibrackets}}{}

%    \end{macrocode}
% The above conditional packages loading avoids ``option clash'' errors if the packages 
% have been previously loaded with other options.
%
% \medskip
% \DescribeMacro{\bslash}
% The |\bslash| macro comes from Frank Mittelbach's \textsf{doc.sty} package. 
% It can also be used in other documents instead of |\textbackslash|
% (which doesn't work inside warnings).
%    \begin{macrocode}
{\catcode`\|=\z@ \catcode`\\=12 |gdef|bslash{\}} % \bslash command

%    \end{macrocode}
% \medskip
% \DescribeMacro{\@mwarning} \DescribeMacro{\@mmacro} \DescribeMacro{\@moperator} 
% The three following internal macros are meta commands for a
% conditional macro definition with a warning message if the macro already exists.
% They could be useful in other packages.
%    \begin{macrocode}
\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 valid 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}{\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}} 
        }
    }{\@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{\codim}{codim}
\@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{\sinc}{sinc}
\@moperator[spa]{\spa}{span}
\@moperator{\tr}{tr}
\@moperator{\var}{var}
\@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} }
\newcommand\@eqdef{\stackrel{\mathup{def}}{=}}
\newcommand\@@eqdef{\stackrel{\Delta}{=}}
\@mmacro{eqdef}{\@ifstar{\@@eqdef}{\@eqdef}}
\@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}}
\providecommand\paren{\PackageWarning{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} }

\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}{23}
% \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{TOOL} \emph{The \textsf{mathtool} 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{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.3 2022/12/26.
% \bibitem{BRACKET} \emph{Intelligent brackets -- The \textsf{ibrackets} package}
% Antoine Missier, CTAN, v1.0, 2022/12/19.
% \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
