TransWikia.com

Difference between commands `setminus` and `backslash`

TeX - LaTeX Asked by richrow on February 3, 2021

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 Answers

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 Usetminus 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 Ubackslash 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

documentclass{article}
usepackage{xcolor,array,booktabs,amssymb}
begin{document}

begin{tabular}{@{} >{$}l<{$} l @{}}
$Result$ & LaTeX code 
midrule
setminusmkern-9mucolor{red}backslash & verb+setminusmkern-9mucolor{red}backslash+ 
addlinespace
Bsetminus D            & verb+Bsetminus D+ 
Bmathbin{setminus}D   & verb+Bmathbin{setminus}D+ 
B:{setminus}:D       & verb+B:{setminus}:D+ 
Bmkern4mu{setminus}mkern4mu D & verb+Bmkern4mu{setminus}mkern4mu D+ 
addlinespace
B{setminus}D           & verb+B{setminus}D+ 
Bbackslash D           & verb+Bbackslash D+ 
addlinespace
Bsmallsetminus D      & verb+Bsmallsetminus D+ 
end{tabular}
end{document}

Answered by Mico on February 3, 2021

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.

Answered by Davislor on February 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP