Is there any difference in usage of the mentioned commands? I ask it because, for example, it's known that for functions it's more preferable (and more correct) to use \colon instead of usual :.

  • 2
    Welcome to TeX.SE! – Mico Oct 7 '19 at 18:55
  • 1
    Could you unaccept my answer and accept mico's then I can delete mine (see barbara's comments under my answer) – David Carlisle May 19 '20 at 19:28
  • Thanks, I think:-) – David Carlisle May 20 '20 at 10:52

In the Computer Modern math font family, the shapes of \setminus and \backslash are identical. (Aside: the vertical size of \backslash can be modified by \left and \right directives; that's not the case for \setminus.) That does not mean, though, that the symbols get typeset identically. This is because \backslash has status mathord ("math ordinary"), whereas \setminus has status mathbin ("math binary operators"). Having status mathbin means that in combinations of mathord-mathbin-mathord -- as in U\setminus V -- a "medspace" amount of whitespace gets inserted on both sides of the \setminus symbol.

In contrast, TeX does not insert whitespace between math atoms (to use a TeX jargon word) of status mathord. Hence, no extra whitespace is inserted in U\backslash V.

Finally, mainly for the sake of completeness, it's worth mentioning the existence of the macro \smallsetminus, which is provided by the amssymb package. As one can tell from the final row of the following table, \smallsetminus looks rather different from \setminus, doesn't it?

enter image description here


\begin{tabular}{@{} >{$}l<{$} l @{}}
$Result$ & LaTeX code \\
\setminus\mkern-9mu\color{red}\backslash & \verb+\setminus\mkern-9mu\color{red}\backslash+ \\
B\setminus D            & \verb+B\setminus D+ \\
B\mathbin{\setminus}D   & \verb+B\mathbin{\setminus}D+ \\
B\:{\setminus}\:D       & \verb+B\:{\setminus}\:D+ \\
B\mkern4mu{\setminus}\mkern4mu D & \verb+B\mkern4mu{\setminus}\mkern4mu D+ \\
B{\setminus}D           & \verb+B{\setminus}D+ \\
B\backslash D           & \verb+B\backslash D+ \\
B\smallsetminus D      & \verb+B\smallsetminus D+ 
  • 1
    See my comment under the question:-) (but you could add ams \smallsetminus – David Carlisle May 19 '20 at 19:28
  • @DavidCarlisle - Better now? :-) – Mico May 19 '20 at 20:45
  • 1
    thanks I'll delete if the OP moves the tick – David Carlisle May 19 '20 at 21:08

In unicode-math, \backslash is \ (U+005C) , \setminus is ⧵ (U+29F5) and \smallsetminus is ∖ (U+2216). Also, \xbsol is ⧹ (U+29F9).

This is especially noticeable when using the default font, Latin Modern Math, which lacks \setminus. New Computer Modern Math fixes this bug.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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