开发者

Multiset notation in LaTeX

开发者 https://www.devze.com 2023-01-26 16:40 出处:网络
Does anyone know how to make (nice looking) double bracket multiset notation in LaTeX, i.e something like (\\binom{n}{k开发者_StackOverflow中文版}) where there are two outer brackets instead of 1 as i

Does anyone know how to make (nice looking) double bracket multiset notation in LaTeX, i.e something like (\binom{n}{k开发者_StackOverflow中文版}) 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 Wikipedia they typeset 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.


You can explicitly specify the size of the brackets via

\big( \Big( \bigg( or \Bigg(

Then use \! for negative space to get the brackets closer to each other.


One can use the e-TeX \middle command as follows:

\newcommand{\multibinom}[2]{
  \left(\!\middle(\genfrac{}{}{0pt}{}{#1}{#2}\middle)\!\right)
}

This assumes that you are using the AMSmath package. If not, replace \genfrac with the appropriate construct using \atop.

(Of course this is a hack: the proper solution would be scalable glyphs for the doubled parenthesis, but I can't find any fonts that provide it.)

I'm surprised it wasn't googlable either, so I'll provide a solution here for posterity's sake.


It is also possible to define two different new commands, using \tbinom and \dbinom (section 4.11.2 of the User's Guide for the amsmath Package):

\documentclass{article}
\usepackage{amsmath}

\newcommand{\inlinebnm}[2]{\ensuremath{\big(\!\tbinom{#1}{#2}\!\big)}}
\newcommand{\displybnm}[2]{\bigg(\!\!\dbinom{#1}{#2}\!\!\bigg)}

\begin{document}

Text $\inlinebnm{a}{b}$ text. %% inline

Text \inlinebnm{a}{b} text. %% inline (also ok thanks to ensuremath)

\[
\displybnm{a}{b} %% display-style
\]

\end{document}
0

精彩评论

暂无评论...
验证码 换一张
取 消