The example below shows the intended output when using original TeX code (compiled with ‘context' of TeX Live 2015): a pair of left braced formulas. The first comment shows what works in AMS-LaTeX. However, when trying similar ConTeXt commands, I get the error shown in the comment below. What ConTeXt command might use here? --- \setupformulas[location=left] \starttext \def\equlb#1{\left\{\eqalign{#1}\right.} %equation left braced % AMS-LaTeX %\def\equlb#1{\left\{ \begin{aligned} #1 \end{aligned}\right.} % equation left braced % ConTeXt error: You can't use `\halign' in math mode. %\def\equlb#1{\left\{ \startalign #1 \stopalign\right.} %\def\equlb#1{\left\{ \startmathalignment #1 \stopmathalignment\right.} \startformula \placeformula[JcoordDef] J^j:\equlb{ω^0 &→ 0 \cr ω^j &→ 0} \quad \equlb{ω^k &→ ω^l \cr ω^l &→ -ω^k} \stopformula \stoptext ---
Hans Aberg mailto:haberg-1@telia.com 6. Juli 2015 11:24 The example below shows the intended output when using original TeX code (compiled with ‘context' of TeX Live 2015): a pair of left braced formulas. The first comment shows what works in AMS-LaTeX.
However, when trying similar ConTeXt commands, I get the error shown in the comment below. What ConTeXt command might use here?
Take a look at the wiki page [1] for multiline equations and also the linked PDF at the start of the page. [1] http://wiki.contextgarden.net/Multiline_equations#Cases Wolfgang
[I do not get copies from the list, though having signed up.] Wolfgang Schuster wrote:
On 6 Jul 2015, at 11:24, Hans Aberg
wrote: The example below shows the intended output when using original TeX code (compiled with ‘context' of TeX Live 2015): a pair of left braced formulas. The first comment shows what works in AMS-LaTeX.
However, when trying similar ConTeXt commands, I get the error shown in the comment below. What ConTeXt command might use here?
Take a look at the wiki page [1] for multiline equations and also the linked PDF at the start of the page.
The spacing is different in cases - TeX also has such a variation. Specifically, there is extra space before the conditionals. In addition, it seems \startmathcases ... \stopmathcases is not working with UTF-8: in the example below, the ω’s on the second line, after the arrows, disappear in my PDF. ---- \startformula J^j:\startmathcases\NC ω^0 \NC→ 0 \NR \NC ω^j \NC→ 0 \stopmathcases \quad \startmathcases \NC ω^k \NC→ ω^l \NR \NC ω^l \NC→ -ω^k \stopmathcases \stopformula ----
Hans Aberg mailto:haberg-1@telia.com 7. Juli 2015 01:46 [I do not get copies from the list, though having signed up.]
The spacing is different in cases - TeX also has such a variation. Specifically, there is extra space before the conditionals.
In addition, it seems \startmathcases ... \stopmathcases is not working with UTF-8: in the example below, the ω’s on the second line, after the arrows, disappear in my PDF. This is explained in section 8 of the document:
There are two ways of specifying the second column — \MC (Math Column) and \NC (New Column). If \MC is used, the second column is in \math mode, with \NC it is in ‘text mode’.
---- \startformula J^j:\startmathcases\NC ω^0 \NC→ 0 \NR \NC ω^j \NC→ 0 \stopmathcases \quad \startmathcases \NC ω^k \NC→ ω^l \NR \NC ω^l \NC→ -ω^k \stopmathcases \stopformula ---- Please send always working minimal examples like this:
\starttext \startformula J^j : \startmathcases[distance=\spaceamount] \NC ω^0 \MC → 0 \NR \NC ω^j \NC → 0 \NR \stopmathcases \quad \startmathcases[distance=\spaceamount] \NC ω^k \MC → ω^l \NR \NC ω^l \MC → -ω^k \NR \stopmathcases \stopformula \stoptext Wolfgang
On 7 Jul 2015, at 04:46, Wolfgang Schuster
wrote: The spacing is different in cases - TeX also has such a variation. Specifically, there is extra space before the conditionals.
In addition, it seems \startmathcases ... \stopmathcases is not working with UTF-8: in the example below, the ω’s on the second line, after the arrows, disappear in my PDF. This is explained in section 8 of the document:
FYI, the TeX Live 2015 version from 2007 called context-latex-math.pdf does not have ch. 8.
There are two ways of specifying the second column — \MC (Math Column) and \NC (New Column). If \MC is used, the second column is in \math mode, with \NC it is in ‘text mode’.
I get errors when using \MC - see example below. But the spacing is wrong: too much between the two components. These are not cases, but aligned formulas: one might have a number of alignments, not just one. And I just happen to use left braces on them. ---- \starttext \startformula J^j:\startmathcases\NC ω^0 \MC → 0 \NR \NC ω^j \MC → 0 \stopmathcases \quad \startmathcases \NC ω^k \MC → ω^l \NR \NC ω^l \MC → -ω^k \stopmathcases \stopformula \stoptext ----
Hans Aberg mailto:haberg-1@telia.com 7. Juli 2015 10:30
On 7 Jul 2015, at 04:46, Wolfgang Schuster
wrote: The spacing is different in cases - TeX also has such a variation. Specifically, there is extra space before the conditionals.
In addition, it seems \startmathcases ... \stopmathcases is not working with UTF-8: in the example below, the ω’s on the second line, after the arrows, disappear in my PDF. This is explained in section 8 of the document:
FYI, the TeX Live 2015 version from 2007 called context-latex-math.pdf does not have ch. 8.
There are two ways of specifying the second column — \MC (Math Column) and \NC (New Column). If \MC is used, the second column is in \math mode, with \NC it is in ‘text mode’.
I get errors when using \MC - see example below. The \NR before \stopmathcases is missing in all your examples. But the spacing is wrong: too much between the two components. These are not cases, but aligned formulas: one might have a number of alignments, not just one. And I just happen to use left braces on them.
Take a look at my previous example where I changed the distance between both columns with the distance key. Wolfgang
On 7 Jul 2015, at 16:47, Wolfgang Schuster
wrote:
I get errors when using \MC - see example below.
The \NR before \stopmathcases is missing in all your examples.
OK. Though I know it, it is hard to get used to, coming from LaTeX.
But the spacing is wrong: too much between the two components. These are not cases, but aligned formulas: one might have a number of alignments, not just one. And I just happen to use left braces on them.
Take a look at my previous example where I changed the distance between both columns with the distance key.
I missed that. It fixes the spaces within the formula, but adds space between the two sets relative both TeX and AMS-LaTeX (which has about the same as TeX), cf. example below. In AMS-LaTeX one can have more than one alignment, though when trying it between the “-“ and the “ω” in the second (right-most) set, it adds a lot of space, rather than just trying to align a compactly as possible. In ConTeXt, nothing happens with extra alignments; in TeX, there is an error. So using \startmathcases is a workaround: trying to force it to do something it wasn’t intended for. ---- \starttext \def\equlb#1{\left\{\eqalign{#1}\right.} %equation left braced \startformula J^j:\startmathcases[distance=\spaceamount]\NC ω^0 \MC ↦ 0 \NR \NC ω^j \MC ↦ 0 \NR \stopmathcases \quad \startmathcases[distance=\spaceamount] \NC ω^k \MC ↦ \MC ω^l \NR \NC ω^l \MC ↦ -\MC ω^k \NR \stopmathcases \stopformula \startformula J^j:\equlb{ω^0 &↦ 0 \cr ω^j &↦ 0} \quad \equlb{ω^k &↦ ω^l \cr ω^l &↦ -ω^k} \stopformula \stoptext ----
Hans Aberg mailto:haberg-1@telia.com 7. Juli 2015 18:23
On 7 Jul 2015, at 16:47, Wolfgang Schuster
wrote: I get errors when using \MC - see example below.
The \NR before \stopmathcases is missing in all your examples.
OK. Though I know it, it is hard to get used to, coming from LaTeX.
But the spacing is wrong: too much between the two components. These are not cases, but aligned formulas: one might have a number of alignments, not just one. And I just happen to use left braces on them.
Take a look at my previous example where I changed the distance between both columns with the distance key.
I missed that. It fixes the spaces within the formula, but adds space between the two sets relative both TeX and AMS-LaTeX (which has about the same as TeX), cf. example below.
In AMS-LaTeX one can have more than one alignment, though when trying it between the “-“ and the “ω” in the second (right-most) set, it adds a lot of space, rather than just trying to align a compactly as possible. In ConTeXt, nothing happens with extra alignments; in TeX, there is an error.
So using \startmathcases is a workaround: trying to force it to do something it wasn’t intended for. You can set the alignment for each column in a matrix with the align key.
\definemathmatrix [aligned] [n=2, align={right,left}, distance=\spaceamount] \starttext \startformula J^j: \startaligned[left=\left\{,right=\right.] \NC ω^0 \NC ↦ 0 \NR \NC ω^j \NC ↦ 0 \NR \stopaligned \quad \startaligned[n=3,align={right,middle,left},left=\left\{,right=\right.] \NC ω^k \NC ↦ \NC ω^l \NR \NC ω^l \NC ↦ \NC -ω^k \NR \stopaligned \stopformula \stoptext Wolfgang
On 7 Jul 2015, at 20:17, Wolfgang Schuster
wrote:
You can set the alignment for each column in a matrix with the align key.
\definemathmatrix [aligned] [n=2, align={right,left}, distance=\spaceamount]
\starttext
\startformula J^j: \startaligned[left=\left\{,right=\right.] \NC ω^0 \NC ↦ 0 \NR \NC ω^j \NC ↦ 0 \NR \stopaligned \quad \startaligned[n=3,align={right,middle,left},left=\left\{,right=\right.] \NC ω^k \NC ↦ \NC ω^l \NR \NC ω^l \NC ↦ \NC -ω^k \NR \stopaligned \stopformula
\stoptext
That looks like the right thing. Thanks. Your example is quite close to TeX, cf. example below. I have also put in an extra alignment to see what happens, monospace code alignment style. Changing ‘left’ to ‘right did not seem to have any effect here. ---- \definemathmatrix [aligned] [n=2, align={right,left}, distance=\spaceamount] \starttext \startformula J^j: \startaligned[left=\left\{,right=\right.] \NC ω^0 \NC ↦ 0 \NR \NC ω^j \NC ↦ 0 \NR \stopaligned \quad \startaligned[n=3,align={right,middle,left},left=\left\{,right=\right.] \NC ω^k \NC ↦ \NC \NC ω^l \NR \NC ω^l \NC ↦ \NC -\NC ω^k \NR \stopaligned \stopformula \def\equlb#1{\left\{\eqalign{#1}\right.} %equation left braced \startformula J^j:\equlb{ω^0 &↦ 0 \cr ω^j &↦ 0} \quad \equlb{ω^k &↦ ω^l \cr ω^l &↦ -ω^k} \stopformula \stoptext ----
Hans Aberg mailto:haberg-1@telia.com 7. Juli 2015 20:53
On 7 Jul 2015, at 20:17, Wolfgang Schuster
wrote: You can set the alignment for each column in a matrix with the align key.
\definemathmatrix [aligned] [n=2, align={right,left}, distance=\spaceamount]
\starttext
\startformula J^j: \startaligned[left=\left\{,right=\right.] \NC ω^0 \NC ↦ 0 \NR \NC ω^j \NC ↦ 0 \NR \stopaligned \quad \startaligned[n=3,align={right,middle,left},left=\left\{,right=\right.] \NC ω^k \NC ↦ \NC ω^l \NR \NC ω^l \NC ↦ \NC -ω^k \NR \stopaligned \stopformula
\stoptext
That looks like the right thing. Thanks.
Your example is quite close to TeX, cf. example below.
I have also put in an extra alignment to see what happens, monospace code alignment style. Changing ‘left’ to ‘right did not seem to have any effect here.
Can you see the effect of the alignment? \starttext \startformula \startmatrix[align={left,middle,right}] \NC a \NC b \NC c \NR \NC aa \NC bb \NC cc \NR \NC aaa \NC bbb \NC ccc \NR \stopmatrix \stopformula \stoptext Wolfgang
On 7 Jul 2015, at 21:18, Wolfgang Schuster
wrote:
I have also put in an extra alignment to see what happens, monospace code alignment style. Changing ‘left’ to ‘right did not seem to have any effect here.
Can you see the effect of the alignment?
\starttext
\startformula \startmatrix[align={left,middle,right}] \NC a \NC b \NC c \NR \NC aa \NC bb \NC cc \NR \NC aaa \NC bbb \NC ccc \NR \stopmatrix \stopformula
\stoptext
Thanks. I know that example. I just noticed it seemed to have no effect in the other example, for some reason.
On 7 Jul 2015, at 20:17, Wolfgang Schuster
wrote:
You can set the alignment for each column in a matrix with the align key.
FYI, the document amshelp.pdf says that AMS-LaTeX environments align, align*, and aligned, can have multiple alignments, and gives this example: \begin{align*} K &\approx G * H& i&= j+k& B &\subset C\\ H &\approx A_{0}*B_{0}& i’&= j’+k’& C &= D\cap E\\ G &\approx \coprod_{\alpha\in A} L_{\alpha}& i’’&=j’’+k’’& A &= D \cup E \end{align*} which is typeset so that 'K &\approx G * H’ is one equation aligned on the ‘&’ with the others below, followed by 'i&= j+k’ in the next column. So the ampersands have multiple functions here, it seems: alignment and separating columns. Translating into ConTeXt, one might have (pseudocode): \startformula \startalign \NC K \NA \approx G * H \NC i\NA= j+k \NC B \NA \subset C \NR \NC H \NA \approx A_{0}*B_{0} \NC i’\NA= j’+k’ \NC C \NA = D\cap E\NR \NC G \NA \approx \coprod_{\alpha\in A} L_{\alpha} \NC i’’\NA =j’’+k’’ \NC A \NA = D \cup E \NR \stopalign \stopformula where I have introduce a symbol \NA for alignment.
Hans Aberg mailto:haberg-1@telia.com 7. Juli 2015 21:11
On 7 Jul 2015, at 20:17, Wolfgang Schuster
wrote: You can set the alignment for each column in a matrix with the align key.
FYI, the document amshelp.pdf says that AMS-LaTeX environments align, align*, and aligned, can have multiple alignments, and gives this example: \begin{align*} K&\approx G * H& i&= j+k& B&\subset C\\ H&\approx A_{0}*B_{0}& i’&= j’+k’& C&= D\cap E\\ G&\approx \coprod_{\alpha\in A} L_{\alpha}& i’’&=j’’+k’’& A&= D \cup E \end{align*} which is typeset so that 'K&\approx G * H’ is one equation aligned on the ‘&’ with the others below, followed by 'i&= j+k’ in the next column.
So the ampersands have multiple functions here, it seems: alignment and separating columns.
Translating into ConTeXt, one might have (pseudocode): \startformula \startalign \NC K \NA \approx G * H \NC i\NA= j+k \NC B \NA \subset C \NR \NC H \NA \approx A_{0}*B_{0} \NC i’\NA= j’+k’ \NC C \NA = D\cap E\NR \NC G \NA \approx \coprod_{\alpha\in A} L_{\alpha} \NC i’’\NA =j’’+k’’ \NC A \NA = D \cup E \NR \stopalign \stopformula where I have introduce a symbol \NA for alignment.
You should google for mathalign.pdf which explains and shows examples for the matrix, cases etc. environments. To get the same result as your LaTeX example you can use the m key for \startalign. \starttext \startformula \startalign[m=3,distance=3em] \NC K \NC \approx G * H \NC i \NC = j+k \NC B \NC \subset C \NR \NC H \NC \approx A_{0}*B_{0} \NC i' \NC = j'+k' \NC C \NC = D\cap E \NR \NC G \NC \approx \coprod_{\alpha\in A} L_{\alpha} \NC i'' \NC =j''+k'' \NC A \NC = D \cup E \NR \stopalign \stopformula \stoptext Wolfgang
On 7 Jul 2015, at 21:49, Wolfgang Schuster
wrote:
You should google for mathalign.pdf which explains and shows examples for the matrix, cases etc. environments.
To get the same result as your LaTeX example you can use the m key for \startalign.
\starttext
\startformula \startalign[m=3,distance=3em] \NC K \NC \approx G * H \NC i \NC = j+k \NC B \NC \subset C \NR \NC H \NC \approx A_{0}*B_{0} \NC i' \NC = j'+k' \NC C \NC = D\cap E \NR \NC G \NC \approx \coprod_{\alpha\in A} L_{\alpha} \NC i'' \NC =j''+k'' \NC A \NC = D \cup E \NR \stopalign \stopformula
\stoptext
That is where I started - it does not work with \left\{ … \right. :-)
On 7 Jul 2015, at 21:49, Wolfgang Schuster
wrote:
You should google for mathalign.pdf which explains and shows examples for the matrix, cases etc. environments.
It looks rather basic, except for last formula of section 9. The document amshelp.pdf, ch. 7, has some nice pure math style examples.
participants (2)
-
Hans Aberg
-
Wolfgang Schuster