I am using \sim as a binary operator and was wondering which of the following two was correct:

    \[a \sim b\]
    \[a \mathrel{\sim} b\]

enter image description here

which prompted the more general question: how to know if \mathrel is needed with a particular symbol / commmand?

1 Answer 1


You look at the definition.

> latexdef sim


The initial 3 tells you this is a relation symbol. Similarly

> latexdef oplus


tells you that \oplus is a binary operation symbol.

You can also look in Scott Pakin's “Comprehensive List” with texdoc comprehensive or online on texdoc.org where you find \sim in table 89 “Binary relations”.

Or you can do a test that can tell you about a symbol being a \mathrel or a \mathbin (you'd get \relax in other cases).


  \binrel@{#1}\texttt{\string#1 is \meaning\binrel@@}%






enter image description here

  • Thanks a lot, that's perfect. Out of curiosity, is the "3 is mathrel, 2 is mathbin" documented anywhere that you know of?
    – Clément
    Commented Nov 29, 2023 at 17:10
  • 1
    @Clément In the TeXbook, of course.
    – egreg
    Commented Nov 29, 2023 at 17:11
  • Silly me ;-) Thanks!
    – Clément
    Commented Nov 29, 2023 at 17:16
  • 1
    I'd never heard about \binrel. It is impressive how we discover new tools every day... Thanks.
    – Sigur
    Commented Nov 29, 2023 at 17:29
  • 3
    @Sigur Nice, isn't it? You find an explanation at tex.stackexchange.com/a/18338/4427
    – egreg
    Commented Nov 29, 2023 at 18:03

You must log in to answer this question.

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