diff options
author | Karl Berry <karl@freefriends.org> | 2008-05-01 21:35:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-05-01 21:35:11 +0000 |
commit | abafe1d7d1ca92c9645e291388958bfb4d206ac8 (patch) | |
tree | 37d76a5e7c859172536316a33e72d67511d39a39 /Master/texmf-dist | |
parent | ce1976c0ee2732fc23cf86e79307df17ad54320e (diff) |
mhequ update (1may08)
git-svn-id: svn://tug.org/texlive/trunk@7789 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/mhequ/example.dvi | bin | 4208 -> 0 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/mhequ/example.pdf | bin | 0 -> 45071 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/mhequ/example.tex | 25 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/mhequ/mhequ.sty | 122 |
4 files changed, 96 insertions, 51 deletions
diff --git a/Master/texmf-dist/doc/latex/mhequ/example.dvi b/Master/texmf-dist/doc/latex/mhequ/example.dvi Binary files differdeleted file mode 100644 index 0536617185a..00000000000 --- a/Master/texmf-dist/doc/latex/mhequ/example.dvi +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/mhequ/example.pdf b/Master/texmf-dist/doc/latex/mhequ/example.pdf Binary files differnew file mode 100644 index 00000000000..136b1f5b578 --- /dev/null +++ b/Master/texmf-dist/doc/latex/mhequ/example.pdf diff --git a/Master/texmf-dist/doc/latex/mhequ/example.tex b/Master/texmf-dist/doc/latex/mhequ/example.tex index c5b39f293b5..f8b49eb0b19 100644 --- a/Master/texmf-dist/doc/latex/mhequ/example.tex +++ b/Master/texmf-dist/doc/latex/mhequ/example.tex @@ -11,15 +11,13 @@ \begin{document} -\section*{Use of "mhequ.sty" (v1.5)} +\section*{Use of ``mhequ.sty'' (v1.6.1)} \label{mySec} A simple labelled equation: \begin{equ}[onelab] \sum_{i=1}^5 X_i^j X^j_i = y^j \;. \end{equ} -The name of the label at the right of the equation is generated by -the \texttt{draft} option of the package. Without label, one gets -the same: +Removing or adding the label does not require a change of environment: \begin{equ} \sum_{i=1}^5 X_i^j X^j_i = y^j \;. \end{equ} @@ -30,14 +28,14 @@ per equation h(x) &= f(x) + g(x) -3\;, \label{e:equ3} \end{equs} or with one number for the whole list -\begin{equa}[e:block] +\begin{equs}[e:block] f(x) &= \sin(x) + 1\;, \\ - h(x) &= f(x) + g(x) -3\;. -\end{equa} -Of course, it can have no numbering at all. + h(x) &= f(x) + g(x) -3\;, +\end{equs} +using only a very small modification in the syntax. Of course, it can also have no number at all: \begin{equs} f(x) &= \sin(x) + 1\;, \\ - h(x) &= f(x) + g(x) -3\;, + h(x) &= f(x) + g(x) -3\;. \end{equs} Let us make a first group: \minilab{otherlabel} @@ -51,11 +49,10 @@ line, like \eref{e:f} for example. You can use any tag you like with the \texttt{\string\tag} command \begin{equ}[mylabel] - x = y\;. \tag{tag} + x = y\;. \tag{$\star$} \end{equ} -Of course, you can also refer to \eref{mylabel}. -You can use the usual \texttt{equation} environment, but it will not -display its label. +Of course, you can also refer to it as usual: \eref{mylabel}. +You can mix \texttt{mhequ} with the usual \texttt{equation} environment. (But why would you?) \begin{equation} x=y+z \end{equation} @@ -77,7 +74,7 @@ You can even extend the block \eref{otherlabel} much later like \multicol{6}{\sin^2 x + \cos^2 x = 1} \label{e:x3} \end{equs} You can also change the type of the subnumbering and use the -\texttt{\string\text} command without loading \texttt{amstext}. Like for example +\texttt{\string\text} command without having to load \texttt{amstext}. Like for example \setlabtype{Alph} \minilab{alab} \begin{equs}[2] 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} |