summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mhequ/mhequ.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/mhequ/mhequ.sty')
-rw-r--r--Master/texmf-dist/tex/latex/mhequ/mhequ.sty122
1 files changed, 85 insertions, 37 deletions
diff --git a/Master/texmf-dist/tex/latex/mhequ/mhequ.sty b/Master/texmf-dist/tex/latex/mhequ/mhequ.sty
index 86a104f8c08..34dda2e4d4e 100644
--- a/Master/texmf-dist/tex/latex/mhequ/mhequ.sty
+++ b/Master/texmf-dist/tex/latex/mhequ/mhequ.sty
@@ -1,12 +1,12 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% mhequ.sty v1.5, Copyright 2000 by Martin Hairer
+% mhequ.sty v1.61, Copyright 2005 by Martin Hairer
% This package is public domain. You are strongly encouraged to
% use it and to widespread it.
%
% You may download the latest version of this package on my homepage:
%
-% http://www.unige.ch/math/folks/hairer/martin/
+% http://www.hairersoft.com/LaTeXUtils.html
%
% Notes:
% Version 1.5 supports the packages "showkeys" (thus the [draft] option is suppressed)
@@ -14,8 +14,8 @@
%
% Options:
%
-% [lefttag] : Puts the tags to the left side of the page
-% [righttag]: Puts the tags to the right side of the page (default)
+% [lefttag] : Puts equation numbers to the left side of the page
+% [righttag]: Puts equation numbers to the right side of the page (default)
%
% Syntax:
%
@@ -23,21 +23,20 @@
%
% label : if a label is given, the equation is numbered. (default : no label)
%
+% \begin{equs}[n][label]
%
-% \begin{equs}[n]
+% Creates a multiline / multicolumn equation environment.
%
% n : number of columns. (default : 1) You can also choose n=0.
-% Each line can be labelled separately with the \label command.
-%
-% \begin{equa}[n][label]
-%
-% n : number of columns. (default : 1) You can also choose n=0.
-% label : if a label is given, the equation is numbered. (default : no label)
+% label : if a label is given, the environment is numbered. (one tag for the whole block)
% The order of [n] and [label] is irrelevant.
%
-% In both the equs and the equa environment, the number of '&' signs per line
-% has to be equal to 2*n-1 if n>0 and to 0 if n=0. If there are less '&' signs, they
-% are automatically appended at the end of the line.
+% If no label is given, one can number each line of the block individually by
+% using the \label command.
+%
+% In the equs environment, the number of '&' signs per line has to be equal to
+% 2*n-1 if n>0 and to 0 if n=0. If there are less '&' signs, they are automatically
+% appended at the end of the line.
%
% Provided commands:
%
@@ -69,6 +68,8 @@
\ProvidesPackage{mhequ}
\DeclareOption{righttag}{\global\@leftfalse}
\DeclareOption{lefttag}{\global\@lefttrue}
+\DeclareOption{fleqn}{\global\@flushtrue}
+\DeclareOption{leqno}{\global\@lefttrue}
\newif\if@haslab
\newif\if@useminilab
@@ -76,12 +77,17 @@
\newcount\@nocolstot
\newif\if@tag
\newif\if@left
+\newif\if@flush
\@haslabfalse
+
\ProcessOptions
-\def\@MHputleft#1{\kern-\displaywidth\rlap{#1\@MHputnumber}\kern\displaywidth}
-\def\@MHputright#1{\llap{#1\@MHputnumber}}
+\def\MH@changecodes{\catcode`\:=12\catcode`\,=12\catcode`\.=12%
+ \catcode`\'=12\catcode`\*=12\catcode`\&=12}
+
+\def\@MHputleft#1{\hb@xt@.01\p@{}\rlap{\hskip-\displaywidth#1\@MHputnumber}}
+\def\@MHputright#1{\hb@xt@.01\p@{}\llap{#1\@MHputnumber}}
\if@left\let\@MHput@lbl\@MHputleft%
\else\let\@MHput@lbl\@MHputright\fi
@@ -92,24 +98,29 @@
\def\computelength#1{\@MHLength=0 \getlength#1\end}
\def\getlength#1{\ifx#1\end \let\next=\relax \else \advance\@MHLength by1 \let\next=\getlength \fi \next}
-\def\@makelabel#1{\stepcounter{equation}\global\def\@mylabel{#1}
- \newcounter{lab@#1}\setcounter{lab@#1}{0}
- \global\expandafter\let\expandafter\c@MHCurrentCount\csname c@lab@#1\endcsname
- \global\@namedef{MHused@#1}{}
- \def\@currentlabel{\theequation}\MHsavelabel{#1}
+\def\@makelabel#1{\stepcounter{equation}\global\def\@mylabel{#1}%
+ \@ifundefined{c@lab@#1}{\newcounter{lab@#1}}{}\setcounter{lab@#1}{0}%
+ \immediate\write\@auxout{\string\@ifundefined{c@lab@#1}{\string\newcounter{lab@#1}}%
+ {}\string\setcounter{lab@#1}{0}}%
+ \global\expandafter\let\expandafter\c@MHCurrentCount\csname c@lab@#1\endcsname%
+ \global\@namedef{MHused@#1}{}%
+ \def\@currentlabel{\theequation}\MHsavelabel{#1}%
}
\def\@uselabel#1{\global\def\@mylabel{#1}
\global\expandafter\let\expandafter\c@MHCurrentCount\csname c@lab@#1\endcsname
}
\def\@MHreset{\global\def\@MHeqno{\theequation}\global\@useminilabfalse\global\@haslabfalse}
-\def\@MHbuildlab#1{\@ifundefined{r@#1}
- {\global\def\@MHeqno{??\sublabeltype{MHCurrentCount}}}
- {\global\def\@MHeqno{\ref{\@mylabel}\sublabeltype{MHCurrentCount}}}
+\def\@MHbuildlab#1{\@ifundefined{r@#1}%
+ {\global\def\@MHeqno{??\sublabeltype{MHCurrentCount}}}%
+ {\global\def\@MHeqno{\ref{\@mylabel}\sublabeltype{MHCurrentCount}}}%
}
\def\@MHUseLab#1{\@MHbuildlab{#1}\global\@useminilabtrue}
-\def\minilab#1{\let\MHsavelabel=\label%
- \@MHUseLab{#1}\@ifundefined{MHused@#1}{\@makelabel{#1}}{\@uselabel{#1}}%
- \let\label=\MHsavelabel}
+
+\def\@minilab#1{\let\MHsavelabel=\label%
+ \@MHUseLab{#1}\@ifundefined{MHused@#1}%
+ {\@makelabel{#1}}{\@uselabel{#1}}%
+ \let\label=\MHsavelabel\egroup\global\@ignoretrue}
+\def\minilab{\bgroup\MH@changecodes\@minilab}
\newskip\MHcenter \MHcenter=0pt plus 1000pt minus 1000pt
\newskip\MHbig \MHbig=1000pt plus 0pt minus 1000pt
@@ -143,6 +154,7 @@
\def\@MHstep{\if@tag\else\if@useminilab\refstepcounter{MHCurrentCount}%
\else\refstepcounter{equation}\fi\fi}
+
\def\@MHputnumber{\if@haslab\@MHstep\if@left\@MHwritelabel\fi%
\hbox{\rm(\@MHeqno)}%
\if@left\else\@MHwritelabel\fi%
@@ -228,7 +240,10 @@
\def\@ealign{\@MHcr\egroup}
\def\@restoretag{\if@tag\global\@tagfalse\global\let\@MHeqno=\@MHsaveno\fi}
-\def\tag#1{\global\@tagtrue\global\let\@MHsaveno=\@MHeqno\global\def\@MHeqno{#1}}
+\def\@MHtag#1{%
+ \global\@tagtrue\global\let\@MHsaveno=\@MHeqno%
+ \global\def\@MHeqno{#1}\egroup}
+\def\tag{\bgroup\MH@changecodes\@MHtag}
\def\@equnolabel{\global\@haslabfalse}
\def\@equlabel[#1]{\label{#1}\global\@haslabtrue}
@@ -240,17 +255,50 @@
\@ifnextchar[{\@equbopt}{\@equb}}
\def\@equb{\@newbalign{\the\@nocols}}
-\def\equa{\global\let\@MHcr\@MHcrb$$\@saveMHComms\global\@nocols=1%
- \@ifnextchar[{\@equbopt}{\@equb}}
-\def\endequa{\@ealignb\if@haslab\@MHput@lbl{}\fi%
- \@restoreMHComms$$\global\@ignoretrue}
+%\def\equa{\global\let\@MHcr\@MHcrb%
+% $$\@saveMHComms\global\@nocols=1%
+% \@ifnextchar[{\@equbopt}{\@equb}}
+%\def\endequa{\@ealignb\if@haslab\@MHput@lbl{}\fi%
+% \@restoreMHComms$$\global\@ignoretrue}
+
+\if@flush
+ \def\equ{\@saveMHComms
+ \@beginparpenalty\predisplaypenalty
+ \@endparpenalty\postdisplaypenalty
+ \trivlist\item[]\leavevmode
+ \hb@xt@\linewidth\bgroup $\m@th% $
+ \displaystyle
+ \hskip\mathindent\@ifnextchar[\@equlabel\@equnolabel}
+\def\endequ{%
+ $\hfil % $
+ \displaywidth\linewidth\hbox{\@MHputnumber}%
+ \egroup
+ \endtrivlist\@restoreMHComms\global\@ignoretrue}
+\else
+ \def\equ{$$\@saveMHComms\@ifnextchar[\@equlabel\@equnolabel}
+ \def\endequ{%
+ \if@haslab\if@left\leqno\else\eqno\fi{\@MHputnumber}\fi%
+ \@restoreMHComms$$\global\@ignoretrue}
+\fi
+
+%\def\equs{\@ifnextchar[{\@begalign}{\@begalign[1]}}
+%\def\endequs{\@ealign\@restoreMHComms$$\global\@ignoretrue}
-\def\equ{$$\@saveMHComms\@ifnextchar[\@equlabel\@equnolabel}
-\def\endequ{\if@haslab\if@left\leqno{\@MHputnumber}\else\eqno{\@MHputnumber}\fi\fi%
- \@restoreMHComms$$\global\@ignoretrue}
-\def\equs{\@ifnextchar[{\@begalign}{\@begalign[1]}}
-\def\endequs{\@ealign\@restoreMHComms$$\global\@ignoretrue}
+\newif\if@isequa
+\def\@analyzearg[#1]{\computelength{#1}\ifnum\@MHLength=1\@nocols=#1\else
+ \@MHlabel{#1}\global\@isequatrue\fi%
+ \@ifnextchar[{\@analyzearg}{\if@isequa%
+ \global\let\@MHcr\@MHcrb%
+ $$\@saveMHComms\@equb%
+ \else\@begalign[\the\@nocols]\fi}}
+\def\@endequs{\@ealign\@restoreMHComms$$}
+\def\@endequa{\@ealignb\if@haslab\@MHput@lbl{}\fi%
+ \@restoreMHComms$$}
+\def\equs{\global\@isequafalse\@nocols=1\@ifnextchar[{\@analyzearg}{\@begalign[1]}}
+\def\endequs{\if@isequa\@endequa\else\@endequs\fi\global\@ignoretrue}
+\let\equa\equs
+\let\endequa\endequs
\def\setlabtype#1{\global\expandafter\let\expandafter\sublabeltype\csname #1\endcsname}