0

When I was reading some textbooks about LaTeX, I found that there is some environment causing a lot of confusion: align and alignat. As I have mentioned, I can't distinguish these two environment because I think they have the same function: Choose the position of alignment. The only difference I can see is that alignat allows us to determine the horizontal space and the maximun number of columns. Moreover, I can not know how I can distinguish between this column and another column in alignat environment. Is && the note to distinguish them?

Hoang Nam
  • 133
  • If you haven't read the documentation for the amsmath package (where these environments are defined), you might want to do so. (texdoc amsmath) You are correct that an essential difference between the two is that with alignat, you are required to specify the number of columns, and can specify the spacing. Both environments treat elements in pairs, with positioning <right> & <left> & <right> & <left> & ... If the intention is to start with a left-aligned column, then the first input in a row should be &, or for a left-aligned column later, after a "paired" column, start with &&. – barbara beeton Jan 08 '20 at 02:44
  • 2
  • @JoséCarlosSantos Of course not, I've read it but it do not answer entirely my question so I need to ask my own one – Hoang Nam Jan 08 '20 at 02:56
  • @barbarabeeton I got your ideas that to start with a left-aligned column, then the first input in a row should be &, but can you explain more about &&, I still don't get it – Hoang Nam Jan 08 '20 at 02:59
  • Every other & expands like \hfill (more or less). Nothing actually aligns there. So && is just two &s, one to fill space and the other to align at. – John Kormylo Jan 08 '20 at 05:05
  • There's an example in the "short math guide" (texdoc shortmathguide) that shows alignat with an alignment that has an empty first (left) half of the second "equation" (i.e., left-right pair) on page 4. (The two &s aren't next to one another.) Does that make the concept clearer? This technique is useful for providing short explanatory texts, which should be aligned to the left. – barbara beeton Jan 08 '20 at 05:12
  • The main difference is when there are more alignment points. (remember there will then be n &'s that mark alignments and (n-1) &' s separating alignments, a && just means that we have a separation and an alignment with an empty left hand side). In align an automatic space is added between alignments, in align at no automatic space is added. They each have their uses – daleif Jan 08 '20 at 07:42
  • 1
    the actual question is clearly a duplicate (both literally ask the same question, the difference between align and alignat). If there is a specific point that you are unclear about edit the question (or ask a new one) with a complete small test document that does not work the way you expect, and ask a question about that issue. – David Carlisle Jan 08 '20 at 07:57
  • @DavidCarlisle You should read my question before closing it. I find it very irriating that everyone just reads my title to report it – Hoang Nam Jan 08 '20 at 08:01
  • 1
    @HoangNam I read it and your comment above, but surely you can agree that two questions asking "what is the difference between align and alignat" are the same question. "closing" isn't final if you think you have a different question, edit the question to make that difference clear (I do not see any difference currently) then it can easily be re-opened. – David Carlisle Jan 08 '20 at 08:04

0 Answers0