Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Near the beginning of the definition of the amsmath environments aligned and gathered (and also mathtools' multlined) there's an explicit thin space \,. This often has to be cancelled with \!, as has been observed various times: 1 2 3 4 5 6 7

I'd like to know why this explicit \, is there – what would go wrong without it?

From amsmath.dtx:

    \savecolumn@ % Assumption: called inside a group
%    \end{macrocode}
%    The \cs{null} here is to keep the \cs{,} glue from causing the
%    invocation of the clause in \tex/'s built-in tag placement
%    algorithm that can cause an equation to be shifted all the way over
%    to the margin.
%    \begin{macrocode}
share|improve this question
I can only imagine it's there to somehow emulate a \mathinner atom, but the fact that there's not a corresponding \, at the end is puzzling (see smallmatrix –  egreg Feb 16 '13 at 16:25
@Karl'sstudents I don't think that there's an answer smarter than "because the developers decided so". The .dtx file doesn't say more than what reported in the question. –  egreg Mar 16 '13 at 23:40
@egreg: OK. I let the bounty expire by itself if no such smarter answer available. –  Please don't touch Mar 16 '13 at 23:56
@egreg There’s a second question in this question: What could possibly go wrong if I re-defined \start@aligned without \, (assuming a new document without cancelling \!s)? –  Qrrbrbirlbel Mar 17 '13 at 4:20
@egreg: I could also ask why there's \thickmuskip around binary relations, and you could say "because the DEK decided so" :-) But we both know that one can say more to answer that question. –  Hendrik Vogt Mar 17 '13 at 7:08

2 Answers 2

up vote 24 down vote accepted

it will probably take a few tries until i get to the bottom of this, but so far this much is certain:

amsmath was derived from amstex, by michael spivak. \, was already in the amstex \aligned definition, and the adaptation to amsmath didn't remove it.

i'm trying to unearth the (somewhat sparse) amstex documentation to determine if it's explained anywhere. (this is akin to an archaeological dig.)

update: the string \null\, is endemic throughout definitions for anything in amstex that is matrix-like. from the (internal, undistributed) documentation:

\aligned@ is similar to \matrix, [...]

later on, some particular features are addressed:

\matrix is very much like \multilimits@, used before. However, now there are two \bgroups, corresponding to the {'s for \vcenter{ and \halign{; and \endmatrix contributes two \egroups. [...]

There are two other new features. First, we put \, around the \vcenter; this looks better, especially with delimiters. The second feature is the \null before the first \, This is because of the rule regarding numbered formulas on TB, p. 189---if a very wide \matrix is used in a formula with a \tag, we don't want TeX to assume that we put glue before the \matrix in order to control its positioning with respect to that tag!

so one must reach the conclusion that the \, is there on the assumption that aligned structures will often(?)/usually(?) be used within delimiters, as is usual with matrices.

it would have been reasonable to question this assumption during the migration to amsmath, but i can't find any evidence that this was done.

i'll put the matter onto the "research" list for the next overhaul of amsmath, but (as usual) can't make any promises.

share|improve this answer
I'm curious, did you find something in your dig that looks like an explanation? –  Hendrik Vogt May 17 '13 at 6:14
@HendrikVogt -- i did find some relevant comments, and have added them to the answer. not an ideally satisfying explanation, but at least a window into the thinking on which the ams-tex decision was based. –  barbara beeton May 17 '13 at 15:11
Thanks a lot for the update! I guess this is the best answer I can hope for without asking Michael Spivak. Thanks in particular for answering the question I hadn't asked: what the \null is doing there. One thing I find very curious: for \matrix and \smallmatrix there's indeed a \, at the end, as the cited text ("around the \vcenter") suggests, but for \aligned it's not there (which Frank discusses at some length in his nice answer). –  Hendrik Vogt May 18 '13 at 6:59

I went into my archives (had to use the paper versions as the development of AMS-LaTeX was prior to my electronic ones) and it very much looks as if this is a design decision that originates with amstex, i.e., with Mike Spivak.

When Rainer and I got tasked to produce a LaTeX compatible version of amsTeX for LaTeX (2e or rather back then for 2.09 plus NFSS) the goal was to provide the amstex typography and only translate it to LaTeX conventions and the extended font setup etc.

Initially, when I saw this question, I thought that we may have messed up and forgot to add the corresponding \, at the right side, but looking at the sources from 1990 this is the way amstex was designed in the first place. (doesn't mean this is correct for sure :-)

I also consulted the documented source of amstex (unfortunately only available to me in paper form --- does anybody still have this or know a source on the internet?) but that doesn't help here, as this level detail or rather the reason for this decision isn't documented.

When looking at this I think it is simply a bug --- in the code for 20+ years: originated in amstex and added into the amsmath version. It probably makes sense to put a bit more space around constructs like "aligned" or "gathered" but there is no reason whatsoever, that I can see, why this space should be only on the left.

So to answer your question: what would go wrong if it is not there: most certainly nothing whatsoever, except that all your "aligned" or "gathered" or whatever environments would be slightly tighter typeset on the left.

I can't really see any good reason for it being only on the left at all. Putting it on both side might make sense, in fact with typical italic fonts in math putting it just on the right side might make some sense as well, but on the left only, really looks wrong (so file a bug with the AMS :-)

share|improve this answer
Thanks a lot for looking into this and for confirming my feeling that this \, is somewhat odd. –  Hendrik Vogt Mar 24 '13 at 11:06
@mafp I think this is what it boils down to. It may have been on both sides at one time (in which case it would make some sense) and then got lost when the macros got split and restructured. But if so that must have been really early on, i.e., before 1990 as there is no hint or explanation in the documented sources from that time. –  Frank Mittelbach May 17 '13 at 17:24
@mafp re-reading my answer I see more than one typo. Feel free to correct in such cases ... will do so tomorrow but not now, thanks for pointing out –  Frank Mittelbach May 17 '13 at 21:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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