1

We all know that \binom{n}{r} in math mode renders the binomial coefficient. For the purposes of a note, I am TeXing up, I am interested in designing a new math operator.

Suppose I called that operator as \bil{}{}, I would like the following input \bil{n}{r} to give <n,r>.

Can anyone please help me with how I would do that?

2 Answers 2

5

How about

\newcommand\bil[2]{%
  \mathord{\left<#1,#2\right>}%
}
3
  • If I understand correctly, can we replace \left< by \langle. I think \langle looks good right?
    – kan
    Mar 30, 2012 at 19:48
  • @KannappanSampath If you wish, but I believe \left< will come out as \langle. Do you see a difference (apart from the fact that \left< can grow)? Mar 30, 2012 at 19:50
  • (Firstly, I agree with your code. It looks much better with \left< than with \langle.)
    – kan
    Mar 30, 2012 at 20:05
3

Someting like this will work:

\documentclass{article}

\newcommand*{\bil}[2]{\ensuremath{\langle #1,#2\rangle}}

\begin{document}

Text Text \bil{4}{11} Text Text or \bil{m}{k} even $a=\bil{u}{r}$

\end{document}
5
  • Yours works just as fine. Minor Beautification: \left< and \right> works well when I tried. Thank you for the answer. +1
    – kan
    Mar 30, 2012 at 19:58
  • You are right, it's better, especially if you want the angle to stretch. Mar 30, 2012 at 20:06
  • 2
    @PeterBreitfeld Please, have a look at tex.stackexchange.com/questions/34830/… about \ensuremath.
    – egreg
    Mar 30, 2012 at 21:31
  • @egreg, thank you for this interesting link. Mar 30, 2012 at 21:49
  • 3
    The "use-\ensuremath-only-when-really-needed" campaign is still going on. :)
    – egreg
    Mar 30, 2012 at 21:55

You must log in to answer this question.

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