4

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}

examples

  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 :)

5
  • 1
    Source code for the examples? – egreg Nov 1 '15 at 21:36
  • But this image of source code! Please make it so, that it can be copied in editor and test it. – Zarko Nov 1 '15 at 22:25
  • @Zarko: here is it: lpaste.net/6732560716236062720 – Shou Ya Nov 1 '15 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. – Zarko Nov 1 '15 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 +). – egreg Nov 1 '15 at 23:11
3

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}

![enter image description here

2
  • 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? – Shou Ya Nov 1 '15 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. – Zarko Nov 2 '15 at 0:39
0

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.