diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/mh/breqn.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/mh/breqn.dtx | 186 |
1 files changed, 50 insertions, 136 deletions
diff --git a/Master/texmf-dist/source/latex/mh/breqn.dtx b/Master/texmf-dist/source/latex/mh/breqn.dtx index 0f01201b370..0f8d0d9a1f6 100644 --- a/Master/texmf-dist/source/latex/mh/breqn.dtx +++ b/Master/texmf-dist/source/latex/mh/breqn.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1997-2003 by Michael J. Downes -% Copyright (C) 2007 by Morten Hoegholm <mh.ctan@gmail.com> +% Copyright (C) 2007-2008 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 @@ -67,7 +67,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: breqn 2007/12/22 v0.97a Breqn (MH)} +\Msg{* Package: breqn 2008/07/28 v0.98 Breqn (MH)} \Msg{************************************************************************} \keepsilent @@ -78,7 +78,7 @@ This is a generated file. Copyright (C) 1997-2003 by Michael J. Downes -Copyright (C) 2007 by Morten Hoegholm <mh.ctan@gmail.com> +Copyright (C) 2007-2008 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 @@ -128,7 +128,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{breqn.drv}% - [2007/12/22 v0.97a breqn (MH)] + [2008/07/28 v0.98 breqn (MH)] \documentclass{ltxdoc} \CodelineIndex \EnableCrossrefs @@ -230,7 +230,7 @@ and the derived files % \fi % % \title{The \pkg{breqn} package} -% \date{2007/12/22 v0.97a} +% \date{2008/07/28 v0.98} % \author{Morten H\o gholm \\\texttt{mh.ctan@gmail.com}} % % \maketitle @@ -648,6 +648,7 @@ and the derived files % \begin{verbatim} % \begin{dmath}[style={\small}] % \begin{dmath}[number={BV}] +% \begin{dmath}[labelprefix={eq:}] % \begin{dmath}[label={xyz}] % \begin{dmath}[relindent={1em}] % \begin{dmath}[compact] @@ -674,7 +675,9 @@ and the derived files % \end{verbatim} % % Use of the normal \cs{label} command instead of the \opt{label} option -% works, I think, most of the time (untested). +% works, I think, most of the time (untested). \opt{labelprefix} prepends +% its argument to the label (only useful as a global option, really), +% and must be called before \opt{label}. % % Use the \opt{relindent} option to specify something other than the % default amount for the indention of relation symbols. The default is @@ -1005,7 +1008,7 @@ and the derived files % % Declare package name and date. % \begin{macrocode} -\ProvidesPackage{breqn}[2007/12/22 v0.97a] +\ProvidesPackage{breqn}[2008/07/28 v0.98] % \end{macrocode} % % @@ -1171,7 +1174,6 @@ and the derived files % \begin{macrocode} \newcount\maxint \maxint=2147483647 % \end{macrocode} -% % \end{macro} % % @@ -1185,7 +1187,6 @@ and the derived files \let\int@b=\@tempcntb \let\int@c=\count@ % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -1207,7 +1208,6 @@ and the derived files \let\dim@e\dimen@ii \let\dim@A\dimen@i % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -1226,7 +1226,6 @@ and the derived files \let\skip@b\@tempskipb \let\skip@c\skip@ % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -1248,7 +1247,6 @@ and the derived files \toksdef\toks@e=6 \toksdef\toks@f=8 % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -1291,7 +1289,6 @@ and the derived files % \begin{macrocode} \def\@ifnexta{\ifx\@tempc\@tempd \let\@tempb\@tempa \fi \@tempb} % \end{macrocode} -% % \end{macro} % \end{macro} % @@ -1323,7 +1320,6 @@ and the derived files % \begin{macrocode} \def\@optarg#1#2{\@ifnext[{#1}{#1[#2]}} % \end{macrocode} -% % \end{macro} % % @@ -1360,7 +1356,6 @@ and the derived files % \begin{macrocode} \def\freeze@glue#1{#11#1\relax} % \end{macrocode} -% % \end{macro} % \begin{macro}{\z@rule} % \begin{macro}{\keep@glue} @@ -1749,7 +1744,6 @@ and the derived files \newmuskip \Dmedmuskip \Dmedmuskip=4mu minus 3mu % medmuskip in displays \newmuskip \Dthickmuskip \Dthickmuskip=5mu minus 2mu % thickmuskip in displays % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -1861,7 +1855,6 @@ and the derived files % \begin{macrocode} \def\eq@overrun{0pt} % \end{macrocode} -% % \end{macro} % % @@ -2024,7 +2017,6 @@ and the derived files \mskip\thickmuskip \@@vadjust{\penalty\tw@}\penalty-\@Mi\@@vadjust{}% } % \end{macrocode} -% % \end{macro} % % @@ -2113,7 +2105,6 @@ and the derived files \let\m@@symDeB\@symDeB \let\m@@symDeA\@symDeA % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -2201,7 +2192,6 @@ and the derived files \let\left\@@left \let\right\@@right } % \end{macrocode} -% % \end{macro} % \end{macro} % @@ -2239,11 +2229,20 @@ and the derived files % Options for the \env{dmath} and \env{dmath*} % environments. % \begin{literalcode} -% \begin{dmath}[label={xyz}] +% \begin{dmath}[label={eq:xyz}] +% \begin{dmath}[labelprefix={eq:},label={xyz}] % \end{literalcode} +% WSPR: added the option for a label prefix, designed to be used in the preamble like so: +% \begin{literalcode} +% \setkeys{breqn}{labelprefix={eq:}} +% \end{literalcode} % \begin{macrocode} -\define@key{breqn}{label}{\def\next@label{\label{#1}}} +\define@key{breqn}{label}{% + \edef\next@label{\noexpand\label{\next@label@pre#1}}% + \let\next@label@pre\@empty} +\define@key{breqn}{labelprefix}{\def\next@label@pre{#1}} \global\let\next@label\@empty +\global\let\next@label@pre\@empty % \end{macrocode} % Allow a variant number. % \begin{literalcode} @@ -2862,7 +2861,6 @@ and the derived files % % % \begin{macro}{\peek@branch} -% % This is a generalized \dquoted{look at next token and choose some action % based on it} function. % \begin{macrocode} @@ -2876,7 +2874,6 @@ and the derived files } \lowercase{\def\peek@skip@space} {\futurelet\@let@token\peek@a}% % \end{macrocode} -% % \end{macro} % % @@ -2954,7 +2951,6 @@ and the derived files \end{#2}% } % \end{macrocode} -% % \end{macro} % % @@ -2993,15 +2989,14 @@ and the derived files % \begin{macrocode} \def\check@punct@or@qed#1{% \xdef\found@punct{\@empty}% BRM: punctuation was being remembered past this eqn. + % WSPR: err, why isn't that just \global\let\found@punct\@empty ? \def\finish@end{\csname end@#1\endcsname\latex@end{#1}}% \check@punct } % \end{macrocode} -% % \end{macro} % \end{macro} % -% % \begin{macro}{\eqpunct} % User-settable function for handling % the punctuation at the end of an equation. You could, for example, @@ -3009,10 +3004,8 @@ and the derived files % \begin{macrocode} \newcommand\eqpunct[1]{\thinspace#1} % \end{macrocode} -% % \end{macro} % -% % \begin{macro}{\set@label} % \cs{set@label} just sets \cs{@currentlabel} but it % takes the counter as an argument, in the hope that \latex will some @@ -3021,10 +3014,8 @@ and the derived files % \begin{macrocode} \providecommand\set@label[2]{\protected@edef\@currentlabel{#2}} % \end{macrocode} -% % \end{macro} % -% % \begin{macro}{\eq@topspace} % \begin{macro}{\eq@botspace} % The action of \cs{eq@topspace} is complicated by the @@ -3147,7 +3138,6 @@ and the derived files % \end{macro} % \end{macro} % -% % \begin{macro}{\eq@resume@parshape} % This should calculate the total height of the equation, % including space above and below, and set prevgraf to the number it would @@ -3159,15 +3149,11 @@ and the derived files % \end{macrocode} % \end{macro} % -% -% -% % \section{Preprocessing the equation body} % \begin{macro}{\eq@startup} % Here is the function that initially collects the equation % material in a box. % -% % \begin{macrocode} \def\eq@startup{% \global\let\EQ@hasLHS\@False @@ -3466,7 +3452,6 @@ and the derived files % \begin{macrocode} \global\let\EQ@afterspace\@empty % \end{macrocode} -% % \end{macro} % \end{macro} % @@ -3928,7 +3913,6 @@ and the derived files % % % \begin{macro}{\eq@trial} -% % The \cs{eq@trial} function tries each candidate % line width in \cs{eq@linewidths} until an equation layout is found % that yields satisfactory line breaks. @@ -4024,7 +4008,6 @@ and the derived files \begingroup #1% } % \end{macrocode} -% % \end{macro} % \begin{macro}{\eq@failout} % @@ -4035,7 +4018,6 @@ and the derived files \global\let\EQ@trial\EQ@last@trial } % \end{macrocode} -% % \end{macro} % \begin{macro}{\eq@trial@save} % @@ -4069,7 +4051,6 @@ and the derived files }% } % \end{macrocode} -% % \end{macro} % \begin{macro}{\eq@trial@b} % @@ -4078,7 +4059,6 @@ and the derived files % \begin{macrocode} \def\eq@trial@b{\eq@trial@c} % \end{macrocode} -% % \end{macro} % % @@ -4118,7 +4098,6 @@ and the derived files \endgroup } % \end{macrocode} -% % \end{macro} % \begin{macro}{\eq@trial@d} % \begin{macrocode} @@ -4127,7 +4106,6 @@ and the derived files % \end{macro} % % \begin{macro}{\eq@check@density} -% % \begin{macrocode} \def\eq@check@density{% %<trace> \breqn@debugmsg{Checking density for layout L}% @@ -4139,17 +4117,15 @@ and the derived files \fi\fi } % \end{macrocode} -% % \end{macro} % % \begin{macro}{\eq@shortLHS} -% % Test to see if we need to apply the \cs{eq@dense@enough} test. % \begin{macrocode} \def\eq@shortLHS{\ifdim\eq@wdL>.44\eq@wdT 1\else 0\fi 0} % \end{macrocode} -% % \end{macro} +% %\verb|\def\eq@shortLHS{\@False}| %======================================== % \begin{macro}{\eq@trial@p} @@ -4171,18 +4147,16 @@ and the derived files %<trace> \debug@showmeasurements } % \end{macrocode} -% % \end{macro} % % % \begin{macro}{\adjust@rel@penalty} -% % Normally this is a no-op. % \begin{macrocode} \let\adjust@rel@penalty\@empty % \end{macrocode} -% % \end{macro} +% % \begin{macro}{\eq@fix@lastline} % Remove parfillskip from the last line box. % \begin{macrocode} @@ -4198,10 +4172,9 @@ and the derived files }% } % \end{macrocode} -% % \end{macro} -% \begin{macro}{\eq@recalc} -% +% +% \begin{macro}{\eq@recalc} % Calculate \cs{eq@wdT} et cetera. % \begin{macrocode} \def\eq@recalc{% @@ -4209,12 +4182,10 @@ and the derived files \let\@elt\eq@recalc@a \eq@measurements \let\@elt\relax } % \end{macrocode} -% % \end{macro} % % % \begin{macro}{\eq@recalc@a} -% % \begin{macrocode} \def\eq@recalc@a#1x#2+#3\@endelt{% \eq@firstht#2\relax @@ -4222,12 +4193,10 @@ and the derived files \@elt#1x#2+#3\@endelt } % \end{macrocode} -% % \end{macro} % % % \begin{macro}{\eq@recalc@b} -% % \begin{macrocode} \def\eq@recalc@b#1X#2,#3x#4+#5@#6\@endelt{% \setlength\dim@a{#2+#3}% @@ -4241,16 +4210,14 @@ and the derived files \ifnum#6>\eq@badness \eq@badness#6\relax\fi } % \end{macrocode} -% % \end{macro} -% \begin{macro}{\eq@layout} -% +% +% \begin{macro}{\eq@layout} % A value of \verb"?" for \cs{eq@layout} means that we should % deduce which layout to use by looking at the size of the components. % Any other value means we have a user-specified override on the % layout. % -% % Layout Definitions. % Based on initial equation measurements, we can choose a sequence of % candidate parshapes that the equation might fit into. @@ -4264,7 +4231,6 @@ and the derived files % % % \begin{macro}{\eq@try@layout@?} -% % This is a branching function used to choose a suitable layout if % the user didn't specify one in particular. % @@ -4337,7 +4303,6 @@ and the derived files % \end{macro} % % \begin{macro}{\eq@try@layout@D} -% % Change the penalty before the first mathrel symbol to encourage a % break there. % @@ -4384,7 +4349,6 @@ and the derived files % \end{macro} % % \begin{macro}{\eq@try@layout@S} -% % In the \dquoted{stepped} layout there is no LHS, or LHS % is greater than the line width and RHS is small. % Then we want to split up the equation into lines of roughly equal @@ -4438,7 +4402,6 @@ and the derived files % \end{macro} % % \begin{macro}{\eq@try@layout@l} -% % This is the \dquoted{step-ladder} layout: similar to the drop-ladder % layout but the LHS is too wide and needs to be broken up. % @@ -4463,11 +4426,9 @@ and the derived files \eq@trial@b{l}{\eq@try@layout@A}% } % \end{macrocode} -% % \end{macro} % % \begin{macro}{\eq@try@layout@A} -% % In the \dquoted{almost-columnar} layout, which is the layout of last % resort, we let all lines run to the full width and leave the adjusting % of the indents to later. @@ -4481,15 +4442,14 @@ and the derived files \if\EQ@hasLHS \def\adjust@rel@penalty{\penalty-99 }\fi \eq@trial@b{A}{}% } -% \end{macrocode} -% +% \end{macrocode} % \end{macro} +% % \begin{macro}{\eq@shiftnumber} % MH: Should be moved to a section where all keys are set to defaults. % \begin{macrocode} \let\eq@shiftnumber\@False % \end{macrocode} -% % \end{macro} % % \begin{macro}{\eq@retry@with@number@a} @@ -4587,8 +4547,8 @@ and the derived files } % \end{macrocode} % \end{macro} +% % \begin{macro}{\adjust@parshape} -% % Varies depending on the layout. % % Adjust a parshape variable for a given set of left\textbar right skips. @@ -4602,13 +4562,11 @@ and the derived files \edef#1{\temp@a}% } % \end{macrocode} -% % \end{macro} % % % \begin{macro}{\adjust@parshape@a} % \begin{macro}{\adjust@parshape@b} -% % \begin{macrocode} \def\adjust@parshape@a#1 #2\relax{% \setlength\dim@a{\leftskip+\rightskip}% @@ -4631,8 +4589,8 @@ and the derived files % \end{macrocode} % \end{macro} % \end{macro} -% \begin{macro}{\eq@ml@record@indents} -% +% +% \begin{macro}{\eq@ml@record@indents} % Plunk the parshape's indent values into an array for easy access % when constructing \cs{eq@measurements}. % \begin{macrocode} @@ -4649,24 +4607,19 @@ and the derived files \@xp\@tempc\@parshape } % \end{macrocode} -% % \end{macro} % -% % \begin{macro}{\@endelt} -% % This is a scan marker. % It should get a non-expandable definition. % It could be \cs{relax}, but let's try a chardef instead. % \begin{macrocode} \chardef\@endelt=`\? % \end{macrocode} -% % \end{macro} % % % \begin{macro}{\eq@measurements} -% % This is similar to a parshape spec but for each line we record more % info: space above, indent, width x height + dp, and badness. % \begin{macrocode} @@ -4675,7 +4628,6 @@ and the derived files ... } % \end{macrocode} -% % \end{macro} % % @@ -4697,7 +4649,6 @@ and the derived files \eq@ml@a \eq@ml@continue } % \end{macrocode} -% % \end{macro} % % @@ -4745,7 +4696,6 @@ and the derived files \ifnum\eq@curline=\z@ \let\eq@ml@continue\relax\fi } % \end{macrocode} -% % \end{macro} % % @@ -4758,7 +4708,6 @@ and the derived files \ifdim\lastskip=\z@ \else \@xp\eq@ml@vspace \fi } % \end{macrocode} -% % \end{macro} % % @@ -4778,7 +4727,6 @@ and the derived files \fi } % \end{macrocode} -% % \end{macro} % % @@ -4854,7 +4802,6 @@ and the derived files % % % \begin{macro}{\eq@dense@enough@b} -% % This is an approximate calculation used to keep from going over % \cs{maxdimen} if the number of lines in our trial break is large % enough to make that a threat. @@ -4880,15 +4827,12 @@ and the derived files \ifdim\dim@b<\dim@c \true@true@true \else \false@true@false \fi } % \end{macrocode} -% % \end{macro} % % \begin{macro}{\eq@parshape} -% % \begin{macrocode} \let\eq@parshape\@empty % \end{macrocode} -% % \end{macro} % % @@ -5006,13 +4950,9 @@ and the derived files % \cs{intereqskip} if the math expressions are (vertically) smaller % than the tag. % -% -% -% % \section{Centered Right-Number Equations} % % \begin{macro}{\eq@dump@box} -% % \arg1 might be \cs{unhbox} or \cs{unhcopy}; \arg2 is % the box name. % \begin{macrocode} @@ -5032,23 +4972,16 @@ and the derived files \adjust@rel@penalty \unhbox\f@ur } % \end{macrocode} -% % \end{macro} % -% -% % Various typesetting bits, invoked from \cs{eq@finish} % BRM: This has been extensively refactored from the original breqn, % initially to get left\textbar right skips and parshape used consistently, % ultimately to get most things handled the same way, in the same order. % -% -% % Given that left and right skips have been set, % typeset the frame, number and equation with the % given number side and placement -% -% % % \begin{macrocode} \def\eq@typeset@Unnumbered{% @@ -5143,7 +5076,7 @@ and the derived files % % Set left \& right skips for centered equations, % making allowances for numbers (if any, right, left) and constraint. -% === +% % Amazingly, I've managed to collect all the positioning logic for % centered equations in one place, so it's more manageable. % Unfortunately, by the time it does all it needs to do, @@ -5349,9 +5282,6 @@ and the derived files } % \end{macrocode} % -% -% -% % \section{Delimiter handling} % The special handling of delimiters is rather complex, but % everything is driven by two motives: to mark line breaks inside @@ -5393,7 +5323,6 @@ and the derived files % \mathrel{\@@left \delimiter... \vrule...\@@right.} % \end{literalcode} % -% % First save the primitive meanings of \cs{left} and % \cs{right}. % \begin{macrocode} @@ -5401,7 +5330,6 @@ and the derived files \@saveprimitive\right\@@right % \end{macrocode} % -% % The variable \cs{lr@level} is used by the first mathrel in % an equation to tell whether it is at top level: yes? break and measure % the LHS, no? keep going. @@ -5409,7 +5337,6 @@ and the derived files \newcount\lr@level % \end{macrocode} % -% % It would be nice to have better error checking here if the % argument is not a delimiter symbol at all. % \begin{macrocode} @@ -5433,7 +5360,6 @@ and the derived files \def\eq@nullright#1{\@@right#1\after@close} % \end{macrocode} % -% % Here is the normal operation of \cs{biggl}, for example. % \begin{literalcode} % \biggl ->\mathopen \bigg @@ -5530,7 +5456,6 @@ and the derived files % \begin{macrocode} \let\m@@DeA\m@DeA\let\d@@DeA\m@DeA% % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -5585,7 +5510,6 @@ and the derived files \ifnum\lr@level<\@ne \eq@binoffset=\eqbinoffset\relax \fi } % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -5868,7 +5792,6 @@ and the derived files \DeclareTwang{)}{-.33} \DeclareTwang{\rbrace}{-.25} % \end{macrocode} -% % \end{macro} % % @@ -6078,7 +6001,6 @@ and the derived files \let\grp@eqs@numbered\@False \let\grp@aligned\@True % \end{macrocode} -% % \end{macro} % \end{macro} % @@ -6532,42 +6454,35 @@ and the derived files % In a series of conditions, use less space between members of the % series than between the conditions and the main equation body. % -% BRM: Some modifications here, since I like for the condition -% to go flush right. (thus, it also affects centering, margins, etc) +% WSPR: tidied/fixed things up as it made sense to me but might have +% broken something else! % \begin{macrocode} \newskip\conditionsep \conditionsep=10pt minus5pt% \newcommand{\conditionpunct}{,} -\let\cond@gobble\@firstofone +% \end{macrocode} +% \begin{macro}{\condition} +% \begin{macrocode} \newcommand\condition{% \begingroup\@tempswatrue - \@ifstar{\@tempswafalse \condition@a}\condition@a -} + \@ifstar{\@tempswafalse \condition@a}{\condition@a}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\condition@a} +% \begin{macrocode} \newcommand\condition@a[2][\conditionpunct]{% \unpenalty\unskip\unpenalty\unskip % BRM Added \hbox{#1}% \penalty -201\relax\hbox{}% Penalty to allow breaks here. \hskip\conditionsep - \if@tempswa \@xp\hbox \else \@xp\condition@b\fi - {#2}% - \endgroup + \setbox\z@\if@tempswa\hbox{#2}\else\hbox{$\textmath@setup #2$}\fi % \end{macrocode} -% BRM: Testing if I can measure conditions? +% BRM's layout is achieved with this line commented out but it has the nasty side-effect of shifting the equation number to the next line: % \begin{macrocode} - \setbox\z@\if@tempswa\hbox{#2}\else\hbox{\textmath@setup #2}\fi - \global\eq@wdCond\wd\z@ - \let\cond@gobble\@gobble -} -% \end{macrocode} -% For a math condition. -% This is called inside a group so we don't need extra grouping to -% localize the effect of \cs{textmath@setup} which turns off the -% line-breaking features of bin, rel, and delimiter symbols. -% \begin{macrocode} -\newcommand\condition@b[1]{% - \cond@gobble{\hskip\conditionsep}% - \textmath@setup #1% -} +% \global\eq@wdCond\wd\z@ + \usebox\z@ + \endgroup} % \end{macrocode} +% \end{macro} % % The \env{dsuspend} environment. First the old one that didn't work. % \begin{macrocode} @@ -6677,7 +6592,6 @@ and the derived files \def\@nref#1#2{\ifx\relax#1??\else \@xp\@firstoftwo#1\fi} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \end{macrocode} -% % \end{macro} % % |