% \begin{meta-comment} % % $Id: mdwmath.dtx,v 1.2 2003/09/05 16:14:36 mdw Exp $ % % Various nicer mathematical things % % (c) 2003 Mark Wooding % % \end{meta-comment} % % \begin{meta-comment} %% %% mdwmath package -- various nicer mathematical things %% Copyright (c) 2003 Mark Wooding %% %% This program is free software; you can redistribute it and/or modify %% it under the terms of the GNU General Public License as published by %% the Free Software Foundation; either version 2 of the License, or %% (at your option) any later version. %% %% This program is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied warranty of %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %% GNU General Public License for more details. %% %% You should have received a copy of the GNU General Public License %% along with this program; if not, write to the Free Software %% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %% % \end{meta-comment} % % \begin{meta-comment} %<+package>\NeedsTeXFormat{LaTeX2e} %<+package>\ProvidesPackage{mdwmath} %<+package> [2003/08/25 1.3 Nice mathematical things] %<+oldeqnarray>\NeedsTeXFormat{LaTeX2e} %<+oldeqnarray>\ProvidesPackage{eqnarray} %<+oldeqnarray> [1996/04/11 1.1 Old enhanced eqnarray] % \end{meta-comment} % % \CheckSum{729} %% \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 \~} %% % % \begin{meta-comment} % %<*driver> \input{mdwtools} \let\opmod\pmod \usepackage{amssymb} \describespackage{mdwmath} %\describespackage{eqnarray} \ignoreenv{old-eqnarray} %\unignoreenv{old-eqnarray} \mdwdoc % % % \end{meta-comment} % % \section{User guide} % % \subsection{Square root typesetting} % % \DescribeMacro{\sqrt} % The package supplies a star variant of the |\sqrt| command which omits the % vinculum over the operand (the line over the top). While this is most % useful in simple cases like $\sqrt*{2}$ it works for any size of operand. % The package also re-implements the standard square root command so that it % positions the root number rather better. % % \begin{figure} % \begin{demo}[w]{Examples of the new square root command} %\[ \sqrt*{2} \quad \mbox{rather than} \quad \sqrt{2} \] %\[ \sqrt*[3]{2} \quad \mbox{ rather than } \quad \sqrt[3]{2} \] %\[ \sqrt{x^3 + \sqrt*[y]{\alpha}} - \sqrt*[n+1]{a} \] %\[ x = \sqrt*[3]{\frac{3y}{7}} \] %\[ q = \frac{2\sqrt*{2}}{5}+\sqrt[\frac{n+1}{2}]{2x^2+3xy-y^2} \] % \end{demo} % \end{figure} % % [Note that omission of the vinculum was originally a cost-cutting exercise % because the radical symbol can just fit in next to its operand and % everything ends up being laid out along a line. However, I find that the % square root without vinculum is less cluttered, so I tend to use it when % it doesn't cause ambiguity.] % % \subsection{Modular arithmetic} % % In standard maths mode, there's too much space before the parentheses in % the output of the |\pmod| command. Suppose that $x \equiv y^2 \opmod n$: % then the spacing looks awful. Go on, admit it. % % It looks OK in a display. For example, if % \[ c \equiv m^e \opmod n \] % then it's fine. The package redefines the |\pmod| command to do something % more sensible. So now $c^d \equiv m^{ed} \equiv m \pmod n$ and all looks % fine. % % \subsection{Some maths symbols you already have} % % \DescribeMacro\bitor % \DescribeMacro\bitand % \DescribeMacro\dblor % \DescribeMacro\dbland % Having just tried to do some simple things, I've found that there are maths % symbols missing. Here they are, in all their glory: % \begin{center} \unverb\| \begin{tabular}{cl|cl|cl} % $\&$ & "\&" & $\bitor$ & "\bitor" & $\dbland$ & "\dbland" \\ % $\bitand$ & "\bitand" & $\dblor$ & "\dblor" & % \end{tabular} \end{center} % % \DescribeMacro\xor % \DescribeMacro\cat % I also set up the |\xor| command to typeset `$\xor$', which is commonly % used to represent the bitsize exclusive-or operation among cryptographers. % The command |\cat| typesets `$\cat$', which is a common operator indicating % concatenation of strings. % % \DescribeMacro\lsl % \DescribeMacro\lsr % \DescribeMacro\rol % \DescribeMacro\ror % The commands |\lsl| and |\lsr| typeset binary operators `$\lsl$' and % `$\lsr$' respectively, and |\rol| and |\ror| typeset `$\rol$' and `$\ror$'. % Note that these are spaced as binary operators, rather than relations. % % \DescribeMacro\compose % \DescribeMacro\implies % \DescribeMacro\vect % The |\compose| command typesets `$\compose$', which is usually used to % denote function composition. The |\implies| command is made to typeset % `$\implies$'. And \syntax{"\\vect{""}"} typesets `$\vect{x}$'. % % \DescribeMacro\statclose % \DescribeMacro\compind % The |\statclose| command typesets `$\statclose$', which indicates % `statistical closeness' of probability distributions; |\compind| typesets % `$\compind$', which indicates computational indistinguishability. % % \subsection{Fractions} % % \DescribeMacro\fracdef % We provide a general fraction system, a little tiny bit like % \package{amsmath}'s |\genfrac|. Say % \syntax{"\\fracdef{""}{""}"} to define a new % |\frac|-like operator. The \ are a comma-separated list of % parameters: % \begin{description} % \item[\lit*{line}] Include a horizontal line between the top and bottom % (like |\frac|). % \item[\lit*{line=}\] Include a horizontal line with width % \. % \item[\lit*{noline}] Don't include a line (like |\binom|). % \item[\lit*{leftdelim=}\] Use \ as the left-hand delimiter. % \item[\lit*{rightdelim=}\] Use \ as the right-hand delimiter. % \item[\lit*{nodelims}] Don't include delimiters. % \item[\lit*{style=}\