diff options
author | Karl Berry <karl@freefriends.org> | 2015-08-27 22:06:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-08-27 22:06:01 +0000 |
commit | db4fd443694f20540291b70e4a74b5e9720ed6ea (patch) | |
tree | e732bba4e1355c60fea3c80e85bf48c91767cee7 /Master/texmf-dist/tex/latex/mhequ/mhequ.sty | |
parent | 2509d23a392a22006da62bd20f982f36fd391a63 (diff) |
mhequ (27aug15)
git-svn-id: svn://tug.org/texlive/trunk@38224 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/mhequ/mhequ.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/mhequ/mhequ.sty | 131 |
1 files changed, 74 insertions, 57 deletions
diff --git a/Master/texmf-dist/tex/latex/mhequ/mhequ.sty b/Master/texmf-dist/tex/latex/mhequ/mhequ.sty index 34dda2e4d4e..f1708e4bfcd 100644 --- a/Master/texmf-dist/tex/latex/mhequ/mhequ.sty +++ b/Master/texmf-dist/tex/latex/mhequ/mhequ.sty @@ -1,21 +1,23 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% 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. +% mhequ.sty v1.7, Copyright 2015 by Martin Hairer +% This package is public domain. You are strongly encouraged to use +% it and to distribute it further. If you have some contribution to +% it, please let me know! % -% You may download the latest version of this package on my homepage: +% You may download the latest version of this package from % -% http://www.hairersoft.com/LaTeXUtils.html +% http://www.hairer.org/software/mhequ.zip % % Notes: -% Version 1.5 supports the packages "showkeys" (thus the [draft] option is suppressed) +% mhequ supports the packages "showkeys" (thus the [draft] option is suppressed) % and "hyperref". % % Options: % % [lefttag] : Puts equation numbers to the left side of the page % [righttag]: Puts equation numbers to the right side of the page (default) +% [numberall]: Numbers all equations % % Syntax: % @@ -27,14 +29,14 @@ % % Creates a multiline / multicolumn equation environment. % -% n : number of columns. (default : 1) You can also choose n=0. +% n : number of columns. (default : 5) You can also choose n=0. % label : if a label is given, the environment is numbered. (one tag for the whole block) -% The order of [n] and [label] is irrelevant. +% The order of [n] and [label] is irrelevant. % % 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 +% 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. % @@ -42,6 +44,8 @@ % % \tag{theTag} Replaces the number of the current equation by "theTag" % +% \notag Forces to have no tag (only useful if [numberall] is active) +% % \minilab{label} If "label" has already been used, switches to the minilab "label". % If not, creates a new minilab. Inside a minilab, equations are labelled % (1a), (1b),... instead of (1), (2), etc... You can refer to the number @@ -66,19 +70,21 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{mhequ} -\DeclareOption{righttag}{\global\@leftfalse} -\DeclareOption{lefttag}{\global\@lefttrue} -\DeclareOption{fleqn}{\global\@flushtrue} -\DeclareOption{leqno}{\global\@lefttrue} - -\newif\if@haslab -\newif\if@useminilab -\newcount\@nocols -\newcount\@nocolstot -\newif\if@tag -\newif\if@left -\newif\if@flush -\@haslabfalse +\DeclareOption{righttag}{\global\@MHleftfalse} +\DeclareOption{lefttag}{\global\@MHlefttrue} +\DeclareOption{numberall}{\global\@MHnumberalltrue} +\DeclareOption{fleqn}{\global\@MHflushtrue} +\DeclareOption{leqno}{\global\@MHlefttrue} + +\newif\if@MHhaslab +\newif\if@MHuseminilab +\newif\if@MHnumberall +\newcount\@MHnocols +\newcount\@MHnocolstot +\newif\if@MHtag +\newif\if@MHleft +\newif\if@MHflush +\@MHnumberallfalse \ProcessOptions @@ -89,8 +95,11 @@ \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% +\if@MHleft\let\@MHput@lbl\@MHputleft% \else\let\@MHput@lbl\@MHputright\fi + +\def\@MHresetlab{\if@MHnumberall\global\@MHhaslabtrue\else\global\@MHhaslabfalse\fi} +\@MHresetlab \def\@MHref#1{\@ifundefined{r@#1}{??}{\@saveref{#1}}} %%%%% Computes the length of its argument @@ -98,7 +107,7 @@ \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}% +\def\@makelabel#1{\refstepcounter{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}}% @@ -109,18 +118,13 @@ \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\@MHreset{\global\def\@MHeqno{\theequation}\global\@MHuseminilabfalse\@MHresetlab} \def\@MHbuildlab#1{\@ifundefined{r@#1}% - {\global\def\@MHeqno{??\sublabeltype{MHCurrentCount}}}% + {\global\def\@MHeqno{\theequation\sublabeltype{MHCurrentCount}}}% {\global\def\@MHeqno{\ref{\@mylabel}\sublabeltype{MHCurrentCount}}}% } -\def\@MHUseLab#1{\@MHbuildlab{#1}\global\@useminilabtrue} +\def\@MHUseLab#1{\@MHbuildlab{#1}\global\@MHuseminilabtrue} -\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 @@ -145,26 +149,39 @@ \def\@MHcrb{{\ifnum0=`}\fi\@ifnextchar[{\@MHcrbwith}{\@MHcrbwith[\z@]}} \def\@MHcrbwith[#1]{\ifnum0=`{\fi}\MH@dd@nds\global\@MHlineskip=#1\cr} -\def\@MHlabel#1{\global\@haslabtrue\global\def\@MHcurrentlabel{#1}} +\def\@MHlabel#1{\global\@MHhaslabtrue\global\def\@MHcurrentlabel{#1}} \def\@MHwritelabel{\def\@currentlabel{\@MHeqno}% - \if@left\kern\displaywidth\kern0.2truecm\else\kern0.2cm\fi% + \if@MHleft\kern\displaywidth\kern0.2truecm\else\kern0.2cm\fi% \MHsavelabel{\@MHcurrentlabel}% - \if@left\kern-\displaywidth\kern-0.2truecm\else\kern-0.2cm\fi} + \if@MHleft\kern-\displaywidth\kern-0.2truecm\else\kern-0.2cm\fi} -\def\@MHstep{\if@tag\else\if@useminilab\refstepcounter{MHCurrentCount}% +\def\@MHstep{\if@MHtag\else\if@MHuseminilab\stepcounter{MHCurrentCount}% \else\refstepcounter{equation}\fi\fi} -\def\@MHputnumber{\if@haslab\@MHstep\if@left\@MHwritelabel\fi% +\def\@MHputnumber{\if@MHhaslab\@MHstep\if@MHleft\@MHwritelabel\fi% \hbox{\rm(\@MHeqno)}% - \if@left\else\@MHwritelabel\fi% - \fi\global\@haslabfalse} + \if@MHleft\else\@MHwritelabel\fi% + \fi\@MHresetlab} + +\def\@MHnotag{\@MHhaslabfalse} \def\@saveMHComms{\@restoretag\let\MHsavecr=\\\let\\=\@MHcr\let\@saveref=\ref\let\ref=\@MHref% - \let\MHsavelabel=\label\let\label=\@MHlabel\let\@MHsavemult\multicol% - \let\multicol\@MHspan\let\@MHsavetext\text\let\text\hbox} + \let\MHsavelabel=\label\let\label=\@MHlabel\let\@MHsavemult\multicol\let\@MHsavetag\notag\let\notag\@MHnotag% + \let\multicol\@MHspan\let\@MHsavetext\text\let\text\hbox\let\@MHsaveequation\theequation\let\theequation\@MHequation} \def\@restoreMHComms{\let\\=\MHsavecr\let\label=\MHsavelabel\@MHreset\let\ref=\@saveref% - \let\multicol\@MHsavemult\let\text\@MHsavetext} + \let\multicol\@MHsavemult\let\notag\@MHsavetag\let\text\@MHsavetext\let\theequation\@MHsaveequation\global\def\@MHequation{\@MHsaveequation}} + + + +\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} +\def\@MHequation{\@MHsaveequation} + + %% Preamble commands \def\MHpre@ne{\MHs@tr@m\hfil$\MH@lign\displaystyle{\MHsh@rp}$\tabskip\z@skip&% @@ -239,29 +256,29 @@ \def\@ealign{\@MHcr\egroup} -\def\@restoretag{\if@tag\global\@tagfalse\global\let\@MHeqno=\@MHsaveno\fi} +\def\@restoretag{\if@MHtag\global\@MHtagfalse\global\let\@MHeqno=\@MHsaveno\fi} \def\@MHtag#1{% - \global\@tagtrue\global\let\@MHsaveno=\@MHeqno% + \global\@MHtagtrue\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} +\def\@equnolabel{\@MHresetlab} +\def\@equlabel[#1]{\label{#1}\global\@MHhaslabtrue} \def\@ealignb{\@MHcr\egroup\egroup} -\def\@equbopt[#1]{\computelength{#1}\ifnum\@MHLength=1\@nocols=#1\else - \label{#1}\global\@haslabtrue\fi +\def\@equbopt[#1]{\computelength{#1}\ifnum\@MHLength=1\@MHnocols=#1\else + \label{#1}\global\@MHhaslabtrue\fi \@ifnextchar[{\@equbopt}{\@equb}} -\def\@equb{\@newbalign{\the\@nocols}} +\def\@equb{\@newbalign{\the\@MHnocols}} %\def\equa{\global\let\@MHcr\@MHcrb% -% $$\@saveMHComms\global\@nocols=1% +% $$\@saveMHComms\global\@MHnocols=1% % \@ifnextchar[{\@equbopt}{\@equb}} -%\def\endequa{\@ealignb\if@haslab\@MHput@lbl{}\fi% +%\def\endequa{\@ealignb\if@MHhaslab\@MHput@lbl{}\fi% % \@restoreMHComms$$\global\@ignoretrue} -\if@flush +\if@MHflush \def\equ{\@saveMHComms \@beginparpenalty\predisplaypenalty \@endparpenalty\postdisplaypenalty @@ -277,7 +294,7 @@ \else \def\equ{$$\@saveMHComms\@ifnextchar[\@equlabel\@equnolabel} \def\endequ{% - \if@haslab\if@left\leqno\else\eqno\fi{\@MHputnumber}\fi% + \if@MHhaslab\if@MHleft\leqno\else\eqno\fi{\@MHputnumber}\fi% \@restoreMHComms$$\global\@ignoretrue} \fi @@ -286,16 +303,16 @@ \newif\if@isequa -\def\@analyzearg[#1]{\computelength{#1}\ifnum\@MHLength=1\@nocols=#1\else +\def\@analyzearg[#1]{\computelength{#1}\ifnum\@MHLength=1\@MHnocols=#1\else \@MHlabel{#1}\global\@isequatrue\fi% \@ifnextchar[{\@analyzearg}{\if@isequa% \global\let\@MHcr\@MHcrb% $$\@saveMHComms\@equb% - \else\@begalign[\the\@nocols]\fi}} + \else\@begalign[\the\@MHnocols]\fi}} \def\@endequs{\@ealign\@restoreMHComms$$} -\def\@endequa{\@ealignb\if@haslab\@MHput@lbl{}\fi% +\def\@endequa{\@ealignb\if@MHhaslab\@MHput@lbl{}\fi% \@restoreMHComms$$} -\def\equs{\global\@isequafalse\@nocols=1\@ifnextchar[{\@analyzearg}{\@begalign[1]}} +\def\equs{\global\@isequafalse\@MHnocols=5\@ifnextchar[{\@analyzearg}{\@begalign[5]}} \def\endequs{\if@isequa\@endequa\else\@endequs\fi\global\@ignoretrue} \let\equa\equs \let\endequa\endequs |