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.

I want to make the code shorter. I defined the following pair of macros:


My point is that I saw this is a document, with


instead. The first pair of macros do not compile (on sharelatex.com), and the second one does. Why?

share|improve this question
This is a documented restriction of the ams alignments, the \end needs to be explicit Also why the * ? –  David Carlisle Apr 11 at 23:15
Are you not using an editor with auto-completion? –  Sigur Apr 11 at 23:16
@DavidCarlisle: the * was in the original document I found. Is there any way to get what I want (define a macro and avoid equnarray?) –  mookid Apr 11 at 23:17
@Sigur: I do, but I prefer having a shorter code (I really like the code in which I found the macro). –  mookid Apr 11 at 23:18
\def\b* defines \b not \b* (but defines it to require a *) amsmath is open source so you can change anything but basically no, it is not intended that you hide the environment syntax. –  David Carlisle Apr 11 at 23:24

2 Answers 2

up vote 10 down vote accepted

The technote document explains why this kind of shorthand definitions will fail:

enter image description here

share|improve this answer
+1 for superior line-breaking over David's answer. ;) –  Sean Allred Apr 12 at 0:10
Nice! Is there any chance to get it allowed in the future? –  Sigur Apr 12 at 0:31
@Sigur I'm afraid that is a question for the AMS team. barbara beeton could surely provide an informed answer for your question (but I strongly suspect that the answer will be "no"). –  Gonzalo Medina Apr 12 at 0:33
@GonzaloMedina, me too. :-) –  Sigur Apr 12 at 0:40
@Sigur -- yes, the answer is "no". if real bugs aren't addressed in a timely manner, what do you think is the likelihood of a major design change being undertaken? –  barbara beeton Apr 12 at 5:00

The restriction of the AMS alignments that they may not be hidden behind command forms is documented on page 28 of the amsmath guide (texdoc amsmath ) Actually the restriction is better described in the technical notes (texdoc technote) as shown in the other answer.

The names chosen here are particularly dangerous as using \def you lose the warning that you would have had from the correct LaTeX syntax \newcommand that you were over-writing the standard accent command \b.

share|improve this answer
Perhaps you could include the link to the technote document (perhaps even the image) in your answer so I can delete mine? –  Gonzalo Medina Apr 11 at 23:48
@GonzaloMedina I thought it was in technote but I typed texdoc texnotes with an s and got a different document, so I made do with the reference in amsmath guide:-) Leave your answer and I'll cross link:-) –  David Carlisle Apr 11 at 23:50

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.