0

I am wondering how to declare a command \multinom which should resemble the standard notation for the multinomial coefficient. I am trying

\newcommand{\multinom}[2]{\binom{#1}{#2}}

in the preamble, but it does not produce anything similarly looking to the binomial coefficient when called with $\multinom{n}{k}$, the n and k appear outside to the right of the parentheses.

How can I fix my "alias" for \binom from amsmath?


EDIT: The commenters are right. This (straightforward) usage of newcommand works just like it should. I had accidentally left an older incorrect definition lingering in the preamble, my apologies.

3
  • 4
    I get the expected output. Please, make a full (but short) example from \documentclass to \end{document}.
    – egreg
    Commented May 8, 2020 at 20:10
  • With your shown use-case, you could also just use \newcommand{\multinom}{\binom}...
    – Werner
    Commented May 8, 2020 at 20:15
  • I tried to delete the question when I realized, I had made a mistake. However, I was not allowed to delete it. So, instead I edited the question, and accepted the answer by @Sebastiano because he showed my own approach works. In fact, all answers are great. Further, I honored Sebastiano's courteous request to mark BambOo's answer as the Accepted Answer instead of his. Again, my apologies for the confusion.
    – Jim
    Commented May 9, 2020 at 11:50

3 Answers 3

4

Just following the form of the multinomial coefficients in your link, you could do

\newcommand{\multinom}[3]{\binom{#1}{{#2_{1},#2_{2},...,#2_{#3}}}}

Example

\documentclass[margin=3.14mm]{standalone}
\usepackage{amsmath}

\newcommand{\multinom}[3]{\binom{#1}{{#2_{1},#2_{2},...,#2_{#3}}}}

\begin{document}
$\binom{n}{k}$
$\multinom{n}{k}{m}$
\end{document}

enter image description here

8
  • ...what about \multinom{n}{k}{2}?
    – Werner
    Commented May 8, 2020 at 20:11
  • @Werner, For sure this could be problematic, but I wonder if it is really the purpose here. I believe the OP wants something to typeset the litteral expression not a specific numerical one.
    – BambOo
    Commented May 8, 2020 at 20:14
  • I can't see how this answers the question
    – egreg
    Commented May 8, 2020 at 20:19
  • @egreg While it seems my answer isn't the one finally expected by the OP, I believe it answers the statement I am wondering how to declare a command \multinom which should resemble the standard notation for the multinomial coefficient pretty well.
    – BambOo
    Commented May 8, 2020 at 20:57
  • 1
    @Jim Can I please ask you a kindness? Could you give the green tick to the user BambOo that he did a good job? Thank you.
    – Sebastiano
    Commented May 9, 2020 at 11:25
5

If I understand the question, you want to use the control sequence \multinom instead the predefined sequence \binom. Both are macros with two parameters, both should behave the same. Then the most straightforward solution sounds:

\let\multinom=\binom

But maybe I don't understand something. Why to do it?

Note that Plain TeX supports a more human readable notation {n\choose k}.

1
  • This solution is nice, short, and to the point. Answering: Why to do it? First, I never liked the language "n choose k" very much for the binomial coefficient, not in high school, not in university. Second, why introduce a synonym or alias? This is simply to keep one's focus/concentration while writing a long derivation and to keep such derivations human readable on the raw (La)TeX side. :-)
    – Jim
    Commented May 8, 2020 at 21:25
3

Here your example works very well:

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools,amssymb}
\newcommand{\multinom}[2]{\binom{#1}{#2}}    

\begin{document}
    $\multinom{n}{k}, \quad \binom{n}{k}$
\end{document}

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools,amssymb}
\newcommand{\multinom}[2]{\binom{#1}{#2}}    

\begin{document}
    $\multinom{n}{k_1,k_2}, \quad \binom{n}{k}$
\end{document}

enter image description here

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