# Better double parenthesis notation for multiset

In my combinatorics homework I use double parenthesis to represent a multiset. I have referred to all the answers under Multiset notation in LaTeX on how to build such a notation.

However, the double parenthesis looks good alone but when put together with a binomial, it looks very inconsistent.

I used the code that come from this answer https://tex.stackexchange.com/a/5825/91144, which utilizes a \genfrac with left(/right).

\def\multiset#1#2{\ensuremath{\left(\kern-.3em\left(\genfrac{}{}{0pt}{}{#1}{#2}\right)\kern-.3em\right)}}


Here are four problematic examples

\documentclass{article}

\def\multiset#1#2{\ensuremath{\left(\kern-.3em\left(\genfrac{}{}{0pt}{}{#1}{#2}\right)\kern-.3em\right)}}

\begin{document}

\verb~$\multiset{5}{k}+\multiset{5}{k-1}+\multiset{5}{k-4}$~ \\
$\multiset{5}{k}+\multiset{5}{k-1}+\multiset{5}{k-4}$

\verb~$\sum_{\substack{i+j=15\\i,j\geq0}}\binom{5}{i}\multiset{3}{j}$~ \\
$\sum_{\substack{i+j=15\\i,j\geq0}}\binom{5}{i}\multiset{3}{j}$

\verb~$ab\binom{5}{i}123\multiset{3}{j}cd$~ \\
$ab\binom{5}{i}123\multiset{3}{j}cd$

\verb~$\sum{\multiset{5}{k}\multiset{5}{k}}$~ \\
$\sum_{i=0}^{k}{\multiset{m}{i}\multiset{n}{k-i}}$

\end{document}


1. inconsistent height (inline mode)
2. inconsistent height with \binom (inline mode)
3. incorrect spacing, comparing to \binom (display mode)
4. inconsistent sizes (display mode)

What I wanted is a notation that looks just similar to \binom{n}{k}, i.e. size, shape, spacing, etc, while having two pair of parenthesis around. And I expect it to work both inline and in display mode. Thank you :)

• Source code for the examples? Commented Nov 1, 2015 at 21:36
• But this image of source code! Please make it so, that it can be copied in editor and test it. Commented Nov 1, 2015 at 22:25
• @Zarko: here is it: lpaste.net/6732560716236062720 Commented Nov 1, 2015 at 22:32
• @ShouYa, ok, why you not copy in your question as minimal working example (without line numbers ...) by this you will make to people here eaiery to help you. Commented Nov 1, 2015 at 22:35
• The rules for the delimiter size in generalized fractions are different from those for \left and \right; this is particularly evident in text style. The difference in case 4 is because the - has a depth (you'd see the same with +). Commented Nov 1, 2015 at 23:11

Try this:

\documentclass[preview,border=5mm]{standalone}
\usepackage{mathtools}
\newcommand{\textmultiset}[2]{\bigl(\!{\binom{#1}{#2}}\!\bigr)}
\newcommand{\displaymultiset}[2]{\left(\!{\binom{#1}{#2}}\!\right)}
\newcommand\multiset[2]{\mathchoice{\displaymultiset{#1}{#2}}
{\textmultiset{#1}{#2}}
{\textmultiset{#1}{#2}}
{\textmultiset{#1}{#2}}}
\begin{document}
some text $\multiset{5}{k}+\binom{5}{k-1}+\multiset{5}{k{+}1}$

\bigskip
some text $\sum_{\substack{i+j=15\\i,j\geq0}}\binom{5}{i}\multiset{3}{j}\multiset{3}{j+1}$

$ab\multiset{5}{i+1}123\binom{3}{j+1}cd$

$\sum_{i=0}^{k}{\multiset{m}{i}\binom{n}{k-i}}$
\end{document}


• thank you for your answer. I'm still wondering if the spacing around the \multiset can be better. e.g. ab␣((5,i+1))␣123 looks wider than 123␣(3,j+1)␣cd. Should I just add some \! around the command or is there a better way to do this? Commented Nov 1, 2015 at 23:57
• Instead of \! you can use TeX primitive \kern -<value>, where you set <value> according to your taste. For example, for display version of \multset you can try with \newcommand{\displaymultiset}[2]{\left(\kern-5pt{\binom{#1}{#2}}\!\!\right)} and see, which distance (left or right) looks nicer to you. Commented Nov 2, 2015 at 0:39

I get somewhat better results by tweaking @Zarko's answer to

\newcommand\multiset[2]%
{\mathchoice{\left(\kern-0.5em{\binom{#1}{#2}}\kern-0.5em\right)}
{\bigl(\kern-0.3em{\binom{#1}{#2}}\kern-0.3em\bigr)}
{\bigl(\kern-0.3em{\binom{#1}{#2}}\kern-0.3em\bigr)}
{\bigl(\kern-0.3em{\binom{#1}{#2}}\kern-0.3em\bigr)}}


But e.g. 2^{\multiset{2}{3}} looks ugly (the inner () are a bit too low).