From ada48533443e464235c29c5b9a4809dbdf703728 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 20 Feb 2024 21:06:29 +0000 Subject: mismath (20feb24) git-svn-id: svn://tug.org/texlive/trunk@70023 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/mismath/mismath.dtx | 383 +++++++++++++-------- Master/texmf-dist/source/latex/mismath/mismath.ins | 4 +- 2 files changed, 239 insertions(+), 148 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/mismath/mismath.dtx b/Master/texmf-dist/source/latex/mismath/mismath.dtx index 1d601eff841..b40e0d7211b 100644 --- a/Master/texmf-dist/source/latex/mismath/mismath.dtx +++ b/Master/texmf-dist/source/latex/mismath/mismath.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2019-2023 by Antoine Missier +% Copyright (C) 2019-2024 by Antoine Missier % % This file may be distributed and/or modified under the conditions of % the LaTeX Project Public License, either version 1.3 of this license @@ -20,7 +20,7 @@ %<*package> \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{mismath} - [2023/12/19 v2.9 .dtx mismath file] + [2024/02/20 v2.10 .dtx Miscellaneous mathematical macros] % %<*driver> \documentclass{ltxdoc} @@ -69,7 +69,7 @@ % % \fi % -% \CheckSum{631} +% \CheckSum{691} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -201,13 +201,18 @@ % - New option decimalcomma % - Some small changes in the documentation} % +% \changes{v2.10}{2024/02/19}{ +% - Better compatibility with unicode-math: +% for the options ibrackets, decimalcomma and the commands MathUp, MathIt +% - Explicit error message when using mathcols without loading the multicol package} +% % \GetFileInfo{mismath.sty} % % \title{\textsf{mismath}\\ Miscellaneous mathematical macros\thanks{This document % corresponds to \textsf{mismath}~\fileversion, dated \filedate. -% Thanks to François Bastouil for help in English translation.}} +% Thanks to François Bastouil for initial help in English translation.}} % \author{Antoine Missier \\ \texttt{antoine.missier@ac-toulouse.fr}} -% \date{December 19, 2023} +% \date{February 20, 2024} % % \maketitle % \tableofcontents @@ -248,18 +253,19 @@ % if there isn't already a command with the same name in the packages loaded % before \textsf{mismath}. If a macro is already defined, % a warning message will be displayed and the \textsf{mismath} definition -% will be ignored. If you wish to keep the existing command or the \textsf{mismath} command, +% will be ignored. If you wish to keep the \textsf{mismath} or the existing command, % you can use |\let\|\meta{command}|\relax|, before loading \textsf{mismath}, or after. -% If the other command is defined with |\AtBeginDocument|, you should do the same for -% |\let\|\meta{command}|\relax| and for loading mismath. % % \medskip % \DescribeEnv{\oarg{options}} -% The \textsf{mismath} package loads the \textsf{amsmath} package without any options. -% If you want to use \textsf{amsmath} with specific options (refer to~\cite{AMS}), +% The \textsf{mismath} package loads the \textsf{amsmath} package~\cite{AMS} +% without any options. +% If you want to use \textsf{amsmath} with specific options (refer to its documentation), % you can include these options when calling \textsf{mismath}, or % you can load \textsf{amsmath} % with the desired options before loading \textsf{mismath}. +% \emph{When using the package \textsf{unicode-math}~\cite{UNIC}, \textsf{mismath} +% must be loaded before \textsf{unicode-math}}, just like \textsf{amsmath}. % % \medskip % In addition \textsf{mismath} loads the \textsf{mathtools} package @@ -269,17 +275,18 @@ % \medskip % A recommendation, although rarely followed, is to typeset uppercase % Greek letters in italic shape, -% similar to other variables~\cite{ICTNS}. This can be automatically achieved with packages +% similar to other variables~\cite{ICTNS}. This can be automatically achieved, +% for some particular fonts, with packages % such as \textsf{fixmath} by Walter Schmidt~\cite{FIXM}, -% \textsf{isomath} by Günter Milde~\cite{ISOM} +% \mbox{\textsf{isomath}} by Günter Milde~\cite{ISOM} % or \textsf{pm-isomath} by Claudio Beccari~\cite{PMISO} and optionally with many others % (such as \textsf{mathpazo} or \textsf{mathptmx} with the option \texttt{slantedGreek}). % However this feature is not implemented here due to a conflicting rule in France, % where all capital letters in mathematics % are required to be typeset in upright shape -% \footnote{By using the \textsf{frenchmath} package~\cite{FR}, -% you can ensure that the recommended French rule is followed in your document.}. -% The decision to load any of these packages is left to the user's discretion. +% \footnote{The \textsf{frenchmath} package~\cite{FR} +% ensures to follow the recommended French rules.}. +% ^^A The decision to load any of these packages is left to the user's discretion. % % \section{Usage} % @@ -291,12 +298,12 @@ % even though this practice is not very common and can be tedious % to adhere to. A first solution is to use the |\mathup| macro, % which is superior to |\mathrm| -% \footnote{The \texttt{\bslash mathup} macro is based on \texttt{\bslash operatorfont}, +% \footnote{The \texttt{\string \mathup} macro is based on \texttt{\string \operatorfont}, % which comes from the % \textsf{amsopn} package, automatically loaded by \textsf{amsmath}. % In \textsf{beamer}, the default math font is sans serif, -% but \texttt{\bslash mathrm} produces a font with serifs, which might not match the -% overall style of the presentation. Hence, using \texttt{\bslash mathup} is indeed +% but \texttt{\string \mathrm} produces a font with serifs, which might not match the +% overall style of the presentation. Hence, using \texttt{\string \mathup} is indeed % a better choice in \textsf{beamer} presentations to ensure that mathematical % constants are typeset in upright shape and consistent % with the default sans serif math font.}, @@ -312,7 +319,7 @@ % Let us notice that |\i| and |\j| already exist in LaTeX. In LR (left-to-right) mode, % they produce `\extrafont{\i,\ \j}' without the dot, allowing you to place accents on them. % However, in mathematical mode, they produce the warning -% ``\texttt{LaTeX Warning: Command \bslash i invalid in math mode on input line} +% ``\texttt{LaTeX Warning: Command \string \i\space invalid in math mode on input line} % \meta{line}''. % With the new definition provided by the package, |\i| and |\j| will be redefined % specifically for mathematical mode. @@ -365,9 +372,15 @@ % concerning $\e$ and $\i$~\cite{TYPMA}. % Several packages enable the typesetting of mathematical Greek letters in upright shape. % Notably, let us mention \textsf{upgreek}~\cite{GREEK}, \textsf{mathdesign}~\cite{DESIGN} -% (used in the present document), \mbox{\textsf{kpfonts}}~\cite{KPF}, \textsf{fourier}~\cite{FOUR}, +% (used in the present document), \mbox{\textsf{kpfonts}}~\cite{KPF}, +% \textsf{fourier}~\cite{FOUR}, % \textsf{libertinust1math}, -% \textsf{pxgreeks}, \textsf{txgreeks}, \textsf{libgreek}, etc. +% \textsf{pxgreeks}, \textsf{txgreeks} +% \footnote{When using \textsf{pxgreeks} or \textsf{txgreeks}, +% they should be loaded \emph{after} \textsf{mismath} to avoid an error +% due to conflict with the existing macros \texttt{\string\iint}, \texttt{\string\iiint}, +% \texttt{\string\iiiint}, \texttt{\string\idotsint} in \textsf{amsmath}.}, +% \textsf{libgreek}, etc. % A special mention goes to \textsf{lgrmath} of Jean-François Burnol~\cite{LGR} % which allows the use of any Greek LGR-encoded font in math mode. % These packages provide commands like |\uppi| (\textsf{upgreek}), @@ -381,7 +394,11 @@ % macro |\pinumber|[\meta{command}]. % This macro redefines |\pi| to match % the optional command name provided (without a backslash), such as |piup|, -% assuming that the appropriate package has been loaded beforehand. +% assuming that the appropriate package has been loaded beforehand +% \footnote{The macro \texttt{\string \pinumber} doesn't work with +% \textsf{unicode-math}, but, with this package, you can use \texttt{\string \uppi} instead +% (or set all greek lowercase letters in upright shape with the option +% \texttt{math-style=french}).}. % % By using the preliminary code |\MathNumbers{ei}\pinumber[piup]| % (assuming the \textsf{mathdesign} package is loaded) @@ -426,8 +443,8 @@ % when using the \textsf{mismath} package with other \LaTeX\ packages.}, % produces vectors with arrows % (thanks to the \textsf{esvect} package by Eddie Saudrais -% \footnote{\textsf{esvect} provides the \texttt{\bslash vv} macro -% used by \texttt{\bslash vect}.}) +% \footnote{\textsf{esvect} provides the \texttt{\string \vv} macro +% used by \texttt{\string \vect}.}) % which are more elegant than those produced by \LaTeX's |\overrightarrow| command. % The \textsf{esvect} package has an optional argument % (a single letter between \texttt{a} and \texttt{h}) to define @@ -445,32 +462,34 @@ % as recommended by ISO~\cite{NIST}~\cite{SI}, instead of using arrows. % By using the |\boldvect| command, you can modify the behavior of |\vect| % locally or globally, depending on its placement in the document (inside or outside -% a group or an environment):\\[1ex] +% a group or an environment):\\[2ex] % \begin{minipage}{8cm} % \begin{verbatim} %\[ \boldvect \vect{v} % =\lambda\vect{e}_x+\mu\vect{e}_y. \] % \end{verbatim} % \end{minipage} -% \begin{minipage}{6cm} +% \begin{minipage}{4cm}\vspace{-2ex} % $\boldvect \vect{v}=\lambda\vect{e}_x +\mu\vect{e}_y$. % \end{minipage} % % \DescribeMacro{\boldvectcommand} % By default |\boldvect| uses the |\boldsymbol| command -% \footnote{\texttt{\bslash mathbf} produces upright bold font, -% even when used in combination with \texttt{\bslash mathit}.} +% \footnote{\texttt{\string \mathbf} produces upright bold font, +% even when used in combination with \texttt{\string \mathit}.} % from the \textsf{amsbsy} package, which is automatically loaded by \textsf{amsmath}. % However, you may prefer other packages that produce bold italic fonts, % such as \textsf{fixmath} with the |\mathbold| command, % \textsf{isomath} with |\mathbfit| -% or \textsf{bm} with the \texttt{\bslash bm} command. -% To use an alternative command, redefine |\boldvectcommand|, +% or \textsf{bm} with the |\bm| command; +% \textsf{unicode-math} provides the |\symbfit| command. +% To use an alternative command instead of |\boldsymbol| in \textsf{mismath}, +% redefine |\boldvectcommand|, % for instance after loading \textsf{fixmath}: % \begin{center} |\renewcommand\boldvectcommand{\mathbold}|. \end{center} % % According to ISO rules, symbols for matrices are also in bold italic. -% Therefore you can use the same |\boldvectcommand| or create another alias. +% Therefore you can use the same |\boldvect| command or create another alias. % % \medskip % \DescribeMacro{\arrowvect} @@ -510,7 +529,7 @@ % % \DescribeMacro{\norm} % The norm of a vector is conventionally represented using the delimiters |\lVert| and |\rVert| -% (or \texttt{\bslash}$\mid$ unless a plus (+) or minus (-) sign follows the opening delimiter) +% (or |\|$\mid$ unless a plus (+) or minus (-) sign follows the opening delimiter) % or |\left\Vert| and |\right\Vert| % for adaptive delimiters. Unfortunately, these delimiters % are always vertically centered, relatively to the middle of the base line, @@ -541,23 +560,23 @@ % (as mentioned in \cite{TYPMA}~\cite{NIST}~\cite{ICTNS}~\cite{LSHORT}). % To achieve this, we provide the |\di| command. % Take a look at the following examples (notice the thin spaces before the d, -% just like with classic function's names): \\ -% \begin{minipage}[t]{7cm} +% just like with classic function's names): \\[2ex] +% \begin{minipage}{7cm} % \begin{verbatim} %\[ \iint xy\di x\di y \] % \end{verbatim} % \end{minipage} -% \begin{minipage}{6cm} +% \begin{minipage}{5cm} % \[ \iint xy\di x\di y \] % \end{minipage} -% \\ -% \begin{minipage}[t]{7cm} +% \\[0.5ex] +% \begin{minipage}{7cm} % \begin{verbatim} %\[ m\frac{\di^2x}{\di t^2} % + h\frac{\di x}{\di t} + kx = 0 \] % \end{verbatim} % \end{minipage} -% \begin{minipage}[t]{6cm} +% \begin{minipage}{5cm} % \[m\frac{\di^2x}{\di t^2}+h\frac{\di x}{\di t}+kx=0\] % \end{minipage} % @@ -566,7 +585,7 @@ % % \DescribeMacro{\P} \DescribeMacro{\E} % To refer to probability -% \footnote{\LaTeX\ provides also \texttt{\bslash Pr} which gives $\Pr$.} +% \footnote{\LaTeX\ provides also \texttt{\string Pr} which gives $\Pr$.} % and expectation the proper use is to typeset the capital letters $\P$, $\E$ % in roman just like any standard function identifier. % This can be achieved with |\P| and |\E| commands. @@ -626,8 +645,7 @@ % On the other hand, `$\im$' stands for the image of a linear transformation % (like `$\ker$' for the kernel) % whereas `$\Im$' is the imaginary part of a complex number. -% Please note that |\div| already exists ($\div$) and |\span| is a \TeX\ primitive -% (used in |\multicolumn|); +% Please note that |\div| already exists ($\div$) and |\span| is a \TeX\ primitive; % they haven't been redefined. Therefore the provided macros are called |\divg| (divergence) % and |\spa| (span of a set of vectors). % Furthermore |\Z| is used to denote the set of integers (see \ref{aliases}), @@ -704,7 +722,7 @@ % % \DescribeMacro{\dlim} \DescribeMacro{\dsum} \DescribeMacro{\dprod} % \DescribeMacro{\dcup} \DescribeMacro{\dcap} -% With in-line math mode, displaymath behavior can be forced with |\displaystyle| +% With in-line math mode, displaymath can be forced with |\displaystyle| % or its alias |\ds|. However, when using these commands, all the rest of the current % mathematical environment will be set in displaymath mode % (as shown in the previous example, where the fraction will be expanded). @@ -728,46 +746,44 @@ % \end{center} % % \DescribeMacro{\eqdef} \DescribeMacro{\eqdef*} -% The |\eqdef| macro writes the equality symbol topped with `def' +% The |\eqdef| macro writes the equality symbol topped with `def', % or with `$\scriptstyle \Delta$' for |\eqdef*| -% (thanks to the \LaTeX\ command |\stackrel|): -% -% \bigskip -% \noindent\begin{minipage}{8cm} +% (thanks to the \LaTeX\ command |\stackrel|):\\[2ex] +% \begin{minipage}{7cm} % \begin{verbatim} -%$ \e^{\i\theta} \eqdef -% \cos\theta + \i\sin\theta $ +%\[ \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$ +% \begin{minipage}{5cm}\vspace{-3ex} +% \[\e^{\i\theta}\eqdef\cos\theta + \i\sin\theta\] % \end{minipage} % -% \noindent\begin{minipage}{8cm} +% \noindent\begin{minipage}{7cm} % \begin{verbatim} -%$ \e^{\i\theta} \eqdef* -% \cos\theta + \i\sin\theta $ +%\[ \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$ +% \begin{minipage}{5cm}\vspace{-3ex} +% \[\e^{\i\theta}\eqdef*\cos\theta + \i\sin\theta\] % \end{minipage} % % \DescribeMacro{\unbr} % |\unbr| is an alias for |\underbrace| % \footnote{The \textsf{mathtools} package by Morten Høgholm % and Lars Madsen~\cite{TOOL} provides a new and improved version -% of the \texttt{\bslash underbrace} command, along with many other usefull macros. +% of the \texttt{\string \underbrace} command, along with many other useful macros. % It is loaded by \textsf{mismath}.}, % making source code more compact.\\[2ex] -% \begin{minipage}{7.5cm} +% \begin{minipage}{6.8cm} % \begin{verbatim} -%$ (QAP)^n = \unbr{QAP\mul QAP\mul -% \cdots\mul QAP}_{n\text{ times}} $ +%\[ (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}} $ +% \begin{minipage}{6.2cm}\vspace{-3ex} +% \[ (QAP)^n = \unbr{QAP\mul QAP\mul\cdots\mul QAP}_{n\text{ times}} \] % \end{minipage} % % \DescribeMacro{\iif} @@ -806,8 +822,8 @@ % or enclose the function or structure with braces: % \begin{center} % $x\mul{\sin x}$, obtained with |x\mul{\sin x}|, is slightly better than $x\mul\sin x$.\\[1ex] -% |$\sin\!{\left( \frac{\pi}{3} \right)} \mul 2$| \quad gives\\ -% $\sin\!{\left(\frac{\pi}{3}\right)}\mul 2$ which is better than +% |$\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|, @@ -834,22 +850,22 @@ % For bars whose height has to adapt to the content, % we can use |\left\vert| \ldots |\right\vert| or, more simply, % the |\abs|\{\ldots\} command, which is equivalent -% \footnote{Another solution is to define \texttt{\bslash abs} -% using the \texttt{\bslash DeclarePairedDelimiter} command -% from the \textsf{mathtools} package~\cite{TOOL}.}. +% \footnote{Another solution is to define \texttt{\string \abs} +% using the \texttt{\string \DeclarePairedDelimiter} command +% from the \mbox{\textsf{mathtools}} package~\cite{TOOL}.}. % % \medskip % \DescribeMacro{\lfrac} % The |\lfrac| macro behaves like |\frac| % but with thicker spaces around the arguments, -% making the corresponding fraction bar slightly longer:\\ -% \begin{minipage}[t]{8cm} +% making the corresponding fraction bar slightly longer:\\[2ex] +% \begin{minipage}{8cm} % \begin{verbatim} %\[ \lbar{Z} = % \lfrac{\lbar{z_1-z_2}}{\lbar{z_1+z_2}} \] % \end{verbatim} % \end{minipage} -% \begin{minipage}[t]{4cm} +% \begin{minipage}{4cm}\vspace{-3ex} % \[ \lbar{Z} = \lfrac{\lbar{z_1-z_2}}{\lbar{z_1+z_2}} \] % \end{minipage} % @@ -862,9 +878,9 @@ % To address this issue, we have redefined the brackets in the \textsf{ibrackets} % package~\cite{BRACKET} % which can be optionally -% \footnote{This functionality is optional because it causes -% errors when using a command defined by -% \texttt{\bslash DeclarePairedDelimiter}~\cite{TOOL} with square brackets.} +% \footnote{This functionality is optional because there is a conflict +% when using another command for open intervals with square brackets defined by +% \texttt{\string \DeclarePairedDelimiter} from \textsf{mathtools}~\cite{TOOL}.} % loaded by \textsf{mismath} using the \texttt{ibrackets} package option. % Thus |$x\in ]-\pi,0[ \cup ]2\pi,3\pi[$| % \begin{align*} @@ -902,7 +918,7 @@ % % \medskip %\DescribeMacro{[decimalcomma]} -% In many countries, except notably in Anglo-Saxon countries, +% In many countries, except notably in English-speaking countries, % the comma is used as a decimal separator for numbers. % However, in the math mode of \LaTeX, the comma is always, by default, % treated as a punctuation symbol and therefore is followed by a space. @@ -928,15 +944,15 @@ % % \DescribeEnv{system} % The \texttt{system} environment, defined in the \textsf{mismath} package, -% is used to represent a system of equations:\\ -% \begin{minipage}[t]{6.5cm} +% is used to represent a system of equations:\\[2ex] +% \begin{minipage}{6.5cm} % \begin{verbatim} -%$\begin{system} -% x=1+2t \\ y=2-t \\ z=-3-t -%\end{system}$ +%\[ \begin{system} +% x=1+2t \\ y=2-t \\ z=-3-t +% \end{system} \] % \end{verbatim} % \end{minipage} -% \begin{minipage}[t]{5cm} +% \begin{minipage}{5cm} \vspace{-3ex} % \[ \begin{system} x=1+2t \\ y=2-t \\z=-3-t \end{system} \] % \end{minipage} % @@ -963,16 +979,16 @@ % specifying their alignment using the same syntax as the \texttt{array} environment in % \LaTeX. For instance, using |\begin{system}[cl]| will produce a two-column system, % with the first column centered and -% the second column left-aligned, as shown in the following example:\\ -% \begin{minipage}[t]{7cm} +% the second column left-aligned, as shown in the following example:\\[2ex] +% \begin{minipage}{7cm} % \begin{verbatim} -%$\begin{system}[cl] -% y & =\dfrac{1}{2}x-2 \\[1ex] -% (x,y) & \neq (0,-2) -%\end{system}$ +%\[ \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{minipage}{5cm}\vspace{-2ex} % \[ \begin{system}[cl] y&=\dfrac{1}{2}x-2 \\[1ex] (x,y)&\neq (0,-2) \end{system}\] % \end{minipage} % @@ -1041,7 +1057,7 @@ % as shown in the following example. % However, to use this feature, the \textsf{multicol} package must be loaded in the preamble. % The \texttt{mathcols} environment activates mathematical mode -% in display style and with an \texttt{aligned} environment. +% in display style and uses an \texttt{aligned} environment. % \begin{mathcols} % & \frac{1}{2 \mul {\pow{\frac{1}{4}}{n}} + 1} \geq 0.999 \\ % \iff\ & 1 \geq 1.998 \pow{\frac{1}{4}}{n} + 0.999 \\ @@ -1055,8 +1071,8 @@ % % \DescribeMacro{\changecol} % The |\changecol| macro is used to switch to the next column, -% and an alignment within the column is done using the classic delimiters -% |&| to separate entries and |\\| to start a new row. +% and alignments within the columns is done using the classic delimiters +% |&|, to separate entries, and |\\|, to start a new row. % % \begin{verbatim} %\begin{mathcols} @@ -1114,6 +1130,8 @@ % \StopEventually{} % \section{Implementation} % +% We load certain packages conditionally to avoid 'option clash' errors in cases +% where these packages have been previously loaded with other options. % \begin{macrocode} \newif\ifmm@ibrackets % initialized to false \newif\ifmm@decimalcomma @@ -1125,15 +1143,42 @@ \@ifpackageloaded{mathtools}{}{\RequirePackage{mathtools}} \@ifpackageloaded{esvect}{}{\RequirePackage[b]{esvect}} \RequirePackage{ifthen} -\RequirePackage{xparse} % for \NewDocumentCommand +\RequirePackage{xparse} % provides \NewDocumentCommand \RequirePackage{xspace} \RequirePackage{iftex} -\ifmm@ibrackets\RequirePackage{ibrackets}\fi -\ifmm@decimalcomma\RequirePackage{decimalcomma}\fi +\RequirePackage{etoolbox} % provides \AtEndPreamble + +% \end{macrocode} +% +% The package \textsf{unicode-math} causes some compatibility issues +% with the options ibrackets or decimalcomma: the respective packages +% must be loaded \emph{after} \textsf{unicode-math}, +% but \textsf{mismath} (like \textsf{amsmath}) must be loaded \emph{before} +% \textsf{unicode-math}. +% And to complicate matters, \textsf{unicode-math} defines (or redefines) all its commands +% by |\AtBeginDocument|. +% Therefore we used the command |\AtBeginDocument| within +% |\AtEndPreamble| (from the \textsf{etoolbox} package). +% +% Moreover the command |\mathbfsfit| (used for tensors) is already defined +% in \textsf{unicode-math} and will not be redefined if \textsf{unicode-math} +% is loaded. +% \begin{macrocode} +\newif\ifmm@unicodemath +\newif\ifmm@multicol +\AtEndPreamble{% necessary to work with unicode-math + \@ifpackageloaded{multicol}{\mm@multicoltrue}{\mm@multicolfalse} + \@ifpackageloaded{unicode-math}{\mm@unicodemathtrue}{ + \mm@unicodemathfalse + \DeclareMathAlphabet{\mathbfsfit}{\encodingdefault}% + {\sfdefault}{bx}{it}} + \AtBeginDocument{% necessary to work with unicode-math + \ifmm@ibrackets\RequirePackage{ibrackets}\fi + \ifmm@decimalcomma\RequirePackage{decimalcomma}\fi + } +} % \end{macrocode} -% We have load certain packages conditionally to avoid 'option clash' errors in cases -% where these packages have been previously loaded with other options. % % \medskip % \DescribeMacro{\bslash} @@ -1175,14 +1220,15 @@ % but rather |\mathup| (based on |\operatorfont| from the \textsf{amsopn} package). % This command also works fine with other sans serif fonts like \textsf{cmbright}. % -% Moreover for \textsf{beamer}, which changes the default font family (sans serif) +% Moreover for \textsf{beamer}, which changes the default font family (to sans serif), % |\e|, |\i|, |\j| have no effect without |\AtBeginDocument|. -% % |\AtBeginDocument| is also necessary to redefine |\i| when calling % the \textsf{hyperref} package which overwrites the |\i| definition. % \medskip % \begin{macrocode} -\providecommand{\mathup}[1]{{\operatorfont #1}} % also in kpfonts +\@ifundefined{mathup}{ + \providecommand*{\mathup}[1]{{\operatorfont #1}} + }{\mm@warning{mathup} } % also in kpfonts (and unicode-math) \mm@macro{e}{\mathup{e}} \AtBeginDocument{\let\oldi\i \let\oldj\j \renewcommand{\i}{\TextOrMath{\oldi}{\mathup{i}}} @@ -1190,8 +1236,11 @@ % \end{macrocode} % -% The following macros are switches that transform any chosen letter in math mode -% to roman or italic style. These switches can be used anywhere in the document or preamble. +% \DescribeMacro{\MathFamily} +% The following macros |\MathUp| and |\MathIt| are switches that transform +% any chosen letter in math mode to roman or italic style. +% These switches can be used anywhere in the document or preamble. +% They are based on the generic macro |\MathFamily|. % To obtain a letter in roman style instead of italic, we need to change the % mathcode digit that represents the font family: 1 to 0. % @@ -1199,10 +1248,11 @@ % `e="7165 (decimal 29029), with the second digit `1' indicating ``italic'' style. % To get a roman `e', we need to change its mathcode to "7065. % -% When used in the preamble, it is necessary to call |\AtBeginDocument| -% for using with the \textsf{beamer} package. -% In the preamble, |\math@family{#1}{0}| is equivalent to \\ -% |\DeclareMathSymbol{#1}{\mathalpha}{operators}{`#1}|. +% When used in the preamble, we call |\MathFamily| by |\AtBeginDocument| +% for working with the \textsf{beamer} package. +% Let's notice that |\MathFamily| has an erratic behavior when \textsf{unicode-math} +% is loaded, but fortunately, in that case, the |\DeclareMathSymbol| can be +% used instead, even outside the preamble. % \medskip % \begin{macrocode} \newcount\mm@charcode @@ -1210,7 +1260,7 @@ \newcount\mm@charfam \newcount\mm@charslot -\newcommand*\math@family[2]{% +\newcommand*\MathFamily[2]{% \mm@charfam=#2 \ifluatex \mm@charclass=\Umathcharclass`#1 @@ -1240,16 +1290,41 @@ \fi } -\newcommand*\MathFamily[2]{% - \ifx\@onlypreamble\@notprerr - \math@family{#1}{#2} - \else % before \begin{document} - \AtBeginDocument{\math@family{#1}{#2}} +\newcommand*\MathUp[1]{% + \ifx\@onlypreamble\@notprerr % not in preamble + \ifmm@unicodemath + \DeclareMathSymbol{#1}{\mathalpha}{operators}{`#1} + \else + \MathFamily{#1}{0} + \fi + \else % in preamble + \AtBeginDocument{ + \ifmm@unicodemath + \DeclareMathSymbol{#1}{\mathalpha}{operators}{`#1} + \else + \MathFamily{#1}{0} + \fi + } \fi } -\newcommand*\MathUp[1]{\MathFamily{#1}{0}} -\newcommand*\MathIt[1]{\MathFamily{#1}{1}} +\newcommand*\MathIt[1]{% + \ifx\@onlypreamble\@notprerr % not in preamble + \ifmm@unicodemath + \DeclareMathSymbol{#1}{\mathalpha}{letters}{`#1} + \else + \MathFamily{#1}{1} + \fi + \else % in preamble + \AtBeginDocument{ + \ifmm@unicodemath + \DeclareMathSymbol{#1}{\mathalpha}{letters}{`#1} + \else + \MathFamily{#1}{1} + \fi + } + \fi +} % \end{macrocode} % With a similar approach we could also create additional macros to set any letter @@ -1280,20 +1355,21 @@ % \end{macrocode} % \DescribeMacro{\apply} -% With the inverse global switch |\MathNormal|, you can apply the normal (italic) style +% With the inverse switch |\MathNormal|, you can apply the normal (italic) style % on any comma-separated list of characters. This is achieved using % the |\apply| macro, \eg |\apply\macro{arg1,arg2}| % expands to |\macro{arg1}\macro{arg2}|. % Thus |\apply\MathUp{e,i,j}| is equivalent to |\MathUp{e}\MathUp{i}\MathUp{j}|. % I discovered this powerfull macro on \texttt{iterate190.rssing.com} by searching for -% ``TeX How to iterate over a comma separated list?'' +% ``TeX How to iterate over a comma separated list''. % The answer was posted under the pseudonym `wipet' on 2021/02/26. % Let its author, Petr Olšák, be thanked. % This macro allows to accomplish tasks that % usual loop instructions like |\@for| or |\foreach| cannot achieve due to % errors like ``!~Improper alphabetic constant''. % For instance, if you try |\def\letter{A} \MathUp{\letter}| it will fail -% because the control sequence |\letter| is not equivalent here to the single character `A'. +% because the control sequence |\letter| is not strictly +% equivalent here to the single character `A'. % % \medskip % \begin{macrocode} @@ -1319,64 +1395,70 @@ \newcommand{\enumber}{% \PackageWarning{mismath}{Old command \string\enumber\space is used. \MessageBreak - It can be replaced by \bslash MathUp{e}} + It can be replaced by \string\MathUp{e}} \MathUp{e} } \newcommand{\inumber}{% \PackageWarning{mismath}{Old command \string\inumber\space is used. \MessageBreak - It can be replaced by \bslash MathUp{i}} + It can be replaced by \string\MathUp{i}} \MathUp{i} } \newcommand{\jnumber}{ \PackageWarning{mismath}{Old command \string\jnumber\space is used. \MessageBreak - It can be replaced by \bslash MathUp{j}} + It can be replaced by \string\MathUp{j}} \MathUp{j} } \newcommand{\PEupright}{ \PackageWarning{mismath}{Old command \string\PEupright\space is used. \MessageBreak - It can be replaced by \bslash MathUp{P} - and \bslash MathUp{E}} + It can be replaced by \string\MathUp{P}\space + and \string\MathUp{E}} \MathUp{P}\MathUp{E} } % \end{macrocode} % -% The Greek letter pi must be handled differently. The switches are called -% |\pinumber| and |\pinormal|. +% Obtaining an upright Greek letter $\pi$ must be handled differently. +% The switches are called |\pinumber| and |\pinormal|. % When given without an argument, |\pinumber| uses the LGR font encoding. % A particularity of the \textsf{fontenc} package is that it can be loaded % several times with different options without triggering an ``option clash'' error. +% This macro doesn't work with \textsf{unicode-math}, which provides +% the |\uppi| command but it cannot be redefined in |\pi|. % \medskip % \begin{macrocode} \newcommand*\pinumber[1][]{ + \ifmm@unicodemath + \PackageError{mismath}{Command \string\pinumber\space + is incompatible with unicode-math. \MessageBreak + Use \string\uppi\space to get the upright pi}{} + \fi \@ifundefined{itpi}{\let\itpi\pi}{} \ifthenelse{\equal{#1}{}}{ - \ifx\@onlypreamble\@notprerr + \ifx\@onlypreamble\@notprerr % not in preamble \@ifundefined{savedpi}{ \PackageWarning{mismath}{% - \bslash pinumber without argument\MessageBreak + \string\pinumber\space without argument\MessageBreak must be used in the preamble first\MessageBreak to load LGR fontenc for upright pi} }{\let\pi\savedpi} \else % in the preamble \RequirePackage[LGR,T1]{fontenc} \DeclareSymbolFont{UpGr}{LGR}{lmr}{m}{n} - \let\pi\relax + \let\pi\relax \DeclareMathSymbol{\pi}\mathalpha{UpGr}{"70} \let\savedpi\pi \fi }{ \@ifundefined{#1}{ \PackageWarning{mismath}{% - Value #1 must be a valid - command name\MessageBreak for pinumber, - but command \bslash #1\space + #1 must be a valid command name\MessageBreak + for pinumber, but command \bslash #1 is undefined.\MessageBreak Perhaps a missing package} - }{\renewcommand{\pi}{% + }{\renewcommand{\pi}{% \csname #1\endcsname} } } @@ -1410,11 +1492,10 @@ \mbox{\tiny\raisebox{1pt}{$\Vert$}} #1 \mbox{\tiny\raisebox{1pt}{$\Vert$}} } \@ifundefined{norm}{\providecommand*{\norm}[1]{ - \mathchoice{\@norm{#1}}{\@norm{#1}}{\@@norm{#1}}{\@@@norm{#1}} - } - }{\mm@warning{norm} } % bad result with libertinust1math + \mathchoice{\@norm{#1}}{\@norm{#1}}{\@@norm{#1}}{\@@@norm{#1}} + } +}{\mm@warning{norm}} % bad result with libertinust1math -\DeclareMathAlphabet{\mathbfsfit}{\encodingdefault}{\sfdefault}{bx}{it} \newcommand{\tensor}{\mathbfsfit} % isomath uses \mathsfbfit % \end{macrocode} @@ -1441,7 +1522,7 @@ \mm@operator{\erf}{erf} \mm@macro{grad}{\operatorname{\vect{\mathup{grad}}}} -\mm@operator{\id}{id} % mathop or mathord ? +\mm@operator{\id}{id} % mathop or mathord? \mm@operator{\Id}{Id} \mm@operator{\im}{im} \let\oldIm\Im \renewcommand{\Im}{\operatorname{Im}} @@ -1513,6 +1594,7 @@ % \end{macrocode} % Above, we have used |\mathrm| before |\Delta| in case of defining capital Greek letters % in italics (for example with the \textsf{fixmath} package). +% % The use of |\mbox{}| ensures that the space produced by |\| in the |\then| macro % is not suppressed in tables. % \medskip @@ -1545,10 +1627,16 @@ }{\end{smallmatrix}\right)} \newenvironment{mathcols}{% needs multicol package + \ifmm@multicol \renewcommand{\columnseprule}{0.1pt} \begin{multicols}{2} \par\noindent\hfill \begin{math}\begin{aligned}\displaystyle + \else + \PackageError{mismath}{The mathcols environment + needs the multicol package}{Add the package multicol + to your preamble.} + \fi }{% \end{aligned}\end{math} \hfill\mbox{} \end{multicols} @@ -1559,8 +1647,8 @@ \begin{math}\begin{aligned}\displaystyle } % \end{macrocode} -% \pagebreak -% \begin{thebibliography}{27} +% +% \begin{thebibliography}{28} % \begin{raggedright} % \bibitem{TYPMA} \emph{Typesetting mathematics for science and technology according % to ISO 31/XI}, Claudio Beccari, TUGboat Volume 18 (1997), No.~1. @@ -1579,11 +1667,14 @@ % \bibitem{AMS} \emph{\textsf{amsmath} -- \AmS\ mathmatical facilities for \LaTeX}, % Frank Mittelbach, Rainer Schöpf, Michael Downes, Davis M.~Jones, David Carlisle, % CTAN, v2.17n 2022/04/08. +% \bibitem{UNIC} \emph{Experimental Unicode mathematical typesetting: +% The \textsf{unicode-math} package}, Will Robertson, Philipp Stephani, Joseph Wright, +% Khaled Hosny, and others, CTAN, v0.8r 2023/08/13. % \bibitem{TOOL} \emph{The \textsf{mathtools} package}, Morten Høgholm, Lars Madsen, CTAN, % v1.29 2022/06/29. % \bibitem{FIXM} \emph{The \textsf{fixmath} package for \LaTeXe}, Walter Schmidt, % CTAN, v0.9 2000/04/11. -% \bibitem{ISOM} \emph{\textsf{isomath} -- Mathematical style for science and technology}. +% \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. @@ -1598,22 +1689,22 @@ % \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, +% \bibitem{INT} \emph{The \textsf{interval} package}, Lars Madsen, CTAN, % v0.4 2019/03/06. -% \bibitem{ICOMMA} \emph{The \textsf{icomma} package for \LaTeXe}. +% \bibitem{ICOMMA} \emph{The \textsf{icomma} package for \LaTeXe}, % Walter Schmidt, CTAN, v2.0 2002/03/10. -% \bibitem{NCC} \emph{The \textsf{ncccomma} package}. Alexander I.~Rozhenko, +% \bibitem{NCC} \emph{The \textsf{ncccomma} package}, Alexander I.~Rozhenko, % CTAN, v1.0 2005/02/10. -% \bibitem{DEC} \emph{The \textsf{decimalcomma} package}. Antoine Missier, -% CTAN, v1.0 2023/12/06. +% \bibitem{DEC} \emph{The \textsf{decimalcomma} package}, Antoine Missier, +% CTAN, v1.4 2023/12/30. % \bibitem{SYST} \emph{L'extension pour \TeX\ et \LaTeX\ \textsf{systeme}}, -% Christian Tellechea, CTAN v0.32 2019/01/13. +% Christian Tellechea, CTAN, v0.32 2019/01/13. % \bibitem{SPAL} \emph{The \textsf{spalign} package}, Joseph Rabinoff, CTAN, 2016/10/05. % \bibitem{NMATX} \emph{The package \textsf{nicematrix}}, François Pantigny, CTAN, % v6.14 2023/02/18. -% \bibitem{FR} \emph{L'extension \textsf{frenchmath}}, Antoine Missier, CTAN, v2.5 2023/02/24. -% \bibitem{BRACKET} \emph{Intelligent brackets -- The \textsf{ibrackets} package} -% Antoine Missier, CTAN, v1.1, 2022/12/26. +% \bibitem{FR} \emph{L'extension \textsf{frenchmath}}, Antoine Missier, CTAN, v2.8 2024/01/22. +% \bibitem{BRACKET} \emph{Intelligent brackets -- The \textsf{ibrackets} package}, +% Antoine Missier, CTAN, v1.2, 2023/07/26. % \bibitem{LSHORT} \emph{The Not So Short Introduction to \LaTeXe}, % the \textsf{lshort} package by % Tobias Oetiker, Hubert Partl, Irene Hyna and Elisabeth Schlegl, CTAN, v6.4 2021/04/09. diff --git a/Master/texmf-dist/source/latex/mismath/mismath.ins b/Master/texmf-dist/source/latex/mismath/mismath.ins index 2ed4bf317d4..5a39f8da297 100644 --- a/Master/texmf-dist/source/latex/mismath/mismath.ins +++ b/Master/texmf-dist/source/latex/mismath/mismath.ins @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2019-2023 by Antoine Missier +%% Copyright (C) 2019-2024 by Antoine Missier %% %% This file may be distributed and/or modified under the conditions of %% the LaTeX Project Public License, either version 1.3 of this license @@ -21,7 +21,7 @@ This is a generated file. -Copyright (C) 2019-2023 by Antoine Missier +Copyright (C) 2019-2024 by Antoine Missier This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license -- cgit v1.2.3