* LaTeX array equivalence with multiline \lbrace @ 2006-01-24 19:23 Renaud AUBIN 2006-01-24 23:37 ` Aditya Mahajan 0 siblings, 1 reply; 11+ messages in thread From: Renaud AUBIN @ 2006-01-24 19:23 UTC (permalink / raw) [-- Attachment #1.1: Type: text/plain, Size: 213 bytes --] 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 ? [-- Attachment #1.2: Type: text/html, Size: 772 bytes --] [-- Attachment #2: Type: text/plain, Size: 139 bytes --] _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: LaTeX array equivalence with multiline \lbrace 2006-01-24 19:23 LaTeX array equivalence with multiline \lbrace Renaud AUBIN @ 2006-01-24 23:37 ` Aditya Mahajan 2006-01-25 12:22 ` Hans Hagen 0 siblings, 1 reply; 11+ messages in thread From: Aditya Mahajan @ 2006-01-24 23:37 UTC (permalink / raw) <--- 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: LaTeX array equivalence with multiline \lbrace 2006-01-24 23:37 ` Aditya Mahajan @ 2006-01-25 12:22 ` Hans Hagen 2006-01-25 13:10 ` Renaud AUBIN 2006-01-25 16:32 ` Aditya Mahajan 0 siblings, 2 replies; 11+ messages in thread From: Hans Hagen @ 2006-01-25 12:22 UTC (permalink / raw) 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 left|right 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.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: LaTeX array equivalence with multiline \lbrace 2006-01-25 12:22 ` Hans Hagen @ 2006-01-25 13:10 ` Renaud AUBIN 2006-01-25 16:32 ` Aditya Mahajan 1 sibling, 0 replies; 11+ messages in thread From: Renaud AUBIN @ 2006-01-25 13:10 UTC (permalink / raw) >maybe we should add a left|right option to the new align mechanism so that one can define such constructs .. does that make sense? > >Hans > > It sounds good to me... Renaud ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: LaTeX array equivalence with multiline \lbrace 2006-01-25 12:22 ` Hans Hagen 2006-01-25 13:10 ` Renaud AUBIN @ 2006-01-25 16:32 ` Aditya Mahajan 2006-01-25 16:41 ` Renaud AUBIN 1 sibling, 1 reply; 11+ messages in thread From: Aditya Mahajan @ 2006-01-25 16:32 UTC (permalink / raw) 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 left|right 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 left|right 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: LaTeX array equivalence with multiline \lbrace 2006-01-25 16:32 ` Aditya Mahajan @ 2006-01-25 16:41 ` Renaud AUBIN 2006-01-26 21:50 ` Hans Hagen 0 siblings, 1 reply; 11+ messages in thread From: Renaud AUBIN @ 2006-01-25 16:41 UTC (permalink / raw) I've read the post [NTG-context] 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 left|right 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 >_______________________________________________ >ntg-context mailing list >ntg-context@ntg.nl >http://www.ntg.nl/mailman/listinfo/ntg-context > > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: LaTeX array equivalence with multiline \lbrace 2006-01-25 16:41 ` Renaud AUBIN @ 2006-01-26 21:50 ` Hans Hagen 2006-01-26 22:28 ` Renaud AUBIN 2006-01-27 2:08 ` Aditya Mahajan 0 siblings, 2 replies; 11+ messages in thread From: Hans Hagen @ 2006-01-26 21:50 UTC (permalink / raw) Renaud AUBIN wrote: >I've read the post [NTG-context] 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 left|right 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.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: LaTeX array equivalence with multiline \lbrace 2006-01-26 21:50 ` Hans Hagen @ 2006-01-26 22:28 ` Renaud AUBIN 2006-01-27 2:08 ` Aditya Mahajan 1 sibling, 0 replies; 11+ messages in thread From: Renaud AUBIN @ 2006-01-26 22:28 UTC (permalink / raw) Does not compile... I assume that I need to update math-ext. Am I right (before update ;-) ) ? ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: LaTeX array equivalence with multiline \lbrace 2006-01-26 21:50 ` Hans Hagen 2006-01-26 22:28 ` Renaud AUBIN @ 2006-01-27 2:08 ` Aditya Mahajan 2006-01-27 8:33 ` Hans Hagen 1 sibling, 1 reply; 11+ messages in thread From: Aditya Mahajan @ 2006-01-27 2:08 UTC (permalink / raw) <--- 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: LaTeX array equivalence with multiline \lbrace 2006-01-27 2:08 ` Aditya Mahajan @ 2006-01-27 8:33 ` Hans Hagen 2006-01-27 9:34 ` Taco Hoekwater 0 siblings, 1 reply; 11+ messages in thread From: Hans Hagen @ 2006-01-27 8:33 UTC (permalink / raw) 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: LaTeX array equivalence with multiline \lbrace 2006-01-27 8:33 ` Hans Hagen @ 2006-01-27 9:34 ` Taco Hoekwater 0 siblings, 0 replies; 11+ messages in thread From: Taco Hoekwater @ 2006-01-27 9:34 UTC (permalink / raw) Hans Hagen wrote: >>+-----------------------------------------------------+ >>| | >>| ,- | >>| | 15, if something (1) | >>| x = { | >>| | 0, otherwise (2) | >>| `- | >>+-----------------------------------------------------+ The basic TeX structure for this would be an full-width \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 ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2006-01-27 9:34 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2006-01-24 19:23 LaTeX array equivalence with multiline \lbrace Renaud AUBIN 2006-01-24 23:37 ` Aditya Mahajan 2006-01-25 12:22 ` Hans Hagen 2006-01-25 13:10 ` Renaud AUBIN 2006-01-25 16:32 ` Aditya Mahajan 2006-01-25 16:41 ` Renaud AUBIN 2006-01-26 21:50 ` Hans Hagen 2006-01-26 22:28 ` Renaud AUBIN 2006-01-27 2:08 ` Aditya Mahajan 2006-01-27 8:33 ` Hans Hagen 2006-01-27 9:34 ` Taco Hoekwater
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).