From d002e8f0c323e328ef6385a9b5f9118dbbed7fa6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 10 Feb 2023 21:55:34 +0000 Subject: mismath (10feb23) git-svn-id: svn://tug.org/texlive/trunk@65779 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/mismath/mismath.dtx | 534 ++++++++++++++------- 1 file changed, 365 insertions(+), 169 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 7571aa54c4a..c610c4e9768 100644 --- a/Master/texmf-dist/source/latex/mismath/mismath.dtx +++ b/Master/texmf-dist/source/latex/mismath/mismath.dtx @@ -20,7 +20,7 @@ %<*package> \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{mismath} - [2023/01/06 v2.2 .dtx mismath file] + [2023/02/10 v2.3 .dtx mismath file] % %<*driver> \documentclass{ltxdoc} @@ -35,12 +35,14 @@ \usepackage[Euler]{upgreek} \usepackage{sectsty} \usepackage{xcolor} +\usepackage{spacingtricks} +\usepackage{centeredline} +\usepackage{array} \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] +\mismathset{inumber, pinumber=piup} +% enumber=false because I need italicized e in vectors section % For using in this doc only: \usepackage[LGR,T1]{fontenc} \DeclareSymbolFont{UpGr}{LGR}{lmr}{m}{n} @@ -68,7 +70,7 @@ % % \fi % -%% \CheckSum{459} +% \CheckSum{528} % % \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 @@ -160,13 +162,20 @@ % - Loading of ibrackets package is now optional, due to an error % when using DeclarePairedDelimiter with square brackets.} % +% \changes{v2.3}{2023/02/06}{ +% - Introducing keyval options for enumber, inumber, jnumber, PEupright +% (corresponding old commands are maintained for now) +% - and also for ibrackets, boldvect and arrowvect} +% \changes{v2.3}{2023/02/09}{ +% - Documentation update} +% % \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} +% \date{February 10, 2023} % % \maketitle % \tableofcontents @@ -213,16 +222,28 @@ % |\let\|\meta{command}|\relax| before loading \textsf{mismath}. % % \medskip -% \DescribeEnv{\meta{options}} +% \DescribeEnv{\oarg{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 +% \textsf{amsmath} can 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 +% \DescribeMacro{\mismathset} +% \textsf{mismath} has its own options (see further and in section \ref{options}). +% They are based on the \meta{key}=\meta{value} mechanism, +% thanks to the \textsf{kvoptions} package by Heiko Oberdiek~\cite{KVO}. Most of them +% are booleans and they can be called by their key name without typing `\texttt{=true}'. +% \textsf{mismath} options can be set when calling the package, or later with the +% macro |\mismathset|\marg{keyval list}, which is an alias for +% |\setkeys{mismath}|\marg{keyval list} +% from the \textsf{keyval} package by David Carlisle~\cite{KV}. +% +% \medskip +% \textsf{mismath} loads also the package +% \textsf{mathtools} by Morten Høgholm and Lars Madsen~\cite{TOOL}. +% 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 @@ -233,60 +254,59 @@ % (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} +% 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} +% \subsection{Mathematical constants} \label{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} +% (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}.}), +% produces a font with serif in \textsf{beamer}. Therefore +% using \texttt{\bslash mathup} is better than \texttt{\bslash mathrm}.}), +% \DescribeMacro{\e} \DescribeMacro{\i} \DescribeMacro{\j} % 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, +% 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 +% The new definition of |\i| and |\j| concerns only the 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} +% \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: +% So a way is proposed here to free of it with the package options +% |enumber|, |inumber| or |jnumber| : % $\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. +% as long as 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 +% |\mathit| or |\mathnormal|. These options 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. +% afterwards. % % \medskip -% \DescribeMacro{\pinumber\oarg{command}} +% \DescribeMacro{[pinumber=\meta{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 @@ -296,47 +316,57 @@ % (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} +% A special mention for \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.} +% |\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 +% avoid typing a lot of |\uppi| or |\piup|, we provide the +% option [\texttt{pinumber=}\meta{command}]. +% This option redefines |\pi| to match +% the optional command name given (without backslash), for instance |piup|, +% assuming the appropriate % package has been loaded before. % -% By activating |\enumer|, |\inumber| and |\pinumber[piup]| in the preamble, +% By calling |\mismathset{enumber,inumber,pinumber=piup}| (\eg with \textsf{mathdesign}) +% in the preamble, % you can get for instance : % \begin{center} -% |$e^{i\pi} = -1$| \enskip \hspace{3em} \enskip $\e^{i\pi}=-1$. +% |$e^{i\pi} = -1$| \quad yields \quad $\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 \texttt{pinumber} option has a special value `star' : |pinumber=*|, +% which defines |\pi| with the default LGR font encoding of Greek letters +% to produce $\mypi$ (the appropriate option \texttt{LGR} +% for the \textsf{fontenc} package will be automatically loaded). +% 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; +% 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|. +% When using the |pinumber| option, the original italic $\itpi$ +% is still available with |\itpi|. % -% \subsection{Vectors} +% \subsection{Vectors}\label{vectors} % % \DescribeMacro{\vect} -% By default, the |\vect| command\footnote{As for many macros of this package, +% 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}.}) +% (thanks to the \textsf{esvect} package of Eddie Saudrais +% \footnote{\textsf{esvect} provides the \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 @@ -345,7 +375,7 @@ % |\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}| +% \eg |\usepackage[d]{esvect}| % will give the arrows produced by default in~\cite{VECT}. % % \medskip @@ -353,7 +383,8 @@ % 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] +% globally or locally, depending on where |\boldvect| +% is placed:\\[1ex] % \begin{minipage}{8cm} % \begin{verbatim} %\[ \boldvect \vect{v} @@ -365,11 +396,11 @@ % \end{minipage} % % \DescribeMacro{\boldvectcommand} -% By default |\boldvect| uses the |\boldsymbol| -% command\footnote{\texttt{\bslash mathbf} gives upright bold font, +% 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.\@ +% But other packages producing bold italic can be preferred, \eg % \texttt{\bslash bm} from \textsf{bm} package or |\mathbold| from \textsf{fixmath} % package or |\mathbfit| from \textsf{isomath}. % For that, redefine |\boldvectcommand|, for instance: @@ -377,17 +408,29 @@ % % 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). +% which tends to be used instead of bold \emph{italic}, +% but this is \emph{not} recommended. % % \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: +% |\arrowvect|. +% These switches can be placed anywhere: % inside mathematical mode or inside an environment (with local effect) or outside % (with global effect). % % \medskip +% \DescribeMacro{[boldvect]}\DescribeMacro{[arrowvect]} +% Instead of using these switches, you can also set package options +% \texttt{boldvect} or \texttt{arrowvect}, when calling \textsf{mismath} +% or with the |\mismathset| command. +% The latter gives the same flexibility than the previous switches. +% In fact \texttt{boldvect} and \texttt{arrowvect} options are linked booleans: +% when one is set to \texttt{true}, the other will be \texttt{false}. +% So \texttt{arrowvect=false} is equivalent to \texttt{boldvect} +% (\texttt{=true} can be omitted). +% +% \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$) @@ -398,9 +441,10 @@ % \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|. +% The |\boldvect| and |\arrowvect| switches have the same effect on |\hvect| than on |\vect|, +% and so have \texttt{boldvect} and \texttt{arrowvect} options. % -% \medskip +% \pagebreak % \DescribeMacro{\hvec} % In a similar way, |\hvec| raises the little arrow produced by % the \LaTeX\ command |\vec| (from height of $t$ letter): @@ -421,9 +465,9 @@ % 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}}}$. +% \eg $\e^{\norm{\vec{h}}}$. % -% \subsection{Standard operator names} +% \subsection{Standard operator names}\label{operators} % % \DescribeMacro{\di} % The \emph{differential} operator should be typeset in upright shape and not in @@ -454,16 +498,14 @@ % 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$.} +% \DescribeMacro{\P} \DescribeMacro{\E} \DescribeMacro{[PEupright]} +% 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 +% In the same way as for $\e$ and $\i$, you can use \texttt{[PEupright]} as package option % 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} @@ -471,12 +513,17 @@ % and has been redefined, but this symbol can still be obtained with |\Par|. % % \medskip +% \DescribeMacro{\V} +% Variance is generally denoted by $\var$ or $\Var$ (see table below), +% but some authors prefer to use $\V$, produced by |\V|. +% +% \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}, +% 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 @@ -484,7 +531,7 @@ % but also available standalone) % which has to be called in the preamble. % -% \medskip +% \pagebreak % The following standard operator names are defined in \textsf{mismath}: % \begin{center} % \begin{tabular}{rlrlrl} @@ -507,9 +554,9 @@ % 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. +% 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) @@ -583,9 +630,12 @@ % 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}$. +% So +% \begin{center} +% |$\dlim_{x\to +\infty}\frac{1}{x}$| \quad gives \quad $\dlim_{x \to +\infty}\frac{1}{x}$. +% \end{center} % -% \bigskip +% \medskip % \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}$. @@ -597,11 +647,12 @@ % \end{center} % % \DescribeMacro{\eqdef} \DescribeMacro{\eqdef*} -% The |\eqdef| macro writes equality symbol topped with ``def'' -% or with ``$\scriptstyle \Delta$'' for |\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} +% \bigskip +% \noindent\begin{minipage}{8cm} % \begin{verbatim} %$ \e^{\i\theta} \eqdef % \cos\theta + \i\sin\theta $ @@ -611,12 +662,23 @@ % $\e^{\i\theta}\eqdef\cos\theta + \i\sin\theta$ % \end{minipage} % +% \noindent\begin{minipage}{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] +% |\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 @@ -630,14 +692,15 @@ % \DescribeMacro{\iif} % |\iif| is an alias for ``\iif'', to be used in text mode. % -% \subsection{Improved spacing in mathematical formulas} +% \pagebreak +% \subsection{Improved spacing in mathematical formulas}\label{spacing} % % \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}), +% 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}| \\ @@ -663,7 +726,7 @@ % 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$| \quad gives\\ % $\sin\!{\left(\frac{\pi}{3}\right)}\mul 2$ which is better than % $\sin\left(\frac{\pi}{3}\right)\mul 2$. % \end{center} @@ -678,8 +741,9 @@ % 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: +% 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}.\] % @@ -688,10 +752,10 @@ % |\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}.}. +% 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{mathtools} package~\cite{TOOL}.}. % % \medskip % \DescribeMacro{\lfrac} @@ -709,17 +773,18 @@ % \end{minipage} % % \DescribeMacro{[ibrackets]} -% Open intervals are usually represented with parenthesis, e.g.\@ $(0, +\infty)$, +% Open intervals are usually represented with parenthesis, \eg $(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[$. -% +% \eg $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}. +% 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} with \texttt{ibracket} package option. +% % 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}}, \\ @@ -738,16 +803,16 @@ % 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]$. +% \eg |$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]$ +% \eg |$[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} +% or |\DeclarePairedDelimiters| from the \textsf{mathtools} package~\cite{TOOL} % (but the latter is incompatible with \textsf{ibrackets} % for brackets management). % @@ -805,8 +870,8 @@ % 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.}: +% 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 @@ -845,10 +910,12 @@ % \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, +% The \texttt{mathcols} environment 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. +% But the \textsf{multicol} package must be loaded in the preamble. +% It activates the mathematical mode +% in display style and with 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 \\ @@ -877,20 +944,91 @@ %\end{mathcols} % \end{verbatim} % +% \vspace{-4ex} +% \subsection{Summary of available options and deprecated commands}\label{options} +% +% Here we present a summary table of available options. Explanations of use +% are given in the corresponding sections. +% The default value for booleans is always \texttt{false} except for \texttt{arrowvect}. +% Deprecated commands (used until version 2.3) are still working. +% +% \begin{center} \ttfamily +% \setlength{\extrarowheight}{1pt} +% \begin{tabular}{llcc} +% \hline +% \textsf{Key} & \textsf{Possible values} & \textsf{See section} & +% \textsf{Deprecated command} \\ +% \hline +% enumber & false, true & \ref{constants} & |\enumber| \\ +% inumber & false, true & \ref{constants} & |\inumber| \\ +% jnumber & false, true & \ref{constants} & |\jnumber| \\ +% pinumber & *, \meta{command} & \ref{constants} & |\pinumber|\oarg{command}\\ +% boldvect & false, true & \ref{operators} &\\ +% arrowvect & true, false & \ref{operators} & \\ +% PEupright & false, true & \ref{operators} & |\PEupright| \\ +% ibrackets & false, true & \ref{spacing} & \\ +% \hline +% \end{tabular} +% \end{center} +% +% For \texttt{pinumber}, there is no default value, +% that means that |\pi| is still typeset in italic. +% If you want it in upright shape, you have to load an appropriate package +% and give a command name (without backslash) that produces an upright pi; +% \texttt{pinumber=*} gives the upright $\mypi$ given by the LGR font encoding, +% without having to load something. +% +% \enlargethispage{1ex} +% \medskip +% For each option, you can set them when package calling: \eg +% (with \textsf{upgreek}) +% +% \smallskip +% \centeredline{|\usepackage[inumber,pinumber=uppi,boldvect]{mismath}|} +% +% \bigskip +% \DescribeMacro{\mismathset} +% You can also use the |\mismathset|\{\meta{keyval list}\} +% command. +% Nevertheless, only the option \texttt{boldvect} (or \texttt{arrowvect}) +% can be changed dynamically in the document body. +% The others are usable in the preamble only +% and will be processed once, at begin document. +% % \StopEventually{} % \section{Implementation} % % \begin{macrocode} -\RequirePackage{ifthen} -\newboolean{ibrackets} -\DeclareOption{ibrackets}{\setboolean{ibrackets}{true}} -\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{amsmath}} -\ProcessOptions \relax +\RequirePackage{kvoptions} +\DeclareBoolOption[false]{enumber} +\DeclareBoolOption[false]{inumber} +\DeclareBoolOption[false]{jnumber} +\DeclareStringOption{pinumber} +\DeclareBoolOption[true]{arrowvect} +\DeclareComplementaryOption{boldvect}{arrowvect} +\DeclareBoolOption[false]{PEupright} +\DeclareBoolOption[false]{ibrackets} +\DeclareDefaultOption{% + \ifx\CurrentOptionValue\relax + \PackageWarningNoLine{\@currname}{% + Unknown option `\CurrentOption’\MessageBreak + is passed to package `amsmath’}% + % Pass the option to package amsmath. + % Again it is better to expand \CurrentOption. + \expandafter\PassOptionsToPackage + \expandafter{\CurrentOption}{amsmath}% + \else + % Package amsmath does not take options with values. + % We provide the standard LaTeX error. + \@unknownoptionerror + \fi } + +\ProcessKeyvalOptions* + \@ifpackageloaded{amsmath}{}{\RequirePackage{amsmath}} +\@ifpackageloaded{mathtools}{}{\RequirePackage{mathtools}} \@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 @@ -904,12 +1042,104 @@ % \begin{macrocode} {\catcode`\|=\z@ \catcode`\\=12 |gdef|bslash{\}} % \bslash command +% \end{macrocode} +% +% \medskip +% \DescribeMacro{\mismathset} +% This macro allows to set keyval options not only when calling the package. +% \begin{macrocode} +\def\mismathset#1{\setkeys{mismath}{#1}} + +% \end{macrocode} +% \medskip +% Options must be set in the preamble and are processed at begin document, +% except \texttt{boldvect} or \texttt{arrowvect} which can be changed dynamically +% anywhere in the document body. +% +% Moreover for \textsf{beamer}, $\e, \i, \j$ must be typeset in +% the family default font (sans serif) and this has no effect without the +% |\AtBeginDocument|. +% \begin{macrocode} +\AtBeginDocument{ + \ifmismath@enumber + \DeclareMathSymbol{e}\mathalpha{operators}{`e} \fi + \ifmismath@inumber + \DeclareMathSymbol{i}\mathalpha{operators}{`i}\fi + \ifmismath@jnumber + \DeclareMathSymbol{j}\mathalpha{operators}{`j}\fi + \ifthenelse{\equal{\mismath@pinumber}{}}{}{% else + \@ifundefined{itpi}{\let\itpi\pi}{\@mwarning{itpi}} + \ifthenelse{\equal{\mismath@pinumber}{*}}{ + \RequirePackage[LGR,T1]{fontenc} + \DeclareSymbolFont{UpGr}{LGR}{lmr}{m}{n} + \DeclareMathSymbol{\pi}\mathalpha{UpGr}{"70} + }{% else + \@ifundefined{\mismath@pinumber}{ + \PackageWarningNoLine{mismath}{% + Value \mismath@pinumber\space must be a valid + command name\MessageBreak for pinumber option, + but command \bslash \mismath@pinumber\space + is undefined.\MessageBreak + Perhaps a missing package} + }{\renewcommand{\pi}{% + \csname\mismath@pinumber\endcsname} + } + }} + \ifmismath@PEupright + \DeclareMathSymbol{P}\mathalpha{operators}{`P} + \DeclareMathSymbol{E}\mathalpha{operators}{`E} \fi + \ifmismath@ibrackets \RequirePackage{ibrackets} \fi + + \DisableKeyvalOption[action=warning,package=mismath]{mismath}{enumber} + \DisableKeyvalOption[action=warning,package=mismath]{mismath}{inumber} + \DisableKeyvalOption[action=warning,package=mismath]{mismath}{jnumber} + \DisableKeyvalOption[action=warning,package=mismath]{mismath}{pinumber} + \DisableKeyvalOption[action=warning,package=mismath]{mismath}{PEupright} + \DisableKeyvalOption[action=warning,package=mismath]{mismath}{ibrackets} +} + +% \end{macrocode} +% The following commands are deprecated but still work. +% They were intended to set some letters in upright shape by default +% in math mode. This is now managed by keyval options. +% \begin{macrocode} +\newcommand{\enumber}{% + \PackageWarning{mismath}{Command \string\enumber\space + is deprecated, \MessageBreak + use `enumber' as package option instead} + \mismath@enumbertrue +} +\newcommand{\inumber}{% + \PackageWarning{mismath}{Command \string\inumber\space + is deprecated, \MessageBreak + use `inumber' as package option instead} + \mismath@inumbertrue +} +\newcommand{\jnumber}{ + \PackageWarning{mismath}{Command \string\jnumber\space + is deprecated, \MessageBreak + use `jnumber' as package option instead} + \mismath@jnumbertrue +} +\newcommand*{\pinumber}[1][*]{ + \PackageWarning{mismath}{Command \string\pinumber\space + is deprecated, + use `pinumber=#1'\MessageBreak as package option instead} + \def\mismath@pinumber{#1} +} +\newcommand{\PEupright}{ + \PackageWarning{mismath}{Command \string\PEupright\space + is deprecated, \MessageBreak + use `PEupright' as package option instead} + \mismath@PEuprighttrue +} + % \end{macrocode} % \medskip % \DescribeMacro{\@mwarning} \DescribeMacro{\@mmacro} \DescribeMacro{\@moperator} -% The three following internal macros are meta commands for a +% The three following internal macros are meta commands for % conditional macro definition with a warning message if the macro already exists. -% They could be useful in other packages. +% They should be useful in other packages. % \begin{macrocode} \newcommand\@mwarning[1]{ \PackageWarningNoLine{mismath}{ @@ -934,16 +1164,12 @@ % \end{macrocode} % -% To produce the correct upright shape font even when working -% with the \textsf{beamer} package, we did not use |\mathrm| +% To produce the correct upright shape font when working +% with the \textsf{beamer} package, you don't have to 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 +% |\AtBeginDocument| is necessary to redefine |\i| when calling % the \textsf{hyperref} package which overwrites the |\i| definition. % % \medskip @@ -954,40 +1180,11 @@ \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{\arrowvect}{\mismath@arrowvecttrue} +\newcommand{\boldvect}{\mismath@arrowvectfalse} \newcommand{\boldvectcommand}{\boldsymbol} % from amsbsy package -\@mmacro{vect}{\ifthenelse{\boolean{arrowvect}}{ - \vv}{\boldvectcommand}} +\@mmacro{vect}{\ifthenelse{\boolean{mismath@arrowvect}}{ + \vv}{\boldvectcommand}} %\if \fi doesn't work well here \newcommand*{\hvect}[1]{\vect{\vphantom{t}#1}} \newcommand*{\hvec}[1]{\vec{\vphantom{t}#1}} @@ -1012,12 +1209,6 @@ \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} @@ -1091,7 +1282,7 @@ \@mmacro{then}{\ \Longrightarrow \ \mbox{} } % \end{macrocode} -% Without |\mbox{}|, the space produced by |\| would be suppressed in tables. +% Without |\mbox{}|, space produced by |\| would be suppressed in tables. % \medskip % \begin{macrocode} \@ifundefined{txt}{ @@ -1152,12 +1343,16 @@ % 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{KVO} \emph{The \textsf{kvoptions} package}, Heiko Oberdiek, CTAN, +% v3.13 2019/11/29. +% \bibitem{KV} \emph{The \textsf{keyval} package}, David Carlisle, CTAN, +% v1.15 2014/10/28. % \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, +% \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. @@ -1181,10 +1376,11 @@ % \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{FR} \emph{L'extension \textsf{frenchmath}}, Antoine Missier, CTAN, v2.4 2023/01/22. % \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 +% Antoine Missier, CTAN, v1.1, 2022/12/26. +% \bibitem{LSHORT} \emph{The Not So Short Introduction to \LaTeXe}, +% the \textsf{lshort} package by % Tobias Oetiker, Hubert Partl, Irene Hyna and Elisabeth Schlegl, CTAN, v6.4 2021/04/09. % \url{http://tug.ctan.org/info/lshort/english/lshort.pdf}. % \bibitem{COMP} \emph{The \LaTeX\ Companion}, Frank Mittelbach, Michel Goossens, -- cgit v1.2.3