Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

How about

\newcommand\bil[2]{%
  \mathord{\left<#1,#2\right>}%
}
share|improve this answer
    
If I understand correctly, can we replace \left< by \langle. I think \langle looks good right? –  kan Mar 30 '12 at 19:48
    
BTW, thanks very much for your answer. –  kan Mar 30 '12 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)? –  Stephan Lehmke Mar 30 '12 at 19:50
    
And, thanks a lot. +1 –  kan Mar 30 '12 at 19:53
    
(Firstly, I agree with your code. It looks much better with \left< than with \langle.) –  kan Mar 30 '12 at 20:05
add comment

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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