% \iffalse meta-comment % % Copyright (C) 2019-2023 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 % 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} % %<*package> \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{mismath} [2023/07/27 v2.8 .dtx mismath file] % %<*driver> \documentclass{ltxdoc} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[english]{babel} \usepackage[charter]{mathdesign} % in case of font change, modify 2.1 (3rd §) \usepackage[ibrackets]{mismath} %\usepackage{amssymb} incompatible with mathdesign \usepackage{multicol} \usepackage[Symbol]{upgreek} \usepackage{sectsty} \usepackage{xcolor} \usepackage{spacingtricks} \usepackage{array} \usepackage{metalogo} % for logos of XeLaTeX et LuaLaTeX \definecolor{darkbrown}{rgb}{0.5,0.1,0.1} \allsectionsfont{\color{darkbrown}} \MathUp{i} \pinumber[piup] % I need italicized e in vectors section % For using in this doc only: \usepackage[LGR,T1]{fontenc} \DeclareSymbolFont{UpGr}{LGR}{lmr}{m}{n} \DeclareMathSymbol{\mypi}\mathalpha{UpGr}{"70} % For showing original \i and \j in text mode: \DeclareTextFontCommand{\extrafont}{\fontfamily{lmr}\selectfont} \DisableCrossrefs %\CodelineIndex %\RecordChanges \usepackage{hyperref} \hypersetup{% colorlinks, linkcolor=blue, citecolor=red, pdftitle={mismath}, pdfsubject={LaTeX package}, pdfauthor={Antoine Missier} } \begin{document} \DocInput{mismath.dtx} %\PrintChanges %\PrintIndex \end{document} % % \fi % % \CheckSum{624} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % \changes{v0.1}{2011/12/27}{First personal version} % % \changes{v1.0}{2019/04/11}{ % - Initial published version: creating dtx and ins files} % % \changes{v1.1}{2019/04/20}{ % - Some forgotten french 'et' -> 'and', citecolor=blue, % - changing the default font for pinumber Euler -> Symbol} % % \changes{v1.2}{2019/04/26}{ % - Works fine with beamer now, % - AtBeginDocument for enumber, inumber, jnumber, % - creating general mm@operator macro, % - using mathup instead of mathrm} % \changes{v1.2}{2019/04/27}{ % - Added mathtools package, % - font definition Roman -> up, % - changes in documentation, % - replacing the PEroman macro by PEupright} % % \changes{v1.3}{2019/05/05}{ % - Using bslash in the internal mm@warning macro, % - loading of mathfixs package} % \changes{v1.3}{2019/05/08}{ % - Many corrections in documentation} % % \changes{v1.4}{2019/05/22}{ % - Changing font definition up -> UpSh, due to incompatibility with unicode-math} % % \changes{v1.5}{2019/05/30}{ % - A solution for using mul with frac -> braces, % - addition of paren macro} % \changes{v1.5}{2019/06/22}{ % - Small corrections in documentation} % % \changes{v1.6}{2019/09/06}{ % - Removing mathfixs package, problems with fractions} % % \changes{v1.7}{2019/12/27}{ % - Adding a table of contents to the documentation} % % \changes{v1.8}{2020/11/15}{ % - Incompatibility mentioned when using `i' with accent in beamer titles -> use \^i, % - small changes in documentation} % % \changes{v1.9}{2020/10/17}{ % - UpSh replaced by "operators" font in math mode, % - PackageWarning `command exist' replaced by PackageWarningNoLine, % - medspace replaced by thickspace in the lfrac command, % - changing font in documentation, lmodern -> Palatino (mathpazo)} % % \changes{v1.10}{2020/10/25}{\ % - pinumber command code adapted to avoid incompatibility with the new frenchmath, % - default option (in upgreek) changed from Symbol to Euler.} % % \changes{v2.0}{2022/11/11}{ % - pinumber command has been improved to use other Greek letter packages, % (and LGR encoding pi by default), it is no longer compatible with the older, % - paren command has been removed, % - hvect and hlbar have been slighlty modified (phantom t instead of phantom h), % - several changes in documentation, % - now using the Charter font (with the package mathdesign)} % % \changes{v2.1}{2022/12/26}{ % - Improved management of square brackets with the ibrackets package, % - new macros codim, sinc, var, eqdef*, % - removing the systematic warning for paren command, % - a small change in norm command -> bars in small size, % - several changes in documentation} % % \changes{v2.2}{2023/01/06}{ % - Loading of ibrackets package is now optional, due to an error % when using DeclarePairedDelimiter with square brackets.} % % \changes{v2.3}{2023/02/06}{ % - Introducing keyval options for enumber, inumber, jnumber, PEupright % (corresponding old commands are maintained for now), % - and also for ibrackets, boldvect and arrowvect} % \changes{v2.3}{2023/02/09}{ % - Documentation update} % % \changes{v2.4}{2023/02/18}{ % - New powerful macros MathUp, MathIt and also MathNumbers, MathProba, MathNormal, % - keyval options are no longer useful and have been deleted, % - loading package ifthen has been forgotten in v2.3 (causing possible errors), % - no more incompatibility when using `i' with accent in beamer titles} % % \changes{v2.5}{2023/02/23}{ % - Unification of the code of MathUp and MathIt, % - a powerful macro `apply' is used in MathNormal to act on a list, % - a new `tensor' command, % - small changes in the documentation} % % \changes{v2.6}{2023/03/01}{ % - A bug correction in mm@macro % - incompatibility of \C macro solved, when using babel with russian % (thanks to Murray Eisenberg for this bug report on TeX StackExchange) % - mathrm added in macro eqdef* (useful if italicized Greek uppercase Delta) % - Tiny changes in the documentation} % % \changes{v2.7}{2023/03/05}{ % - Macros for sets of numbers (\R, \C,...) now available only in math mode % (following remarks by David Carlisle and Enrico Gregorio) % - special (not generic) warning when loading babel with russian % (\C will not be defined in that case)} % % \changes{v2.8}{2023/07/26}{ % - Some small changes in the documentation % - New macro `onlymathC' designed for using '\C' when Russian language is loaded} % % \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{July 27, 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 though it is recommended to typeset vectors names % in bold italic style~\cite{NIST}~\cite{ICTNS}, % they are often represented with arrows % (especially in school documents or in physics). % To draw visually appealing arrows above vectors, we use the \textsf{esvect} package % by Eddie Saudrais~\cite{VECT}. % Additionally we provide a few more macros related to vectors with arrows, % particularly to enhance the typesetting of the norm: $\norm{\vect{AB}}$ % instead of \LaTeX\ version $\lVert\vect{AB}\rVert$ which is not vertically adjusted, % or worse $\left\Vert \vect{AB} \right\Vert$. % % \smallskip % The package also offers other macros for: % \begin{itemize} % \item tensors, % \item some common operator names, % \item a few useful aliases, % \item enhancing spacing in mathematical formulas, % \item systems of equations and small matrices, % \item displaymath in double columns for lengthy calculations. % \end{itemize} % % To avoid compatibility issues, % most of our macros will only be defined % if there isn't already a command with the same name in the packages loaded % before \textsf{mismath}. If a macro is already defined, % a warning message will be displayed and the \textsf{mismath} definition % will be ignored. If you wish to keep the existing command or the \textsf{mismath} 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}), % you can include these options when calling \textsf{mismath}, or % you can load \textsf{amsmath} % with the desired options before loading \textsf{mismath}. % % \medskip % In addition \textsf{mismath} loads the \textsf{mathtools} package % by Morten Høgholm and Lars Madsen~\cite{TOOL}. % This package offers numerous helpful macros and improvements of the \textsf{amsmath} package. % % \medskip % A recommendation, although rarely followed, is to typeset uppercase % Greek letters in italic shape, % similar to other variables~\cite{ICTNS}. This can be automatically achieved with packages % such as \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 % (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. % % \section{Usage} % % \subsection{Mathematical constants} % % \DescribeMacro{\mathup} % As for classic functions identifiers, \emph{predefined} mathematical constants % should be typeset in upright shape (typically in roman family), % even though this practice is not very common and can be tedious % to adhere to. A first solution is to use the |\mathup| macro, % which is superior to |\mathrm| % \footnote{The \texttt{\bslash mathup} macro is based on \texttt{\bslash 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 % a better choice in \textsf{beamer} presentations to ensure that mathematical % constants are typeset in upright shape and consistent % with the default sans serif math font.}, % for setting any math text in upright shape. For example you can use % |\mathup{e}| to get the Euler's number. % % \medskip % \DescribeMacro{\e} \DescribeMacro{\i} \DescribeMacro{\j} % To avoid cluttering a document that contains many occurrences of Euler's number (e) % or imaginary numbers (i) with |\mathup{e}| or |\mathup{i}|, % the package provides the |\e| command for Euler’s number % and |\i| or |\j| for imaginary numbers. % Let us notice that |\i| and |\j| already exist in LaTeX. In LR (left-to-right) mode, % they produce `\extrafont{\i,\ \j}' without the dot, allowing you to place accents on them. % However, in mathematical mode, they produce the warning % ``\texttt{LaTeX Warning: Command \bslash i invalid in math mode on input line} % \meta{line}''. % With the new definition provided by the package, |\i| and |\j| will be redefined % specifically for mathematical mode. % % \medskip % \DescribeMacro{\MathUp} % Indeed, typing a lot of backslashes for constants like $\e$, $\i$, or $\j$ % in a document with numerous formulas can become tiresome. % To alleviate this, the package proposes a powerful solution with the macro |\MathUp|\marg{char}. % For example, when |\MathUp{e}| is called, any subsequent occurrence of $\e$ % will automatically be set in roman (upright shape), % without the need to type |\e| explicitly. The effect of this macro % can be either global or local, depending on whether it is used outside or inside an % environment or braces. % Furthermore, you can call this macro in the preamble to apply the change % from the beginning of the document. This powerful feature allows you % to bring a document up to the standards effortlessly. % In fact, |\MathUp| can be applied to any valid single character, % offering flexibility for various use cases (another use of it with probability % will be presented in section \ref{operators}). % % \medskip % \DescribeMacro{\MathIt} % When there are other occurrences of $\mathit{e}$, $\mathit{i}$ or $j$ as variables, % you can still obtain italicized $\mathit{e}$, $\mathit{i}$ or $\mathit{j}$ using \LaTeX\ % commands |\mathit| or |\mathnormal|, which are useful for a single use. % However, you also have the option to use the inverse switch |\MathIt|\marg{char}, % which has a global effect when used outside environments or braces, % or a local effect when used inside them. % Similar to |\MathUp|, |\MathIt| can be applied to any single character. % % \medskip % \DescribeMacro{\MathNumbers} \DescribeMacro{\MathNormal} % These macros enable you to set upright or normal (italic) typesetting % for multiple letters in a single command. % For instance, |\MathNumbers{e,i}| is equivalent to |\MathUp{e}\MathUp{i}|. % In |\MathNumbers|, the comma separator between letters can be modified % or removed as needed. In fact, this macro only affects the letters e, i, or j; % it has no effect on other characters. % On the other hand, |\MathNormal| can be utilized for probability as well % (refer to section \ref{operators}), and it accepts any comma-separated list of arguments. % This means you can apply the normal italic math mode typesetting to various letters % at once using |\MathNormal|. % % \medskip % \DescribeMacro{\pinumber[\meta{command}]} % The mathematical constant $\pi$ should also be typeset in upright shape % (see~\cite{TYPMA}, \cite{NIST}, \cite{ICTNS}), which is different from italicized $\itpi$. % However, this recommendation is even less commonly followed compared to the one % concerning $\e$ and $\i$~\cite{TYPMA}. % Several packages enable the typesetting of mathematical Greek letters in upright shape. % Notably, let us mention \textsf{upgreek}~\cite{GREEK}, \textsf{mathdesign}~\cite{DESIGN} % (used in the present document), \mbox{\textsf{kpfonts}}~\cite{KPF}, \textsf{fourier}~\cite{FOUR}, % \textsf{libertinust1math}, % \textsf{pxgreeks}, \textsf{txgreeks}, \textsf{libgreek}, etc. % A special mention goes to \textsf{lgrmath} of Jean-François Burnol~\cite{LGR} % which allows the use of any Greek LGR-encoded font in math mode. % These packages provide commands like |\uppi| (\textsf{upgreek}), % |\piup| (\textsf{mathdesign}, \textsf{kpfonts}, \textsf{lgrmath}), % |\otherpi| (\textsf{fourier}), etc. % \footnote{They also have options to typeset all the Greek lowercase % letters in upright shape by default, but this in not our goal here.} % To preserve default italic style for lowercase Greek letters, % with the exception of pi, and to % avoid the need to type a lot of |\uppi| or |\piup|, we offer the % macro |\pinumber|[\meta{command}]. % This macro redefines |\pi| to match % the optional command name provided (without a backslash), such as |piup|, % assuming that the appropriate package has been loaded beforehand. % % By using the preliminary code |\MathNumbers{ei}\pinumber[piup]| % (assuming the \textsf{mathdesign} package is loaded) % you can achieve the following result: % \begin{center} % |$e^{i\pi} = -1$| \quad which yields \quad $\e^{i\pi}=-1$. % \end{center} % % When you call |\pinumber| without any argument, % it defines |\pi| using the default LGR font encoding for Greek letters, % resulting in the character $\mypi$. In this case the appropriate option \texttt{LGR} % for the \textsf{fontenc} package will be automatically loaded % if the |\pinumber| command is called in the preamble (at least the first time it is used). % The pi character obtained with this setting will look the same as the one provided by % Günter Milde's \textsf{textalpha} package~\cite{ALPHA}. % This $\mypi$ character is particularly well-suited % for use with the default Computer Modern or Latin Modern font family % \footnote{This default $\mypi$ character may not always fit well with various text fonts, % especially those that are bolder or different from the default Computer Modern font. % The \textsf{upgreek} package~\cite{GREEK} provides a better $\uppi$ character % with the Symbol option, utilizing the Adobe Symbol font. This $\uppi$ character % matches well with several text fonts, such as Times.}. % % \medskip % \DescribeMacro{\itpi} % When you activate |\pinumber|, the original italic $\itpi$ % is still accessible using |\itpi|. % % \DescribeMacro{\pinormal} % In fact |\pinumber| acts as a switch, enabling the upright $\pi$. % Additionally, there is an inverse switch, % |\pinormal|, which you can call anywhere to revert to the original behavior % of the |\pi| command (italic $\itpi$). % % \subsection{Vectors (and tensors)} % % \DescribeMacro{\vect} % By default, the |\vect| command % \footnote{The definition of most macros in this package, % will only take effect if the macro has not been previously % defined by another package. This ensures compatibility and avoids conflicts % when using the \textsf{mismath} package with other \LaTeX\ packages.}, % produces vectors with arrows % (thanks to the \textsf{esvect} package by Eddie Saudrais % \footnote{\textsf{esvect} provides the \texttt{\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 % (a single letter between \texttt{a} and \texttt{h}) to define % the desired type of arrow (see~\cite{VECT}). % In \textsf{mismath}, \textsf{esvect} is loaded with the option \texttt{b}: % |\vect{AB}| gives $\vect{AB}$. % If you wish to use a different type of arrow, you must call \textsf{esvect} % with the appropriate option \emph{before} loading \textsf{mismath}. % For example, using |\usepackage[d]{esvect}| % will provide the arrows produced by default in~\cite{VECT}. % % \medskip % \DescribeMacro{\boldvect} % The |\vect| macro allows vector names to be typeset using bold italic font, % as recommended by ISO~\cite{NIST}~\cite{SI}, instead of using arrows. % By using the |\boldvect| command, you can modify the behavior of |\vect| % locally or globally, depending on its placement in the document (inside or outside % a group or an environment):\\[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} produces upright bold font, % even when used in combination with \texttt{\bslash 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|, % 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. % % \medskip % \DescribeMacro{\arrowvect} % At any moment, you can revert to the default behavior using the inverse switch % |\arrowvect|. % These switches can be placed anywhere, whether % inside mathematical mode or within an environment (with a local effect) or outside % (with a global effect). % % \medskip % \DescribeMacro{\hvect} % When vectors with arrows are typeset side by side, % the arrows can be set up slightly higher using |\hvect| % (which places a vertical phantom box containing ``$t$'') % to avoid inelegant effects. For example, writing % \begin{itemize} % \item $\vect{AB}=\hvect{u}+ \vect{AC}$, obtained with |\hvect{u}|, % is better than $\vect{AB}=\vect{u}+ \vect{AC}$; % \item $\hvect{a} \cdot \vect{b}=0$, obtained with |\hvect{a}|, % is better thant $\vect{a} \cdot \vect{b}=0$. % \end{itemize} % This adjustment ensures a more visually pleasing appearance when vectors % with arrows are combined in an equation. % The |\boldvect| and |\arrowvect| switches have the same effect on |\hvect| % as they do on |\vect|. % % \DescribeMacro{\hvec} % In a similar way, |\hvec| raises the little arrow produced by % the \LaTeX\ command |\vec|, to the height of the letter ``$t$'' % (but |\boldvect| have no effect here): % \begin{itemize} % \item $\mathcal{P}=\vec{f}\cdot\hvec{v}$, obtained with |\hvec{v}|, % is better than $\mathcal{P}=\vec{f}\cdot\vec{v}$. % \item $\vec{f} =m \hvec{a}$, obtained with |\hvec{a}|, % is better than $\vec{f} =m \vec{a}$. % \end{itemize} % % \DescribeMacro{\norm} % The norm of a vector is conventionally represented using the delimiters |\lVert| and |\rVert| % (or \texttt{\bslash}$\mid$ unless a plus (+) or minus (-) sign follows the opening delimiter) % or |\left\Vert| and |\right\Vert| % for adaptive delimiters. Unfortunately, these delimiters % are always vertically centered, relatively to the middle of the base line, % whereas vectors with arrows are asymmetric objects. % The code |$\norm{\vec{h}}$| raises a smaller double bar to produce $\norm{\vec{h}}$ % instead of $\left\Vert \vec{h} \right\Vert$. % Let's notice that the height of the bars don't adjust to content, % but however to context: main text, subscripts or exponents, % \eg $\e^{\norm{\vec{h}}}$. % This macro is useful only for arguments of special height, such as $\vec{h}$ or $\vect{AB}$ % and may give bad results in other situations. % % \medskip % \DescribeMacro{\mathbfsfit}\DescribeMacro{\tensor} % For tensors symbols, ISO rules recommend using % sans serif bold italic, but there % is no such math alphabet in the default \TeX\ mathematical style. % However, the \textsf{mismath} package defines this alphabet % (assuming the font encoding and package you use permits it) % and provides the macro |\mathbfsfit| or its alias |\tensor|. % By using |\tensor{T}| you can produce $\tensor{T}$. % % \subsection{Standard operator names}\label{operators} % % \DescribeMacro{\di} % The \emph{differential} operator should be typeset in upright shape, not in % italics, to distinguish it from variables % (as mentioned in \cite{TYPMA}~\cite{NIST}~\cite{ICTNS}~\cite{LSHORT}). % To achieve this, we provide the |\di| command. % Take a look at the following examples (notice the thin spaces before the d, % just like with classic function's names): \\ % \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 represent \emph{distance} (hence its name): % \[\lambda\di(A, \mathcal{F})+\mu\di(B, \mathcal{H}).\] % % \DescribeMacro{\P} \DescribeMacro{\E} % To refer to probability % \footnote{\LaTeX\ provides also \texttt{\bslash Pr} which gives $\Pr$.} % and expectation the proper use is to typeset the capital letters $\P$, $\E$ % in roman just like any standard function identifier. % This can be achieved with |\P| and |\E| commands. % % \DescribeMacro{\Par} % The |\P| command already existed to refer to the end of paragraph symbol \Par\ % and has been redefined, but this symbol can still be obtained with |\Par|. % % \medskip % \DescribeMacro{\V} % Variance is generally denoted by $\var$ or $\Var$ (see table below), % but some authors prefer to use $\V$, which can be produced using |\V|. % % \DescribeMacro{\MathProba}\DescribeMacro{\MathNormal} % In the same way as for $\e$, $\i$ or $\j$, you can use |\MathUp{P}|, |\MathUp{E}| % or |\MathUp{V}| to avoid typing many |\P|, |\E| or |\V|. % However you can also achieve this in a single command with |\MathProba|, % for example |\MathProba{P,E}|. We get the inverse switch with % |\MathIt| for any individual letter or |\MathNormal| for a list. % % \medskip % \DescribeMacro{\probastyle} % Some authors use ``blackboard bold'' font to represent probability, expectation % and variance: $\mathbb{P}, \mathbb{E}, \mathbb{V}$. % The |\probastyle| macro sets the appearance of |\P|, |\E| and |\V|. % For instance |\renewcommand\probastyle{\mathbb}| % \footnote{The effect of this redefinition is global or local to the container environment % in which it is used.} % brings the previous ``openwork'' letters. % The |\mathbb| command comes from \textsf{amsfonts} package % (loaded by \textsf{amssymb} but also available standalone) % which needs to be called in the preamble. % % \medskip % The following standard operator names are defined in \textsf{mismath}: % \begin{center} % \begin{tabular}{rlrlrl} % |\adj| & $\adj$ \qquad\mbox{} & |\erf| & $\erf$ \qquad\mbox{} & |\Re| & $\Re$ \\ % |\Aut| & $\Aut$ & |\grad| & $\grad$ & |\rot| & $\rot$ \\ % |\codim| & $\codim$ & |\id| & $\id$ & |\sgn| & $\sgn$ \\ % |\Conv| & $\Conv$ & |\Id| & $\Id$ & |\sinc| & $\sinc$ \\ % |\cov| & $\cov$ & |\im| & $\im$ & |\spa| & $\spa$ \\ % |\Cov| & $\Cov$ & |\Im| & $\Im$ & |\tr| & $\tr$ \\ % |\curl| & $\curl$ & |\lb| & $\lb$ & |\var| & $\var$ \\ % |\divg| & $\divg$ & |\lcm| & $ \lcm$ & |\Var| & $\Var$ \\ % |\End| & $\End$ & |\rank| & $\rank$ & |\Zu| & $\Zu$ % \end{tabular} % \end{center} % % By default, operators returning vectors, |\grad| and |\curl| (or its synonym |\rot| % rather used in Europe), are written with an arrow on the top. % When |\boldvect| is activated, they are typeset in bold style: % $\boldvect \grad, \curl, \rot$. % For the variance, the covariance and the identity function, % two notations are proposed, with or without a first capital letter, % because both are very common. % On the other hand, `$\im$' stands for the image of a linear transformation % (like `$\ker$' for the kernel) % whereas `$\Im$' is the imaginary part of a complex number. % Please note that |\div| already exists ($\div$) and |\span| is a \TeX\ primitive % (used in |\multicolumn|); % they haven't been redefined. Therefore the provided macros are called |\divg| (divergence) % and |\spa| (span of a set of vectors). % Furthermore |\Z| is used to denote the set of integers (see \ref{aliases}), % which is why we used |\Zu|, % to designate the center of a group: $\Zu(G)$ (from German Zentrum). % %\medskip % \DescribeMacro{\oldRe} \DescribeMacro{\oldIm} % The |\Re| and |\Im| macros already existed to refer to real and imaginary part % of a complex number, producing outdated symbols $\oldRe$ and $\oldIm$. % However, they have been redefined according to current usage, % as mentioned in the above table. Nevertheless, % it is still possible to obtain the old symbols with |\oldRe| and |\oldIm|. % % \medskip % The package \textsf{mismath} also provides some (inverse) circular or hyperbolic functions, % that are missing in \LaTeX: % \begin{center} % \begin{tabular}{rlrlrl} % |\arccot| & $\arccot$\qquad\mbox{} & |\arsinh| & $\arsinh$\qquad\mbox{} % & |\arcoth| & $\arcoth$ \\ % |\sech| & $\sech$ & |\arcosh| & $\arcosh$ & |\arsech| & $\arsech$ \\ % |\csch| & $\csch$ & |\artanh| & $\artanh$ & |\arcsch| & $\arcsch$ % \end{tabular} % \end{center} % % \DescribeMacro{\bigO} \DescribeMacro{\bigo} \DescribeMacro{\lito} % Asymptotic comparison operators (in Landau notation) are obtained with % |\bigO| or |\bigo| and |\lito| commands: % \[ n^2+\bigO(n\log n) \txt{or} n^2+\bigo(n\log n)\txt{and} \e^x=1+x+\lito(x^2).\] % % \subsection{A few useful aliases} \label{aliases} % % In the tradition of Bourbaki and D.~Knuth, proper use requires % that classic sets of numbers are typeset in bold roman: % $\R, \C, \Z, \N, \Q$, % whereas ``openwork'' letters ($\mathbb{R}, \mathbb{Z}, \ldots$) % are reserved for writing at the blackboard~\cite{LSHORT}. % Similarly, to designate a field we use $\F$ or $\K$ (Körper in German). % We get obtain these symbols with the following macros: % \begin{center} % |\R|, |\C|, |\Z|, |\N|, |\Q|, |\F|, |\K|. % \end{center} % % \DescribeMacro{\mathset} % The |\mathset| command enables you to change the behavior % of all these macros in a global way. % By default, |\mathset| is an alias for |\mathbf|, but if you prefer openwork letters, % you can simply place |\renewcommand\mathset{\mathbb}| where you want, % for instance in the preamble after loading the \textsf{amsfonts} package % (which provides the ``blackboard bold'' typeface, % also loaded by \textsf{amssymb}). % % \smallskip % \DescribeMacro{\onlymathC} % The macro |\onlymathC| is designed for cases when |\C| is already defined, % but only in text mode (usually when loading the Russian language with \textsf{babel} % or \textsf{polyglossia}). The macro preserves the original definition for text mode % and allows you to use |\C| for the complex number set in math mode. % For this purpose, simply call |\onlymathC| once in the preamble or anywhere in the document. % % \medskip % \DescribeMacro{\ds} % The |\displaystyle| command is very common, so the |\ds| alias is provided. % Not only it eases typing but also it makes source code more readable. % % \medskip % Symbols with limits behave differently for in-line formulas or for displayed equations. % In the latter case, ``limits'' are placed under or above the symbol % whereas for in-line math mode, % they are placed on the right, as a subscript or exponent. Compare: % $\zeta(s)=\sum_{n=1}^{\infty }\frac{1}{n^s}$ with % \[\zeta(s)=\sum_{n=1}^{\infty}\frac{1}{n^s}.\] % % \DescribeMacro{\dlim} \DescribeMacro{\dsum} \DescribeMacro{\dprod} % \DescribeMacro{\dcup} \DescribeMacro{\dcap} % With in-line math mode, displaymath behavior can be forced with |\displaystyle| % or its alias |\ds|. However, when using these commands, all the rest of the current % mathematical environment will be set in displaymath mode % (as shown in the previous example, where the fraction will be expanded). % To limit the display style effect to the affected symbol only, % similar the the \textsf{amsmath} command |\dfrac|, % we can use the following macros: % |\dlim|, |\dsum|, |\dprod|, |\dcup|, |\dcap|. % So % \begin{center} % |$\dlim_{x\to +\infty}\frac{1}{x}$| \quad yields \quad $\dlim_{x \to +\infty}\frac{1}{x}$. % \end{center} % % \DescribeMacro{\lbar} \DescribeMacro{\hlbar} % Large bars over expressions are obtained with |\overline| % or its alias |\lbar|, to get for instance $\lbar{z_1z_2}$. % Similar to vectors, you can raise the bar (from the height of ``$h$'') with % the |\hlbar| command, to correct uneven bars heights. % \begin{center} % $\lbar{z+z'}=\hlbar{z}+\lbar{z'}$, obtained with |\hlbar{z}|, % is better than $\lbar{z+z'}=\lbar{z}+\lbar{z'}$. % \end{center} % % \DescribeMacro{\eqdef} \DescribeMacro{\eqdef*} % The |\eqdef| macro writes the equality symbol topped with `def' % or with `$\scriptstyle \Delta$' for |\eqdef*| % (thanks to the \LaTeX\ command |\stackrel|): % % \bigskip % \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} % % \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 and improved version % of the \texttt{\bslash underbrace} command, along with 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 % just like the standard macro |\iff| does it with $\Longleftrightarrow$. % Similarly, the |\txt|, \DescribeMacro{\txt} % based on the |\text| macro from the \textsf{amstext} package % (loaded by \textsf{amsmath}), % leaves em quad spaces (|\quad|) around the text. See the following example: % \begin{center} % |\[ \ln x=a \then x=\e^a, \txt{rather than}| \\ % | \ln x=a \Longrightarrow x=\e^a \]| \\[1ex] % $ \ln x=a \then x=\e^a, \txt{rather than} \ln x=a \Longrightarrow x=\e^a$ % \end{center} % % \DescribeMacro{\mul} % The multiplication symbol obtained with |\times| produces the same spacing as addition % or subtraction operators, whereas division obtained with $/$ is closer to its operands. % This actually hides the priority of multiplication over $+$ and $-$. % That's why we provide the |\mul| macro, behaving like $/$ % (ordinary symbol) and leaving less space around than |\times|: % \begin{center} % $\lambda+\alpha \mul b-\beta \mul c$, obtained with |\mul|, % is better than $\lambda+\alpha \times b-\beta \times c$. % \end{center} % % When using |\mul| before a function name or around a |\left...\right| structure, % the space may be too large on one side of |\mul|. % To ensure the same amount of space on both sides of |\mul|, % you can use thin negative spaces |\!| % or enclose the function or structure with braces: % \begin{center} % $x\mul{\sin x}$, obtained with |x\mul{\sin x}|, is slightly better than $x\mul\sin x$.\\[1ex] % |$\sin\!{\left( \frac{\pi}{3} \right)} \mul 2$| \quad gives\\ % $\sin\!{\left(\frac{\pi}{3}\right)}\mul 2$ which is better than % $\sin\left(\frac{\pi}{3}\right)\mul 2$. % \end{center} % The thin negative space after the function name is not relative to |\mul|, % but is due to the fact that spaces around a |\left...\right| structure % are bigger than those produced by single parenthesis |(...)|. % % \medskip % \DescribeMacro{\pow} % In the same way, when typesetting an exponent after a closing \emph{big} % parenthesis produced by |\right)|, % the exponent appears to be a little to far from the parenthesis. % To address this issue, the |\pow|\marg{expr}\marg{pow} command is provided, which sets % \meta{expr} between parentheses and adjusts the positioning of the exponent \meta{pow} % slightly closer to the right parenthesis % \footnote{This macro gives bad results with normal-sized parenthesis.}. % Compare: % \[ \e^a \sim\pow{1+\frac{a}{n}}{n} \txt{which may be better than} % \e^a \sim\left(1+\frac{a}{n}\right)^{n}.\] % % \DescribeMacro{\abs} % The correct typesetting of absolute value (or modular for a complex number) is achieved % using |\lvert| \ldots |\rvert|, rather than $\mid$, as the latter doesn't maintain % proper spacing in some situations (when a sign follows the open delimiter). % For bars whose height has to adapt to the content, % we can use |\left\vert| \ldots |\right\vert| or, more simply, % the |\abs|\{\ldots\} command, which is equivalent % \footnote{Another solution is to define \texttt{\bslash abs} % using the \texttt{\bslash DeclarePairedDelimiter} command % from the \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} % \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} % % \medskip % \DescribeMacro{[ibrackets]} % Open intervals are commonly represented with parenthesis, \eg $(0, +\infty)$, % but sometimes square brackets are used, especially in French mathematics: $]0, +\infty[$. % In that specific case, the space around the square brackets is often inappropriate, % as in the expression $x \in \mathclose{]} 0, +\infty[$. % To address this issue, we have redefined the brackets in the \textsf{ibrackets} % package~\cite{BRACKET} % which can be optionally % \footnote{This functionality is optional because it causes % errors when using a command defined by % \texttt{\bslash DeclarePairedDelimiter}~\cite{TOOL} with square brackets.} % loaded by \textsf{mismath} using the \texttt{ibrackets} package option % \footnote{It is the only option specific to the \textsf{mismath} package.}. % % 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, the symbols $[$ and $]$ % and are not defined by default as delimiters. % Therefore, a line break could occur between the two brackets. However, % it is always possible to transform them % into delimiters using |\left| and |\right|. % % With the \textsf{ibrackets} package, brackets are set as ``active'' characters, % behaving like ordinary characters in most cases. % However, when a bracket is \emph{immediately} followed by a + or - character, % it becomes an open delimiter. % Therefore, when the left bound contains an operator sign, % \emph{you don't have to leave a space between the first bracket and the sign}, % otherwise, the spaces surrounding the operator will be too large. % For example if you write |$x \in ] -\infty, 0]$|, it yields $x \in ] -\infty, 0]$ % instead of $x \in ]-\infty, 0]$. % Conversely, when dealing with algebraic expressions involving intervals, % \emph{you must leave a blank space between the second bracket and the} +/- % \emph{operations}. % For instance |$[a, b] + [c, d]$| yields $[a, b] + [c, d]$ % but |$[a, b]+ [c, d]$| yields $[a, b]+ [c, d]$. % % Besides, there are other approaches, for example the |\interval| macro % from the \textsf{interval} package~\cite{INT}, % or |\DeclarePairedDelimiters| from the \textsf{mathtools} package~\cite{TOOL} % (but the latter is incompatible with \textsf{ibrackets} % for managing brackets). % % \subsection{Environments for systems of equations and small matrices} % % \DescribeEnv{system} % The \texttt{system} environment, defined in the \textsf{mismath} package, % is used to represent a system of equations:\\ % \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 achieved using the \texttt{cases} environment % from the \textsf{amsmath} package, although \texttt{cases} places mathematical expressions % closer to the bracket. % The |\systemsep| command allows you to adjust the gap between % the bracket and the expressions. % By default, the gap is set to |\medspace|. You can reduce the gap by redefining the command, % for instance: |\renewcommand{\systemsep}{\thinspace}|. % Alternatively you can increase the gap using |\thickspace| % (and with |\renewcommand\systemsep}{}| you can achieve the same spacing as the % \texttt{cases} environment). % The |\systemsep| command allows for greater flexibility in adjusting the spacing % within the \texttt{system} environment. % % \medskip % \DescribeEnv{system\oarg{coldef}} % By default, a system is written like an \texttt{array} environment with only one column, % left aligned. However the \texttt{system} environment has an optional % argument that allows to create systems with multiple columns, % specifying their alignment using the same syntax as the \texttt{array} environment in % \LaTeX. For instance, using |\begin{system}[cl]| will produce a two-column system, % with the first column centered and % the second column left-aligned, as shown in the following example:\\ % \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} % The default spacing between the lines of a \texttt{system} environment has been slightly % enlarged compared to the one used in \texttt{array} environments (using a factor of 1.2). % This can be adjusted by using % |\renewcommand{\systemstretch}|\marg{stretch}, where \meta{stretch} is the desired value % for the spacing. You can place this command % inside the current mathematical environment for a local change, or outside % for a global change. The default value for is 1.2. % Furthermore you can also use the end of the line with a spacing option, as % demonstrated above with |\\[1ex]|, to control the spacing between specific lines in % the system. % % Another example with |\begin{system}[rl@{\quad}l]| % \footnote{\texttt{@\{\ldots\}} sets inter-column space.}: % \begin{equation*} % \begin{system}[rl@{\quad}l] % x+3y+5z&=0 & R_1\\ 2x+2y-z&=3 & R_2\\ 3x-y+z&=2 & R_3 % \end{system} % \iff % \begin{system}[rl@{\quad}l] % x+3y+5z&=0 & R_1\\ % 4y+11z&=3 & R_2 \gets 2R_1-R_2 \\ % 5y+7z&=-1 & R_3 \gets \frac{1}{2}\left(3R_1-R_3\right) % \end{system} % \end{equation*} % % Let's also mention the \textsf{systeme} package~\cite{SYST} which provides % a lighter syntax and automatic alignments for linear systems. % Additionally, there is the \textsf{spalign} package~\cite{SPAL}, % which offers a convenient and easy syntax for systems and matrices with % visually appealing alignments. % % \medskip % \DescribeEnv{spmatrix} % The \textsf{amsmath} package offers several environments to typeset matrices : % For example, the \texttt{pmatrix} environment surrounds the matrix with parenthesis, % and the \texttt{smallmatrix} environment creates a smaller matrix suitable for insertion % within a text line. We provide a combination of the these both % functionalities with the \texttt{spmatrix} environment: % |$\vec{u}\begin{spmatrix}-1\\2\end{spmatrix}$| yielding % $\vec{u}\begin{spmatrix}-1\\2\end{spmatrix}$. % % The \textsf{mathtools} package enhances the \textsf{amsmath} matrix environments % and also provides a small matrix environment with parenthesis: \texttt{psmallmatrix}. % Moreover, with the starred version |\begin{psmallmatrix*}|\oarg{col}, % you can choose the alignment inside the columns (\texttt{c}, \texttt{l} or \texttt{r}). % However, the space before the left parenthesis is unfortunately too narrow % compared to the space inside the parenthesis. % To illustrate this, consider the following comparison: % $\vec{u}\begin{spmatrix}-1\\2\end{spmatrix}$ (using \textsf{mismath}'s \texttt{spmatrix}) % vs.\@ $\vec{u}\begin{psmallmatrix}-1\\2\end{psmallmatrix}$ % (using \textsf{mathtools} \texttt{psmallmatrix}). % % \medskip % For typesetting various kinds of matrices, let's mention the excellent % \textsf{nicematrix} package by François Pantigny~\cite{NMATX}. % % \subsection{Displaymath in double columns} % % \DescribeEnv{mathcols} % The \texttt{mathcols} environment allows you to arrange % ``long'' calculations in double columns, separated with a central rule, % as shown in the following example. % However, to use this feature, the \textsf{multicol} package must be loaded in the preamble. % The \texttt{mathcols} environment activates mathematical mode % in display style and 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 \\ % \iff\ & 0.001 \geq \frac{1.998}{4^n} \\ % \changecol % & \iff 4^n \geq 1998 \\ % & \iff n \ln 4 \geq \ln(1998) \\ % & \iff n \geq \frac{\ln(1998)}{\ln 4} \approx 5.4 \\ % & \iff n \geq 6 % \end{mathcols} % % \DescribeMacro{\changecol} % The |\changecol| macro is used to switch to the next column, % and an alignment within the column is done using the classic delimiters % |&| to separate entries and |\\| to start a new row. % % \begin{verbatim} %\begin{mathcols} % & \frac{1}{2 \mul {\pow{\frac{1}{4}}{n}} + 1} \geq 0.999 \\ % \iff\ & 1 \geq 1.998 \pow{\frac{1}{4}}{n} + 0.999 \\ % \iff\ & 0.001 \geq \frac{1.998}{4^n} \\ %\changecol % & \iff 4^n \geq 1998 \\ % & \iff n \ln 4 \geq \ln(1998) \\ % & \iff n \geq \frac{\ln(1998)}{\ln 4} \approx 5.4 \\ % & \iff n \geq 6 %\end{mathcols} % \end{verbatim} % % \vspace{-4ex} % \subsection{Deprecated commands} % % Here is a summary table of the deprecated commands that were used until version 2.2. % These commands are still functional and will be maintained for the time being, % but they do produce a warning message. % They used to work only in the preamble, affecting the entire document globally, % and lacked an inverse switch. % As a result, these deprecated commands are now being replaced by the more % versatile and powerful |\MathUp| macro, which can be used anywhere % in the document or preamble and has an inverse switch |\MathIt|. % % \begin{center} % \setlength{\extrarowheight}{1pt} % \begin{tabular}{ll} % \hline % Deprecated command & New alternative \\ % \hline % |\enumber| & |\MathUp{e}| \\ % |\inumber| & |\MathUp{i}| \\ % |\jnumber| & |\MathUp{j}| \\ % |\PEupright| & |\MathUp{P}\MathUp{E}| \\ % \hline % \end{tabular} % \end{center} % % \medskip % You can also utilize|\MathNumbers| instead of |\MathUp| with an argument containing % all the constants you want to be typeset in roman (among `e, i, j'). % Additionally |\MathProba{P,E}| can be used instead of |\MathUp{P}\MathUp{E}|, % and you can include V in its argument to refer to variance. % % \medskip % In version 2.3 we attempted to replace these deprecated commands % with package options based on keyval. However, we found that this method was % less efficient and have decided to abandon it. % As a result, the command |\mismathset| is now obsolete. % Additionally, the command, |\paren|, which was used before version 2.0, % is no longer supported. % % \StopEventually{} % \section{Implementation} % % \begin{macrocode} \newif\ifmm@ibrackets % initialized to false \DeclareOption{ibrackets}{\mm@ibracketstrue} \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{amsmath}} \ProcessOptions \relax \@ifpackageloaded{amsmath}{}{\RequirePackage{amsmath}} \@ifpackageloaded{mathtools}{}{\RequirePackage{mathtools}} \@ifpackageloaded{esvect}{}{\RequirePackage[b]{esvect}} \RequirePackage{ifthen} \RequirePackage{xparse} % for \NewDocumentCommand \RequirePackage{xspace} \RequirePackage{iftex} \ifmm@ibrackets\RequirePackage{ibrackets}\fi % \end{macrocode} % The above conditional packages loading prevents ``option clash'' errors in case % these packages have been previously loaded previously with different options. % % \medskip % \DescribeMacro{\bslash} % The |\bslash| macro originates from Frank Mittelbach's \textsf{doc.sty} package. % It can be employed in other documents as an alternative to |\textbackslash|, % especially in situations where |\textbackslash| does not work correctly, such as % inside warning messages. % \begin{macrocode} {\catcode`\|=\z@ \catcode`\\=12 |gdef|bslash{\}} % \bslash command % \end{macrocode} % % \medskip % \DescribeMacro{\mm@warning} \DescribeMacro{\mm@macro} \DescribeMacro{\mm@operator} % The next three internal macros serve as meta commands for % conditionally defining macros while providing a warning message if the macro already exists. % These macros can be useful in other packages as well. % \medskip % \begin{macrocode} \newcommand\mm@warning[1]{ \PackageWarningNoLine{mismath}{ Command \bslash #1 already exist and will not be redefined} } \newcommand\mm@macro[2]{ \@ifundefined{#1}{ \expandafter\def\csname #1\endcsname{#2} }{\mm@warning{#1}} } \NewDocumentCommand\mm@operator{O{#3}mm}{% \@ifundefined{#1}{ \DeclareMathOperator{#2}{#3} }{\mm@warning{#1}} } % \end{macrocode} % % To produce the correct upright shape font when working % with the \textsf{beamer} package, you don't have to use |\mathrm| % but rather |\mathup| (based on |\operatorfont| from the \textsf{amsopn} package). % This command also works fine with other sans serif fonts like \textsf{cmbright}. % % Moreover for \textsf{beamer}, which changes the default font family (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 \mm@macro{e}{\mathup{e}} \AtBeginDocument{\let\oldi\i \let\oldj\j \renewcommand{\i}{\TextOrMath{\oldi}{\mathup{i}}} \renewcommand{\j}{\TextOrMath{\oldj}{\mathup{j}}} } % \end{macrocode} % % 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. % To obtain a letter in roman style instead of italic, we need to change the % mathcode digit that represents the font family: 1 to 0. % % For example, except for \LuaLaTeX, mathcode of the `e' letter is: % `e="7165 (decimal 29029), with the second digit `1' indicating ``italic'' style. % To get a roman `e', we need to change its mathcode to "7065. % % When used in the preamble, 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}|. % \medskip % \begin{macrocode} \newcount\mm@charcode \newcount\mm@charclass \newcount\mm@charfam \newcount\mm@charslot \newcommand*\math@family[2]{% \mm@charfam=#2 \ifluatex \mm@charclass=\Umathcharclass`#1 %\mm@charfam=\Umathcharfam`#1 \mm@charslot=\Umathcharslot`#1 \Umathcode`#1= \mm@charclass \mm@charfam \mm@charslot \else \mm@charcode=\mathcode`#1 % extract charclass \@tempcnta=\mm@charcode \divide\@tempcnta by "1000 \multiply\@tempcnta by "1000 % charclass \mm@charclass=\@tempcnta % extract charslot \@tempcnta=\mm@charcode \@tempcntb=\mm@charcode \divide\@tempcnta by "100 \multiply\@tempcnta by "100 % charclass + charfam \advance\@tempcntb by -\@tempcnta % charslot \mm@charslot=\@tempcntb % construct charcode \mm@charcode=\mm@charclass \multiply\mm@charfam by "100 \advance\mm@charcode by \mm@charfam \advance\mm@charcode by \mm@charslot \mathcode`#1=\mm@charcode \fi } \newcommand*\MathFamily[2]{% \ifx\@onlypreamble\@notprerr \math@family{#1}{#2} \else % before \begin{document} \AtBeginDocument{\math@family{#1}{#2}} \fi } \newcommand*\MathUp[1]{\MathFamily{#1}{0}} \newcommand*\MathIt[1]{\MathFamily{#1}{1}} % \end{macrocode} % With a similar approach we could also create additional macros to set any letter % in bold or sans serif. However, there is no default family number associated % with these typefaces. The family number depends on the font package being loaded and % may vary depending on specific |\DeclareSymbolFont| used. % Therefore, setting letters in bold or sans serif requires additional consideration % and may not have a straightforward solution. % % \medskip % In addition to |\MathUp| and |\MathIt|, we also offer the following two commands % to set a group of letters in roman typeface: one for for mathematical constants, % among `e, i, j', and the other for probability operators, among or `P, E, V'. % % \medskip % \begin{macrocode} \newcommand*\MathNumbers[1]{% \in@{e}{#1} \ifin@ \MathUp{e} \fi \in@{i}{#1} \ifin@ \MathUp{i} \fi \in@{j}{#1} \ifin@ \MathUp{j} \fi } \newcommand*\MathProba[1]{% \in@{P}{#1} \ifin@ \MathUp{P} \fi \in@{E}{#1} \ifin@ \MathUp{E} \fi \in@{V}{#1} \ifin@ \MathUp{V} \fi } % \end{macrocode} % \DescribeMacro{\apply} % With the inverse global switch |\MathNormal|, you can apply the normal (italic) style % on any comma-separated list of characters. This is achieved using % the |\apply| macro, for example |\apply\macro{arg1,arg2}| % expands to |\macro{arg1}\macro{arg2}|. % So using |\apply\MathUp{e,i,j}| is equivalent to |\MathUp{e}\MathUp{i}\MathUp{j}|. % I discovered this powerfull macro on Tex RSSing.com by searching for % ``TeX How to iterate over a comma separated list?'' % The answer was provided by a user named ``wipet'' on 2021/02/26. % I don't know who is wipet but I am grateful for his contribution, % as this macro allows us to accomplish the task 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 considered as the single character `A'. % % \medskip % \begin{macrocode} \def\apply#1#2{\apply@#1#2,\apply@,} \def\apply@#1#2,{\ifx\apply@#2\empty \else #1{#2}\afterfi@{\apply@#1}\fi} \def\afterfi@#1#2\fi{\fi#1} \newcommand*\MathNormal[1]{% list argument \apply\MathIt{#1} } % \end{macrocode} % % The following commands are deprecated but still work. % They were intended to set some letters in upright shape % in math mode, but only worked in the preamble. % This is now managed by the more powerful |\MathUp| command, and % the old commands are maintained for compatibility reasons. % \medskip % % \begin{macrocode} \newcommand{\enumber}{% \PackageWarning{mismath}{Command \string\enumber\space is deprecated, \MessageBreak use \bslash MathUp{e} instead} \MathUp{e} } \newcommand{\inumber}{% \PackageWarning{mismath}{Command \string\inumber\space is deprecated, \MessageBreak use \bslash MathUp{i} instead} \MathUp{i} } \newcommand{\jnumber}{ \PackageWarning{mismath}{Command \string\jnumber\space is deprecated, \MessageBreak use \bslash MathUp{j} instead} \MathUp{j} } \newcommand{\PEupright}{ \PackageWarning{mismath}{Command \string\PEupright\space is deprecated, \MessageBreak use \bslash MathUp{P} and \bslash MathUp{R} instead} \MathUp{P}\MathUp{E} } % \end{macrocode} % % The 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. % \medskip % \begin{macrocode} \newcommand*\pinumber[1][]{ \@ifundefined{itpi}{\let\itpi\pi}{} \ifthenelse{\equal{#1}{}}{ \ifx\@onlypreamble\@notprerr \@ifundefined{savedpi}{ \PackageWarning{mismath}{% \bslash pinumber without argument\MessageBreak must be used in the preamble first\MessageBreak to load LGR fontenc for upright pi} }{\let\pi\savedpi} \else % in the preamble \RequirePackage[LGR,T1]{fontenc} \DeclareSymbolFont{UpGr}{LGR}{lmr}{m}{n} \let\pi\relax \DeclareMathSymbol{\pi}\mathalpha{UpGr}{"70} \let\savedpi\pi \fi }{ \@ifundefined{#1}{ \PackageWarning{mismath}{% Value #1 must be a valid command name\MessageBreak for pinumber, but command \bslash #1\space is undefined.\MessageBreak Perhaps a missing package} }{\renewcommand{\pi}{% \csname #1\endcsname} } } } \newcommand{\pinormal}{\@ifundefined{itpi}{}{\let\pi\itpi}} % \end{macrocode} % % And now the commands for vectors (and tensors). % \medskip % \begin{macrocode} \newboolean{arrowvect} \setboolean{arrowvect}{true} \newcommand{\arrowvect}{\setboolean{arrowvect}{true}} \newcommand{\boldvect}{\setboolean{arrowvect}{false}} \newcommand{\boldvectcommand}{\boldsymbol} % from amsbsy package \mm@macro{vect}{\ifthenelse{\boolean{arrowvect}}{ \vv}{\boldvectcommand}} % doesn't work well with \if... \fi \newcommand*{\hvect}[1]{\vect{\vphantom{t}#1}} \newcommand*{\hvec}[1]{\vec{\vphantom{t}#1}} \newcommand*{\@norm}[1]{ \mbox{\raisebox{1.75pt}{\small$\bigl\Vert$}} #1 \mbox{\raisebox{1.75pt}{\small$\bigr\Vert$}} } % works better than with relative length \newcommand*{\@@norm}[1]{ \mbox{\footnotesize\raisebox{1pt}{$\Vert$}} #1 \mbox{\footnotesize\raisebox{1pt}{$\Vert$}} } \newcommand*{\@@@norm}[1]{ \mbox{\tiny\raisebox{1pt}{$\Vert$}} #1 \mbox{\tiny\raisebox{1pt}{$\Vert$}} } \@ifundefined{norm}{\providecommand*{\norm}[1]{ \mathchoice{\@norm{#1}}{\@norm{#1}}{\@@norm{#1}}{\@@@norm{#1}} } }{\mm@warning{norm} } % bad result with libertinust1math \DeclareMathAlphabet{\mathbfsfit}{\encodingdefault}{\sfdefault}{bx}{it} \newcommand{\tensor}{\mathbfsfit} % isomath uses \mathsfbfit % \end{macrocode} % % Classic identifiers are presented below. % \medskip % \begin{macrocode} \mm@macro{di}{\mathop{}\!\mathup{d}} \newcommand\probastyle{} \let\Par\P % end of paragraph symbol \renewcommand{\P}{\operatorname{\probastyle{P}}} \mm@macro{E}{\operatorname{\probastyle{E}}} \mm@macro{V}{\operatorname{\probastyle{V}}} \mm@operator{\adj}{adj} \mm@operator{\Aut}{Aut} \mm@operator{\codim}{codim} \mm@operator{\Conv}{Conv} \mm@operator{\cov}{cov} \mm@operator{\Cov}{Cov} \mm@macro{curl}{\operatorname{\vect{\mathup{curl}}}} \mm@operator[divg]{\divg}{div} \mm@operator{\End}{End} \mm@operator{\erf}{erf} \mm@macro{grad}{\operatorname{\vect{\mathup{grad}}}} \mm@operator{\id}{id} % mathop or mathord ? \mm@operator{\Id}{Id} \mm@operator{\im}{im} \let\oldIm\Im \renewcommand{\Im}{\operatorname{Im}} \mm@operator{\lb}{lb} \mm@operator{\lcm}{lcm} \mm@operator{\rank}{rank} \let\oldRe\Re \renewcommand{\Re}{\operatorname{Re}} \mm@macro{rot}{\operatorname{\vect{\mathup{rot}}}} \mm@operator{\sgn}{sgn} \mm@operator{\sinc}{sinc} \mm@operator[spa]{\spa}{span} \mm@operator{\tr}{tr} \mm@operator{\var}{var} \mm@operator{\Var}{Var} \mm@operator[Zu]{\Zu}{Z} \mm@operator{\arccot}{arccot} \mm@operator{\sech}{sech} \mm@operator{\csch}{csch} \mm@operator{\arsinh}{arsinh} \mm@operator{\arcosh}{arcosh} \mm@operator{\artanh}{artanh} \mm@operator{\arcoth}{arcoth} \mm@operator{\arsech}{arsech} \mm@operator{\arcsch}{arcsch} \mm@operator[bigO]{\bigO}{\mathcal{O}} \mm@operator[bigo]{\bigo}{O} \mm@operator[lito]{\lito}{o} % \end{macrocode} % And finally we present the remaining macros. % % With Cyrillic languages, the command |\C| may already be defined (only for text mode). % Thus, it will not be redefined by \textsf{mismath}. However, one may still want % to use our |\C| macro only for math mode without interfering the definition of % the text |\C|, therefore the |\onlymathC| macro. % \medskip % \begin{macrocode} \mm@macro{mathset}{\mathbf} \mm@macro{R}{\mathset{R}} \mm@macro{C}{\mathset{C}} \providecommand\onlymathC{\let\oldC\C \renewcommand{\C}{\TextOrMath{\oldC}{\mathset{C}}} } \mm@macro{N}{\mathset{N}} \mm@macro{Z}{\mathset{Z}} \mm@macro{Q}{\mathset{Q}} \mm@macro{F}{\mathset{F}} \mm@macro{K}{\mathset{K}} \mm@macro{ds}{\displaystyle} \mm@macro{dlim}{\lim\limits} \mm@macro{dsum}{\sum\limits} \mm@macro{dprod}{\prod\limits} \mm@macro{dcup}{\bigcup\limits} \mm@macro{dcap}{\bigcap\limits} \mm@macro{lbar}{\overline} \@ifundefined{hlbar}{ \providecommand*{\hlbar}[1]{\overline{\vphantom{t}#1}}}{ \mm@warning{hlbar} } \newcommand\@eqdef{\stackrel{\mathup{def}}{=}} \newcommand\@@eqdef{\stackrel{\mathrm{\Delta}}{=}} \mm@macro{eqdef}{\@ifstar{\@@eqdef}{\@eqdef}} \mm@macro{unbr}{\underbrace} \mm@macro{iif}{if and only if\xspace} % \end{macrocode} % Above, we have used |\mathrm| before |\Delta| in case of defining capital Greek letters % in italics (for example with the \textsf{fixmath} package). % The use of |\mbox{}| ensures that the space produced by |\| in the |\then| macro % is not suppressed in tables. % \medskip % \begin{macrocode} \mm@macro{then}{\ \Longrightarrow \ \mbox{} } \@ifundefined{txt}{ \providecommand*{\txt}[1]{\quad\text{#1}\quad} }{ \mm@warning{txt} } \mm@macro{mul}{\mathord{\times}} \@ifundefined{pow}{ \providecommand*{\pow}[2]{\left( #1 \right)^{\!#2}} }{ \mm@warning{pow} } \@ifundefined{abs}{ \providecommand*{\abs}[1]{\left\vert#1\right\vert} }{ \mm@warning{abs} } \@ifundefined{lfrac}{ \providecommand*{\lfrac}[2]{\frac{\;#1\;}{\;#2\;}} }{ \mm@warning{lfrac} } \newcommand{\systemstretch}{1.2} \newcommand{\systemsep}{\medspace} \newenvironment{system}[1][l]{ \renewcommand{\arraystretch}{\systemstretch} \setlength{\arraycolsep}{0.15em} \left\{\begin{array}{@{\systemsep}#1@{}} % }{\end{array}\right.} \newenvironment{spmatrix}{ \left(\begin{smallmatrix} }{\end{smallmatrix}\right)} \newenvironment{mathcols}{% needs multicol package \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}{24} % \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{mathtools} package}, Morten Høgholm, Lars Madsen, CTAN, % v1.29 2022/06/29. % \bibitem{FIXM} \emph{The \textsf{fixmath} package for \LaTeXe}, Walter Schmidt, % CTAN, v0.9 2000/04/11. % \bibitem{ISOM} \emph{\textsf{isomath} -- Mathematical style for science and technology}. % Günter Milde, CTAN, v0.6.1 2012/09/04. % \bibitem{PMISO} \emph{\textsf{PM-ISOmath}, The Poor Man ISO math bundle}, % the \textsf{pm-isomath} package by Claudio Beccari, CTAN, v1.2.00 2021/08/04. % \bibitem{GREEK} \emph{The \textsf{upgreek} package for \LaTeXe}, Walter Schmidt, % CTAN, v2.0 2003/02/12. % \bibitem{DESIGN} \emph{The \textsf{mathdesign} package}, % Paul Pichaureau, CTAN, v2.31 2013/08/29. % \bibitem{ALPHA} \emph{The \textsf{textalpha} package} % (part of the \textsf{greek-fontenc} bundle), Günter Milde, CTAN, v2.1 14/06/2022. % \bibitem{KPF} \emph{\textsf{Kp-Fonts} -- The Johannes Kepler project}, % Christophe Caignaert, CTAN, v3.34 20/09/2022. % \bibitem{FOUR} \textsf{Fourier-GUT\hspace{-0.1em}\emph{enberg}}, % Michel Bovani, CTAN, v1.3 30/01/2005. % \bibitem{LGR} \emph{The \textsf{lgrmath} package}, Jean-François B., CTAN, v1.0 2022/11/16. % \bibitem{INT} \emph{The \textsf{interval} package}. Lars Madsen, CTAN, % v0.4 2019/03/06. % \bibitem{SYST} \emph{L'extension pour \TeX\ et \LaTeX\ \textsf{systeme}}, % Christian Tellechea, CTAN v0.32 2019/01/13. % \bibitem{SPAL} \emph{The \textsf{spalign} package}, Joseph Rabinoff, CTAN, 2016/10/05. % \bibitem{NMATX} \emph{The package \textsf{nicematrix}}, François Pantigny, CTAN, % v6.14 2023/02/18. % \bibitem{FR} \emph{L'extension \textsf{frenchmath}}, Antoine Missier, CTAN, v2.5 2023/02/24. % \bibitem{BRACKET} \emph{Intelligent brackets -- The \textsf{ibrackets} package} % 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, % Johannes Braams, David Carlisle, Chris Rowley, 2nd edition, Pearson Education, 2004. % \end{raggedright} % \end{thebibliography} % \Finale \endinput