4

Example:

\starttext
\startformula
    \startalign[n=2,align={right,left}]
        \NC x
        \NC = a ~ long ~ sequence ~ of ~ terms
        \NR
        \NC y
        \NC = ok ~ left
        \NR
        \NC \startmatrix[left={\left\lbrack},right={\right\rbrack}]
                \NC x \NR
                \NC y \NR
            \stopmatrix
        \NC = why ~ right?
        \NR
        \NC y
        \NC = ok ~ left ~ again
        \NR
    \stopalign
\stopformula
\stoptext

After the matrix, the specified alignment from \startalign is not applied any more:

Screenshot of the resulting pdf of the example

I thought it was related to https://mailman.ntg.nl/pipermail/ntg-context/2017/089631.html but the code snippet from there did not fix the issue for me.

Using

 \NC \omit $\displaystyle ...$ \hfill

I can push the content in the misaligned row to the left, but the spacing around the equal sign is not quite right then. Is there a better solution (ideally one that fixes the problem document-wide)?

Version: 2019.03.21 21:39

  • Workaround: Add another column and you get the equal signs aligned – DG' Mar 25 at 19:27
  • 1
    That is interesting. I've tested a couple of column configurations and I think I know what happens now: when a matrix is placed in a cell of the align block, it resets the alignment properties for that row. So e.g. if the alignment is {right,left,middle} and a matrix is placed in column 1, the alignment of column 2 starts at right again instead of continuing with left and column 3 is left-aligned instead of centered. – chpolste Mar 25 at 20:41
  • Looks like a candidate for the context mailing list – DG' Mar 25 at 20:51
  • 2
    Definitely looks like a bug. Please report on the context mailing list. – Aditya Mar 25 at 23:20
  • Here is the link to the corresponding mailing list thread: mailman.ntg.nl/pipermail/ntg-context/2019/094457.html. Thank you Aditya for posting, I hadn't had the time in the last few days. – chpolste Mar 29 at 20:54
2

This was a bug in the math matrix code that was introduced when trying to fix a previous limitation (nested matrices did not inherit distance key). It has been fixed in the latest beta (2018.04.04).

For completeness, here is the output corresponding to the MWE in the question:

\starttext
\startformula
    \startalign[n=2,align={right,left}]
        \NC x
        \NC = a ~ long ~ sequence ~ of ~ terms
        \NR
        \NC y
        \NC = ok ~ left
        \NR
        \NC \startmatrix[left={\left\lbrack},right={\right\rbrack}]
                \NC x \NR
                \NC y \NR
            \stopmatrix
        \NC = why ~ right?
        \NR
        \NC y
        \NC = ok ~ left ~ again
        \NR
    \stopalign
\stopformula
\stoptext

enter image description here

1

Your issue looks like a bug. Here is a workaround using three columns instead of two:

\starttext

\def\xymatrix{ \startmatrix[left={\left\lbrack},right={\right\rbrack}] \NC x \NR \NC y \NR \stopmatrix }

\startformula
    \startalign[n=3,align={right,left,left}]
        \NC \NC x               \NC = a ~ long ~ sequence ~ of ~ terms    \NR
        \NC \NC y               \NC = ok ~ left                           \NR
        \NC \xymatrix       \NC \NC = why ~ right?                        \NR
        \NC \NC y               \NC = ok ~ left ~ again                   \NR
    \stopalign
\stopformula
\stoptext

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.