diff options
author | Karl Berry <karl@freefriends.org> | 2007-12-15 00:58:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-12-15 00:58:47 +0000 |
commit | 954e518677de512ede9e6ee73428d4a0b8a933c4 (patch) | |
tree | b1c4281d69926b8ce4d9ee22f0fb1aad321fb9be /Master/texmf-dist/source/latex/mh/mathtools.dtx | |
parent | fd485c0f15d7cf5ea685ec6ff197e384025ada26 (diff) |
mh update (11dec07)
git-svn-id: svn://tug.org/texlive/trunk@5787 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/mh/mathtools.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/mh/mathtools.dtx | 262 |
1 files changed, 187 insertions, 75 deletions
diff --git a/Master/texmf-dist/source/latex/mh/mathtools.dtx b/Master/texmf-dist/source/latex/mh/mathtools.dtx index 96ac01a4a9a..585ec5d9b9c 100644 --- a/Master/texmf-dist/source/latex/mh/mathtools.dtx +++ b/Master/texmf-dist/source/latex/mh/mathtools.dtx @@ -1,31 +1,134 @@ -% \iffalse meta-comment -% File `mathtools.dtx'. -% Copyright 2004 Morten H\o gholm. -% moho01ab@student.cbs.dk -% -% It 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 2003/12/01 or later. -% -% This work has the LPPL maintenance status "maintained". +% \iffalse meta-comment % -% The Current Maintainer of this work is Morten H\o gholm. +% Copyright (C) 2004-2007 by Morten Hoegholm <mh.ctan@gmail.com> % -% This work consists of the files mathtools.dtx and mathtools.ins -% and the derived file mathtools.sty. -% -%<package>\NeedsTeXFormat{LaTeX2e} -%<package>\ProvidesPackage{mathtools} -%<*dtx> - \ProvidesFile{mathtools.dtx} -%</dtx> - [2004/10/10 v1.01a mathematical typesetting tools (MH)] +% This work 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. +% +% This work has the LPPL maintenance status "maintained". +% +% This Current Maintainer of this work is Morten Hoegholm. +% +% This work consists of the main source file mathtools.dtx +% and the derived files +% mathtools.sty, mathtools.pdf, mathtools.ins, mathtools.drv. +% +% Distribution: +% CTAN:macros/latex/contrib/mh/mathtools.dtx +% CTAN:macros/latex/contrib/mh/mathtools.pdf +% +% Unpacking: +% (a) If mathtools.ins is present: +% tex mathtools.ins +% (b) Without mathtools.ins: +% tex mathtools.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{mathtools.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (a) If mathtools.drv is present: +% latex mathtools.drv +% (b) Without mathtools.drv: +% latex mathtools.dtx; ... +% The class ltxdoc loads the configuration file ltxdoc.cfg +% if available. Here you can specify further options, e.g. +% use A4 as paper format: +% \PassOptionsToClass{a4paper}{article} +% +% Programm calls to get the documentation (example): +% pdflatex mathtools.dtx +% makeindex -s gind.ist mathtools.idx +% pdflatex mathtools.dtx +% makeindex -s gind.ist mathtools.idx +% pdflatex mathtools.dtx +% +% Installation: +% TDS:tex/latex/mh/mathtools.sty +% TDS:doc/latex/mh/mathtools.pdf +% TDS:source/latex/mh/mathtools.dtx +% +%<*ignore> +\begingroup + \def\x{LaTeX2e} +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +%</ignore> +%<*install> +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: mathtools 2007/12/03 v1.03 (MH)} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\preamble + +This is a generated file. + +Copyright (C) 2002-2007 by Morten Hoegholm <mh.ctan@gmail.com> + +This work 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. + +This work has the LPPL maintenance status "maintained". + +This Current Maintainer of this work is Morten Hoegholm. + +This work consists of the main source file mathtools.dtx +and the derived files + mathtools.sty, mathtools.pdf, mathtools.ins, mathtools.drv. + +\endpreamble + +\generate{% + \file{mathtools.ins}{\from{mathtools.dtx}{install}}% + \file{mathtools.drv}{\from{mathtools.dtx}{driver}}% + \usedir{tex/latex/mh}% + \file{mathtools.sty}{\from{mathtools.dtx}{package}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* mathtools.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `mathtools.drv'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +%</install> +%<*ignore> +\fi +%</ignore> %<*driver> -\documentclass[a4paper]{ltxdoc} +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{mathtools.drv}% + [2007/12/03 v1.03 mathematical typesetting tools (MH)] +\documentclass{ltxdoc} +\IfFileExists{fourier.sty}{\usepackage{fourier}}{} \addtolength\marginparwidth{-25pt} \usepackage{mathtools} @@ -36,7 +139,7 @@ \providecommand*\email[1]{\href{mailto:#1}{\texttt{#1}}} \providecommand*\mode[1]{\texttt{[#1]}} \providecommand*\file[1]{\texttt{#1}} -\usepackage{color,varioref} +\usepackage{xcolor,varioref} \makeatletter \newcommand*\thinfbox[2][black]{\fboxsep0pt\textcolor{#1}{\rulebox{{\normalcolor#2}}}} \newcommand*\thinboxed[2][black]{\thinfbox[#1]{\ensuremath{\displaystyle#2}}} @@ -131,7 +234,7 @@ \let\MTtheindex\theindex \def\theindex{\MTtheindex\MakePrivateLetters} -\usepackage[final,hyperindex=false,linkbordercolor=false]{hyperref} +\usepackage[final,hyperindex=false]{hyperref} \renewcommand*\usage[1]{\textit{\hyperpage{#1}}} \OnlyDescription @@ -143,7 +246,7 @@ % % \changes{v1.0}{2004/07/26}{Initial release} % -% \GetFileInfo{mathtools.dtx} +% \GetFileInfo{mathtools.drv} % % \CheckSum{2004} % @@ -189,7 +292,7 @@ % if you have any good macros or just macros that help you when % writing mathematics, then don't hesitate to report them to me. I % can be reached at -% \begin{quote}\email{moho01ab@student.cbs.dk}\end{quote} +% \begin{quote}\email{mh.ctan@gmail.com}\end{quote} % This is of course also the address to use in case of bug reports. % % \section{Package loading} @@ -1653,10 +1756,12 @@ % Lets start the package. % \begin{macrocode} %<*package> +\ProvidesPackage{mathtools}% + [2007/12/03 v1.03 mathematical typesetting tools (MH)] % \end{macrocode} % \begin{macrocode} \RequirePackage{keyval,calc} -\RequirePackage{mhsetup}[2004/10/10] +\RequirePackage{mhsetup}[2007/12/03] \MHInternalSyntaxOn % \end{macrocode} % @@ -1845,15 +1950,16 @@ \def\MT_extended_tagform:n #1{ \MH_set_boolean_F:n {raw_maketag} % \end{macrocode} -% We test if the equation was labelled. We already know if it was tagged -% manually. +% We test if the equation was labelled. We already know if it was +% tagged manually. Have to watch out for \TeX\ inserting a blank line +% so do not let the tag have width zero. % \begin{macrocode} \if_meaning:NN \df@label\@empty - \MH_if_boolean:nT {manual_tag} - { \MH_if_boolean:nTF {show_manual_tags} - { \MT_prev_tagform:n {#1} } - { \stepcounter{equation} } - } + \MH_if_boolean:nTF {manual_tag}% this was \MH_if_boolean:nT before + { \MH_if_boolean:nTF {show_manual_tags} + { \MT_prev_tagform:n {#1} } + { \stepcounter{equation} } + }{\kern1sp}% this last {\kern1sp} is new. \else: \MH_if_boolean:nTF {manual_tag} { \MH_if_boolean:nTF {show_manual_tags} @@ -2089,9 +2195,9 @@ \kern-\wd0 \lower.22ex\box0}} \providecommand*\xrightleftharpoons[2][]{\mathrel{% \raise.22ex\hbox{% - $\ext@arrow 3095\MT_rightharpoonup_fill:{\phantom{#1}}{#2}$}% + $\ext@arrow 0359\MT_rightharpoonup_fill:{\phantom{#1}}{#2}$}% \setbox0=\hbox{% - $\ext@arrow 0359\MT_leftharpoondown_fill:{#1}{\phantom{#2}}$}% + $\ext@arrow 3095\MT_leftharpoondown_fill:{#1}{\phantom{#2}}$}% \kern-\wd0 \lower.22ex\box0}} % \end{macrocode} % \end{macro} @@ -2366,6 +2472,7 @@ % \begin{macro}{\l_MT_multwidth_dim} % Helpers. % \begin{macrocode} +\let \AMS@math@cr@@ \math@cr@@ \MH_new_boolean:n {mult_firstline} \MH_new_boolean:n {outer_mult} \newcount\g_MT_multlinerow_int @@ -2585,7 +2692,7 @@ % The user environment. Scan for an optional argument. % \begin{macrocode} \newenvironment{multlined}[1][] - { + {\MH_group_align_safe_begin: \MT_test_for_tcb_other:nnnnn {#1} {\def\MT_mult_default_pos:{#1}} {\def\MT_mult_default_pos:{#1}} @@ -2599,7 +2706,7 @@ \MT_multlined_second_arg:w } { - \hfilneg \endaligned + \hfilneg \endaligned \MH_group_align_safe_end: } \MHPrecedingSpacesOn % \end{macrocode} @@ -2644,12 +2751,11 @@ % \begin{macrocode} \newcommand*\DeclarePairedDelimiter[3]{% \@ifdefinable{#1}{ - \edef\MT_next: {\MH_cs_to_str:N #1} % \end{macrocode} % Define the starred command to just put \cs{left} and \cs{right} % before the delimiters. % \begin{macrocode} - \@namedef{MT_delim_\MT_next: _star:}##1 + \@namedef{MT_delim_\MH_cs_to_str:N #1 _star:}##1 {\left#2 ##1 \right #3}% % \end{macrocode} % The command with optional argument. It should be \cs{bigg} or @@ -2657,13 +2763,15 @@ % \begin{macrocode} \@xp\@xp\@xp \newcommand - \@xp\csname MT_delim_\MT_next: _nostar:\endcsname[2][\\@gobble] - { \edef\MT_next: {\MH_cs_to_str:N ##1} + \@xp\csname MT_delim_\MH_cs_to_str:N #1 _nostar:\endcsname + [2][\\@gobble] + { % \end{macrocode} % With the default optional argument we wind up with \cs{relax}, % else we get \cs{biggr} and \cs{biggl} etc. % \begin{macrocode} - \@nameuse {\MT_next: l} #2 ##2 \@nameuse {\MT_next: r} #3} + \mathopen{\@nameuse {\MH_cs_to_str:N ##1 l} #2} ##2 + \mathclose{\@nameuse {\MH_cs_to_str:N ##1 r} #3}} % \end{macrocode} % The user command comes here. Just check for the star and choose % the right internal command. @@ -2680,50 +2788,54 @@ % % \subsection{A \texttt{\textbackslash displaystyle} \env{cases} environment} % -% \begin{macro}{\MT_start_cases:nn} +% \begin{macro}{\MT_start_cases:nnn} % We define a single command that does all the hard work. % \begin{macrocode} -\def\MT_start_cases:nn #1#2{ - \RIfM@\else - \nonmatherr@{\begin{\@currenvir}}% - \fi -% \end{macrocode} -% Put in the brace and center the contents (nothing else makes -% sense). -% \begin{macrocode} - \left\lbrace - \vcenter \bgroup - \Let@ \chardef\dspbrk@context\@ne \restore@math@cr - \spread@equation - \ialign\bgroup +\def\MT_start_cases:nnn #1#2#3{ % #1=sep,#2=preamble,#3=delim + \RIfM@\else + \nonmatherr@{\begin{\@currenvir}} + \fi + \MH_group_align_safe_begin: + \left#3 + \vcenter \bgroup + \Let@ \chardef\dspbrk@context\@ne \restore@math@cr + \let \math@cr@@\AMS@math@cr@@ + \spread@equation + \ialign\bgroup % \end{macrocode} % Set the first column flush left in \cs{displaystyle} math and the % second as specified by the second argument. The first argument is % the separation between the columns. It could be a \cs{quad} or % something entirely different. % \begin{macrocode} - \strut@$\m@th\displaystyle{##}$\hfil\strut@ + \strut@$\m@th \displaystyle{##}$\hfil \strut@ + #2 + \crcr +} % \end{macrocode} -% Insert the specification of the second column. +% \end{macro} +% \begin{macro}{\MH_end_cases:} % \begin{macrocode} - #2 - \crcr +\def\MH_end_cases:{\crcr\egroup + \restorecolumn@ + \egroup + \MH_group_align_safe_end: } % \end{macrocode} -% \end{macro} +% \end{macro} % \begin{macro}{\newcases} % \begin{macro}{\renewcases} % Easy creation of new \env{cases}-like environments. % \begin{macrocode} -\newcommand*\newcases[3]{ - \newenvironment{#1} - {\MT_start_cases:nn {#2}{#3}} - {\endaligned\right.} +\newcommand*\newcases[5]{% #1=name, #2=sep, #3=preamble, #4=left, #5=right + \newenvironment{#1} + {\MT_start_cases:nnn {#2}{#3}{#4}} + {\MH_end_cases:\right#5} } -\newcommand*\renewcases[3]{ - \renewenvironment{#1} - {\MT_start_cases:nn {#2}{#3}} - {\endaligned\right.} +\newcommand*\renewcases[5]{ + \renewenvironment{#1} + {\MT_start_cases:nnn {#2}{#3}{#4}} + {\MH_end_cases:\right#5} } % \end{macrocode} % \begin{environment}{dcases} @@ -2731,8 +2843,8 @@ % \env{dcases} is a traditional cases with display style math in % both columns, while \env{dcases*} has text in the second column. % \begin{macrocode} -\newcases{dcases}{\quad}{$\m@th\displaystyle{##}$\hfil} -\newcases{dcases*}{\quad}{{##}\hfil} +\newcases{dcases}{\quad}{$\m@th\displaystyle{##}$\hfil}{\lbrace}{.} +\newcases{dcases*}{\quad}{{##}\hfil}{\lbrace}{.} % \end{macrocode} % \end{environment} % \end{environment} |