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.

What's the easiest way to define a \bdiv equivalent to \bmod, i.e., a binary operator for integer division?

I tried \meaning\bmod, but got very primitive TeX commands, so I'm sure there's a higher-level way to define it that would give me the Roman font and binary operation spacing.

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

You can find the definition of \bmod in latex.ltx or source2e. The example below just replaces mod with div:

\documentclass{article}

\makeatletter
\newcommand*{\bdiv}{%
  \nonscript\mskip-\medmuskip\mkern5mu%
  \mathbin{\operator@font div}\penalty900\mkern5mu%
  \nonscript\mskip-\medmuskip
}
\makeatother

\begin{document}
\[ a\bmod b \]
\[ a\bdiv b \]
\end{document}

Result

share|improve this answer
    
Thank you. Now I just have to find where Ubuntu put those two files on my system. :-) –  TOB Nov 10 '12 at 21:02
    
@TOB Just run texdoc source2e or kpsewhich latex.ltx. –  Heiko Oberdiek Nov 10 '12 at 21:34
    
Awesome, thanks! –  TOB Nov 11 '12 at 22:12
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.