LaTeX array equivalence with multiline \lbrace
Hi all, With LaTeX, I have $$ \left\lbrace \begin{array}{l} \dot{q}_i = 1 \quad\text{ if } i=k \\ \dot{q}_i = 0 \quad\text{ else} \end{array} \right $$ How to do this within a ConTeXt document ?
< On Jan 24, Renaud AUBIN wrote >
With LaTeX, I have $$ \left\lbrace \begin{array}{l} \dot{q}_i = 1 \quad\text{ if } i=k \\ \dot{q}_i = 0 \quad\text{ else} \end{array} \right $$
Well the ConTeXt way (rather the TeX way) of doing this is to use \cases. $$ \cases{ \dot q_i = 1, & \text{ if } i = k \cr \dot q_i = 0, & \text{ else } \cr } $$  Aditya Mahajan, EECS Systems, University of Michigan http://www.eecs.umich.edu/~adityam  Ph: 7342624008
Aditya Mahajan wrote:
< On Jan 24, Renaud AUBIN wrote >
With LaTeX, I have $$ \left\lbrace \begin{array}{l} \dot{q}_i = 1 \quad\text{ if } i=k \\ \dot{q}_i = 0 \quad\text{ else} \end{array} \right $$
Well the ConTeXt way (rather the TeX way) of doing this is to use \cases.
$$ \cases{ \dot q_i = 1, & \text{ if } i = k \cr \dot q_i = 0, & \text{ else } \cr } $$
maybe we should add a leftright option to the new align mechanism so that one can define such constructs .. does that make sense? Hans  Hans Hagen  PRAGMA ADE Ridderstraat 27  8061 GH Hasselt  The Netherlands tel: 038 477 53 69  fax: 038 477 53 74  www.pragmaade.com  www.pragmapod.nl 
On Wed, 25 Jan 2006, Hans Hagen wrote:
Aditya Mahajan wrote:
< On Jan 24, Renaud AUBIN wrote >
With LaTeX, I have $$ \left\lbrace \begin{array}{l} \dot{q}_i = 1 \quad\text{ if } i=k \\ \dot{q}_i = 0 \quad\text{ else} \end{array} \right $$
Well the ConTeXt way (rather the TeX way) of doing this is to use \cases.
$$ \cases{ \dot q_i = 1, & \text{ if } i = k \cr \dot q_i = 0, & \text{ else } \cr } $$
maybe we should add a leftright option to the new align mechanism so that one can define such constructs .. does that make sense?
If I understand you correctly, then something like this \definealign[cases][left={\left\{}, right={\right.}, n=2, align={left,left}] will give us \startcases, \stopcases which works like \cases. Such a feature will be very useful. Is it possible to define leftright in such a way that \definealign[important][left={\framed\bgroup},right={\egroup}] results in a frame around the equations (and does not include the equation numbers), that is the frame is as broad as the width of the largest equation that follows. This mechanism can be used to highlight equations. Also, in another post, I had asked if it is possible to have cases that are numbered, that is, can I get { b , if whatever (1a) a ={ { c, otherwise (1b) This is not important, but will be nice to have. Aditya
I've read the post [NTGcontext] Math Cases and I'm interested to have the possibility to do this kind of numbering: { b , if whatever (1a) a ={ { c, otherwise (1b) Aditya Mahajan a écrit :
If I understand you correctly, then something like this
\definealign[cases][left={\left\{}, right={\right.}, n=2, align={left,left}]
will give us \startcases, \stopcases which works like \cases. Such a feature will be very useful.
Is it possible to define leftright in such a way that \definealign[important][left={\framed\bgroup},right={\egroup}] results in a frame around the equations (and does not include the equation numbers), that is the frame is as broad as the width of the largest equation that follows. This mechanism can be used to highlight equations.
Also, in another post, I had asked if it is possible to have cases that are numbered, that is, can I get
{ b , if whatever (1a) a ={ { c, otherwise (1b)
This is not important, but will be nice to have.
Aditya _______________________________________________ ntgcontext mailing list ntgcontext@ntg.nl http://www.ntg.nl/mailman/listinfo/ntgcontext
Renaud AUBIN wrote:
I've read the post [NTGcontext] Math Cases and I'm interested to have the possibility to do this kind of numbering:
{ b , if whatever (1a) a ={ { c, otherwise (1b)
If I understand you correctly, then something like this
\definealign[cases][left={\left\{}, right={\right.}, n=2, align={left,left}]
will give us \startcases, \stopcases which works like \cases. Such a feature will be very useful.
Is it possible to define leftright in such a way that \definealign[important][left={\framed\bgroup},right={\egroup}] results in a frame around the equations (and does not include the equation numbers), that is the frame is as broad as the width of the largest equation that follows. This mechanism can be used to highlight equations.
Also, in another post, I had asked if it is possible to have cases that are numbered, that is, can I get
{ b , if whatever (1a) a ={ { c, otherwise (1b)
This is not important, but will be nice to have.
something like this?
\unprotect \definesystemvariable{ce} \def\v!mathcases {mathcases} \def\c!numberdistance{numberdistance} \def\setupmathcases {\dodoubleempty\dosetupmathcases} \def\dosetupmathcases[#1][#2]% {\ifsecondargument \getparameters[\??ce#1][#2]% \else \getparameters[\??ce][#1]% \fi} \let\currentmathcases\empty \def\mathcasesparameter#1% {\executeifdefined{\??ce\currentmathcases#1}{\executeifdefined{\??ce#1}\empty}} \setupmathcases [\c!distance=1em, \c!numberdistance=2.5em] \def\definemathcases {\dodoubleempty\dodefinemathcases} \def\dodefinemathcases[#1]% [#2]% {\setvalue{\e!start#1}{\dodoubleempty\dostartmathcases[#1]}% \setvalue{\e!stop #1}{\dostopmathcases}% \setupmathcases[#1]}% [#2] \definemathcases[cases] \definemathcases[\v!mathcases] \def\dodocasesNC {\gdef\docasesNC{\endmath&}} \let\docasesNR\doalignNR \def\dostartmathcases[#1][#2]% {\begingroup \edef\currentmathcases{#1}% \doifassignmentelse{#2}{\setupmathcases[#1][#2]}\donothing \left\{% \,% \vcenter\bgroup \pushmacro\docasesNC \let\endmath\relax \def\NC{\docasesNC}% \def\MC{\docasesNC\ifmmode\else$\def\endmath{$}\fi}% \global\let\docasesNC\dodocasesNC \def\NR{\endmath&\global\let\docasesNC\dodocasesNC\doxxdoubleempty\docasesNR}% \normalbaselines \mathsurround\zeropoint \everycr\emptytoks \tabskip\zeropoint \global\eqaligncolumn\plusone \halign\bgroup \span$##$\hfil &\hskip\mathcasesparameter\c!distance\relax\popmacro\docasesNC##\hfil &\hskip\mathcasesparameter\c!numberdistance\relax\span\textineqalign{##}% \crcr} % todo: number \def\dostopmathcases {\crcr \egroup \popmacro\docasesNC \egroup \right. \endgroup} \protect \showframe \placeformula \startformula \startcases \NC 2 \NC $ y > 0 $ \NR \NC 7 \NC $ x = 7 $ \NR[+] \NC 4 \NC otherwise \NR \stopcases \stopformula \placeformula \startformula x \startcases \NC 2 \NC $ y > 0 $ \NR[+] \NC 7 \NC $ x = 7 $ \NR \NC 4 \NC otherwise \NR \stopcases \stopformula \placeformula \startformula \startcases \NC 2 \NC $ y > 0 $ \NR \NC 7 \NC $ x = 7 $ \NR \NC 4 \NC otherwise \NR \stopcases \stopformula \placeformula \startformula x \startcases \NC 2 \NC $ y > 0 $ \NR \NC 7 \NC $ x = 7 $ \NR \NC 4 \NC otherwise \NR \stopcases \stopformula  Hans Hagen  PRAGMA ADE Ridderstraat 27  8061 GH Hasselt  The Netherlands tel: 038 477 53 69  fax: 038 477 53 74  www.pragmaade.com  www.pragmapod.nl 
Does not compile... I assume that I need to update mathext. Am I right (before update ;) ) ?
< On Jan 26, Hans Hagen wrote >
Also, in another post, I had asked if it is possible to have cases that are numbered, that is, can I get
{ b , if whatever (1a) a ={ { c, otherwise (1b)
This is not important, but will be nice to have.
something like this?
[ code snipped ]
\placeformula \startformula \startcases \NC 2 \NC $ y > 0 $ \NR \NC 7 \NC $ x = 7 $ \NR[+] \NC 4 \NC otherwise \NR \stopcases \stopformula
Not exactly. In this, I get two formula numbers, one for the case `x=7' and the other for the entire equation. I can remove \placeformula and almost get the desired behaviour. There should be an option to flushright the equation number corresponding to each case, i.e., I should be able to get ++    ,    15, if something (1)   x = {    0, otherwise (2)   `  ++ Where the frame is the page boundaries. I hope I am making sense here. Further, I can not get correct subnumbering here. Look at the output of \startformula \startcases \NC a \NC if something \NR[eq:a][a] \NC b \NC otherwise \NR[eq:b][b] \stopcases \stopformula Other than these minor glitches, this is perfect. Aditya  Aditya Mahajan, EECS Systems, University of Michigan http://www.eecs.umich.edu/~adityam  Ph: 7342624008
Aditya Mahajan wrote:
Not exactly. In this, I get two formula numbers, one for the case `x=7' and the other for the entire equation. I can remove \placeformula and almost get the desired behaviour. There should be an option to flushright the equation number corresponding to each case, i.e., I should be able to get
++    ,    15, if something (1)   x = {    0, otherwise (2)   `  ++
Where the frame is the page boundaries. I hope I am making sense here.
this is not easy since the "x = big left brace" and "matrix" are independent things and i see no easy way to flush the matrix related number to the margin; i leave that to taco because he has more insight in what is possible in math/alignments Hans
Hans Hagen wrote:
++    ,    15, if something (1)   x = {    0, otherwise (2)   `  ++
The basic TeX structure for this would be an fullwidth \eqalignno, like so: \def\fixeqline{\noalign{\kern.4\baselineskip}} \def\guessedstrut{\vrule height 12pt depth 12pt width0pt} $$\eqalignno{ & 15, \hbox{ if something} & (1)\cr \fixeqline x=\smash{\left\{\guessedstrut\right .} & & \cr \fixeqline & 0, \hbox{ otherwise} & (2)\cr} $$ Not very nice, but TeX (the engine) does not allow a cleaner solution. I guess it is possible to wrap this up in a nicer looking macro, but it requires some trial typesetting for the magical quantities used in the two macros. Cheers, Taco
participants (4)

Aditya Mahajan

Hans Hagen

Renaud AUBIN

Taco Hoekwater