1

My question is the same as this question, but in the context of LyX. The solution for that question was to put the & before = sign.

I manually implemented this tweak in LyX, by changing the raw math code (see below).

My question is this: How do I change the \align environment in LyX so that it automatically accomplishes this tweak every time I use the \align environment? (Instead of having to manually change the raw code for every instance as I did here.)

What I did in LyX:

enter image description here

What the output PDF looks like:

enter image description here

What the TeX code looks like:

\begin{document}
Default \LyX{} align Environment:

\begin{alignat*}{1}
x= & y\\
= & z
\end{alignat*}


Tweaked (to get desired result):

\begin{alignat*}{1}
x & =y\\
 & =z
\end{alignat*}

\end{document}

In response to a comment, I tried putting the "=" sign at all possible positions. Here are the 4 permutations.

enter image description here

The result is not as desired:

enter image description here

  • Why don't you use the align* environment? alignat is made for more than one alignment group. – Bernard Apr 04 '16 at 01:18
  • @Bernard: To be honest, I don't know what the difference is. I happened to use alignat when I first used LyX and that's what I've used ever since. I can perceive no difference between the two. The same problem (described in my above question) still occurs when I use align. –  Apr 04 '16 at 01:23
  • 3
    if lyx is putting the & after the =, then lyx is wrong, and a report should be made to the maintainers. (the recommended/required order is documented in the user's guide for amsmath. that manual also describes the difference between allign and alignat.) – barbara beeton Apr 04 '16 at 01:34
  • 2
    @barbarabeeton LyX doesn't put the = anywhere, the user does, so if it ends up the wrong side of the & it's because the user entered the = in the wrong column. Kenny: Put the = in the second column. – Torbjørn T. Apr 04 '16 at 10:23
  • @TorbjørnT. Please see the two screenshots I added and let me know what you think. I have tried putting the = sign at all possible positions and it is still not as desired. –  Apr 04 '16 at 11:03
  • 1
    alignat isn't designed for setting a=y=a it is designed for a=y b=x – David Carlisle Apr 04 '16 at 11:31
  • @TorbjørnT. -- i'm not a lyx user, but if the spacing is different on the two sides of an = sign, and the & precedes the = sign, then lyx isn't doing what tex is designed to do. the spacing in the presence of & is supposed to be exactly the same as the spacing for a = b (assuming math mode). – barbara beeton Apr 04 '16 at 12:18
  • @barbarabeeton LyX does the right thing (it generates LaTeX code and compiles that to get a PDF, and as far as I can see the correct code is generated in this case). – Torbjørn T. Apr 04 '16 at 12:33
  • Kenny: Can you try to explain exactly what kind of alignment you want to achieve? – Torbjørn T. Apr 04 '16 at 12:34
  • @TorbjørnT. -- okay. since the code isn't shown for the a = y = b example, i must assume that all are input improperly. (certainly something is out of kilter.) – barbara beeton Apr 04 '16 at 14:06
  • is there any news? if not, this question is likely to be closed as unclear. – barbara beeton Jun 04 '16 at 21:48

0 Answers0