Changes

Jump to navigation Jump to search
2,416 bytes added ,  19:03, 11 July 2005
Added discussion of \formulanumber and multiline formulas.
<texcode>
Examples:
\placeformula{a}
\startformula
<context>
Examples:
\placeformula{a}
\startformula
What's going on here is simpler than it might appear at first glance. Both <cmd>placeformula</cmd> and <cmd>placesubformula</cmd> produce equation numbers with the optional tag added at the end; the sole difference is that the former increments the equation number first, while the latter does not (and thus can be used for the second and subsequent formulas that use the same formula number but presumably have different tags).
This is sufficient for cases where the standard ConTeXt equation numbers suffice, and where only one equation number is needed per formula. However, there are many cases where this is insufficient, and <cmd>placeformula</cmd> defines <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> commands, which provide hooks to allow the use of ConTeXt-managed formula numbers with plain TeX equation numbering. These, when used within a formula, simply return the formula number in properly formatted form, as can be seen in this simple example with plain TeX's <cmd>eqno</cmd>. Note that the optional tag is inherited from <cmd>placeformula</cmd>.
 
<texcode>
More examples:
\placeformula{c}
\startformula
\let\doplaceformulanumber\empty
c^2 = a^2 + b^2 \eqno{\formulanumber}
\stopformula
</texcode>
 
<context>
More examples:
\placeformula{c}
\startformula
\let\doplaceformulanumber\empty
c^2 = a^2 + b^2 \eqno{\formulanumber}
\stopformula
</context>
 
Normally, using <cmd>formulanumber</cmd> will turn off ConTeXt's automatic formula number placement, and so there will be no interference between the two; however, in this case, it doesn't, and we must turn it off manually with the <tt>\let\doplaceformulanumber\empty</tt> line. (The <cmd>placeformula</cmd> command is still required, however, to set up the numbering.) For more control over sub-formula numbering, <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> have an optional argument parallel to that of <cmd>placeformula</cmd>, as demonstrated in this use of plain TeX's <cmd>eqalignno</cmd>, which places multiple equation numbers within one formula.
 
<texcode>
Yet more examples:
\placeformula
\startformula
\eqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr
d^2 &= e^2 &\formulanumber\cr}
\stopformula
</texcode>
 
<context>
Yet more examples:
\placeformula
\startformula
\eqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr
d^2 &= e^2 &\formulanumber\cr}
\stopformula
</context>
 
Note that both <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> can be used within the same formula, and the formula number is incremented as expected. Also, if an optional argument is specified in both <cmd>placefigure</cmd> and <cmd>formulanumber</cmd>, the latter takes precedence.
==Number Formatting==

Navigation menu