Otared Kavian otared at gmail.com
Wed Mar 30 12:02:04 CEST 2022

Hi Aditya and Mikael,

Indeed in some situations it is useful to number each equation appearing in formulas grouped with \startcases, and one can construct a structure allowing this, as in the example below which is not satisfactory. I am sure Hans can find a better solution…

Here is a working example:

% begin math-cases-numbered.tex
\definemathmatrix[alignedcases]
[align={1:right,2:left,3:left},
distance=3pt,
left={\left\{},
right={\right.},
style=\displaystyle]
\definereferenceformat[informula]  [left=(,right=),text=]
\def\eqref#1{\informula[eq:#1]}

\starttext

Using \type{\startmathfenced} and \type{\startalign} we can number each equation, but the left brace is too far from the formula:
\startplaceformula
\startformula
\startmathfenced[cases]
\startalign[n=3,align={1:right,2:left,3:left}]
\NC \partial_{tt} u - \Delta u + q(x) u \NC = 0 \NC \quad\text{in }\; (0,T)\times\Omega \NR[+]
\NC u \NC = 0 \NC \quad\text{on }\; [0,T]\times\partial\Omega \NR[eq:Dirichlet]
\NC u(0,x) \NC = u_{0} \NC \quad\text{in }\; \Omega \NR[+]
\NC \partial_{t}u(0,x) \NC = v_{0} \NC \quad\text{in }\; \Omega \NR[+]
\stopalign
\stopmathfenced
\stopformula
\stopplaceformula
In some situations it is useful to number each equation, for example when we want to say:

Indeed we could study the above wave equation with Neumann boundary conditions, that is when \eqref{Dirichlet} is replaced with
\startplaceformula[eq:Neumann]
\startformula
{\partial u \over \partial {\bi n} } = 0 \quad \text{on }\; [0,T]\times\partial\Omega.
\stopformula
\stopplaceformula

Using \type{\startalignedcases} we cannot number each equation\dots
\startplaceformula
\startformula
\startalignedcases
\NC \partial_{tt} u - \Delta u + q(x) u \NC = 0 \NC \quad\text{in }\; (0,T)\times\Omega \NR
\NC u \NC = 0 \NC \quad\text{in }\; [0,T]\times\partial\Omega \NR
\NC u(0,x) \NC = u_{0} \NC \quad\text{in }\; \Omega \NR
\NC \partial_{t}u(0,x) \NC = v_{0} \NC \quad\text{in }\; \Omega \NR
\stopalignedcases
\stopformula
\stopplaceformula
\stoptext
% end math-cases-numbered.tex

Best regards: Otared

> On 29 Mar 2022, at 18:08, Aditya Mahajan via ntg-context <ntg-context at ntg.nl> wrote:
>
> On Tue, 29 Mar 2022, Mikael Sundqvist via ntg-context wrote:
>
>> On Tue, Mar 29, 2022 at 6:37 AM Otared Kavian <otared at gmail.com> wrote:
>>>
>>> Hi Mikael,
>>
>> Hi Otared,
>>
>>>
>>> Thanks for your explanation and the example you sent about \definemathsimplealign (I didn’t get immediately that « sesac » in the command \startmathfenced[sesac] means « cases » in reverse or mirrored… I guess this is a wise and humourous choice by Hans :-) ).
>>
>> I guess so too :)
>>
>>>
>>> Regarding \startcases, it seems that it is still not possible to number each equation, but I may be overlooking something. I’ll try a few examples and will let you know, as well as Hans.
>>
>> Hm, but a cases environment does not provide several formulas. This is
>> just one formula:
>>
>> \startformula
>> |x|=
>> \startcases
>> \NC x \NC x>0\NR
>> \NC 0 \NC x=0\NR
>> \NC -x \NC x<0\NR
>> \stopcases
>> \stopformula
>>
>> and as such should have (at most) one equation number, right?
>
> However, some sub-disciplines like to number each case (for example, if you want to refer to one of them in the future).
>
>> Only Hans knows if it is (easily) doable to add the possibility to add
>> numbers to each three lines.
>
> In the old implementation, this was tricky (the equation without the equation number should be centered, and the equation number should be flush right). But I think that this should be possible with the new low-level box alignment macros.
>