27

I ran across a strange warning when trying to use the math command \choose inside the amsmath package's \align* environment:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
{n \choose k}
\end{align*}
\end{document}

Package amsmath Warning: Foreign command \atopwidthdelims; \frac or \genfrac should be used instead

The document still compiles and produces perfectly fine output. But what is causing this warning? And is there a way to get rid of it?

8
  • 3
    It seems amsmath doesn't recognize her own grandfather: \choose is short for \atopwithdelims(), and \atopwithdelims is a TeX primitive. So in that light the word ‘foreign‘ seems quite strange; after all, amsmath, like any other TeX macro package, is built on TeX primitives.
    – morbusg
    Commented Mar 23, 2012 at 6:33
  • 3
    @morbusg "Foreign" refers to the syntax of \choose that doesn't fit with the standard syntax of LaTeX commands.
    – egreg
    Commented Mar 23, 2012 at 9:23
  • 1
    @egreg: if it means that, it'd be nice if it read like that, but as it stands, it reads (emphasis mine): “Warning: Foreign command \atopwithdelims…”.
    – morbusg
    Commented Mar 23, 2012 at 13:15
  • 1
    @morbusg Unfortunately it's not \choose that triggers the warning, but only \atopwithdelims. All the part dealing with this warning should be rewritten if it wanted to cope with a variety of foreign commands.
    – egreg
    Commented Mar 23, 2012 at 13:32
  • 1
    @egreg: you just said “foreign commands” on purpose, didn't you? :-D even though you just said it in perfect form in the previous comment: “doesn't fit with the standard syntax of LaTeX commands”.
    – morbusg
    Commented Mar 23, 2012 at 16:01

2 Answers 2

47

Do not use {n \choose k} in LaTeX (it is a plain TeX command). The recommended way in LaTeX is \usepackage{amsmath} in the preamble and then \binom{n}{k}. (You have then also \tbinom and \dbinom for text and display styles also.)

1
  • 6
    but this doesn't explain why ... the problem is that knuth's format is evil on several levels. the worst is that it forces on us the ghastly \mathchoice, which leads us into problems about multiple evaluation of everything. the practical thing is that it sticks out like a sore thumb from the rest of the syntax of latex, to the extent that it gives headaches to the writers of translators. (i've heard knuth say, in a talk, that he can't see why people care, since it's trivially easy to edit tex source to produce a version to do anything. ha!) Commented Mar 23, 2012 at 9:27
13

Simple answer: Don't use \choose, or don't use amsmath, or live with the warnings.

There is a long explanation of why this kind of construct is deprecated in the document technote.pdf which is part of the amsmath docs, in the section "4 Why do \over, \atop, \above [. . . withdelims] give a warning when I add the amsmath package?"

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .