37

Does anyone know how to make (nice looking) double bracket multiset notation in LaTeX. i.e something like (\binom{n}{k}) where there are two outer brackets instead of 1 as in binomial? You can see an example of what I mean in http://en.wikipedia.org/wiki/Multiset under the heading "Multiset coefficients" with the double brackets.

In wikpedia they typset it as: \left(\!\!{n\choose k}\!\!\right) but although this works well for LaTeX in maths mode, with inline equations the outer bracket becomes much larger than the inner bracket.

I have also tried using \genfrac{((}{))}{0pt}{}{n}{k} but it has an error with the double brackets.

I am using \binom as well in my document, so I would like the bracket sizes to be similar for \binom and \multiset.

Thanks for any help. I'm surprised I can't find a solution on google.

1
  • @user2084: I can't reproduce your observation that with inline equations the outer parentheses become much larger than the inner ones. Can you add a minimal example that illustrates your problem? Nov 23, 2010 at 18:07

4 Answers 4

19

I got the definition below after some tinkering. It seems to look fine at any size.

\documentclass[a4paper,12pt]{article}
\pagestyle{empty}
\usepackage{mathtools}
\def\multiset#1#2{\ensuremath{\left(\kern-.3em\left(\genfrac{}{}{0pt}{}{#1}{#2}\right)\kern-.3em\right)}}

\begin{document}
Consider an inline multiset, \multiset{n}{k}, or a displayed one,
\[ \multiset{n}{k}, \]
or perhaps even a displayed one with something big up- and downstairs,
\[\multiset{
    {\displaystyle \sum_{j=1}^n n^j}}
    {{\displaystyle \sum_{j=1}^n (-1)^j n^j}}_{n \text{ even}}. 
\]
\end{document}

enter image description here

4
  • 2
    Your post was much better before the edit! It's much nicer to see the complete code here on this site. Nov 23, 2010 at 11:52
  • There you go. It's edited back in
    – kahen
    Nov 23, 2010 at 11:56
  • Thanks! By the way, it doesn't seem that the minimal class cares about the 12pt option. Nov 23, 2010 at 18:01
  • 4
    Hi Kahen. Thanks for your help. The main issue with the \left( is that they don't size the same way as the \binom{} brackets in inline mode, so equations which have both \multiset and \binom don't look good in inline. I ended up using two commands. \newcommand{\multiset}[2]{\left(\!\binom{#1}{#2}\!\right)} \newcommand{\tmultiset}[2]{\big(\!\binom{#1}{#2}\!\big)}
    – jjh
    Nov 25, 2010 at 4:47
3

\def\multiset#1#2{\left(\!\left({#1\atopwithdelims..#2}\right)\!\right)} maybe? Looks ok in inline equations.

1
  • 1
    The spacing between parens is a bit too large. Wikipedia's multiset page uses a similar hack but with two \!'s instead of just one on either side, e.g. \left(\!\!{4\choose18}\!\!\right). Jan 24, 2017 at 21:54
3

Old post, but I ran into issues with the other answers, so here's mine:

\newcommand{\mch}[2]{
\left.\mathchoice
  {\left(\kern-0.48em\binom{#1}{#2}\kern-0.48em\right)}
  {\big(\kern-0.30em\binom{\smash{#1}}{\smash{#2}}\kern-0.30em\big)}
  {\left(\kern-0.30em\binom{\smash{#1}}{\smash{#2}}\kern-0.30em\right)}
  {\left(\kern-0.30em\binom{\smash{#1}}{\smash{#2}}\kern-0.30em\right)}
\right.}

With Kahen's answer I had issues if a non-display-mode line had both \binom and \mch (the name \multiset seems a bit off too; I read the symbol as "multichoose"), namely the outer and inner parens weren't of equal size. This answer incorporates jjh's comment above without making you use two separate macros. I'm sure there are minor issues with it, but it works for me in a paper that uses it a bunch of times.

3
  • Did not work for me. "\ch" was not recognized. Jul 25, 2019 at 15:52
  • 1
    Whoops, \ch was just a synonym for \binom. I've updated it. Jul 25, 2019 at 20:59
  • Thanks, I should have guessed that. Jul 29, 2019 at 6:22
0

bmatrix from the amsmath package gives simple, effective results for displayed equations. It does not work well for inline equations, however.

\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{amsmath}

\begin{document}
\begin{bmatrix}
    \begin{bmatrix}
        n \\
        k
    \end{bmatrix}
\end{bmatrix}
\end{document}
1
  • Welcome to TeX.SE! bmatrix had to be in math environment! For inline use you may consider bsmallmatrx defined in the mathtools package.
    – Zarko
    Apr 16, 2022 at 14:53

You must log in to answer this question.

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