Why is there a \, space at the beginning of the "aligned" environment?
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
, [...]
[Update (2019/10/25):
Before retiring from the AMS, I obtained permission to post the original amstex
documentation on CTAN. This consists of two files, both located in https://ctan.org/tex-archive/macros/amstex/doc : amstex.txt
and amsppt.txt
.]
later on, some particular features are addressed:
\matrix
is very much like\multilimits@
, used before. However, now there are two\bgroup
s, corresponding to the{
's for\vcenter{
and\halign{
; and\endmatrix
contributes two\egroup
s. [...]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.
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 :-)
With the release 2016/11/05 v2.16a
of amsmath
the extra space is not added by default.
It is just added if the environment is preceded by a negative space, so that existing documents with a correction \!\begin{aligned}
.. continue to work correctly.
This behaviour may be controlled by three package options:
alignedleftspaceyes
keep the old behaviour of adding this space.alignedleftspaceno
disable adding the space.alignedleftspaceyesifneg
the new default behaviour, do not add the space unless the environment is preceded by a negative skip or kern, so that\!\begin{aligned}
works as before.