According to the documentation of unicode-math
, \setminus
is the character U+29F5 (⧵), the Unicode reverse solidus operator. Asana Math, STIX Two Math, XITS Math, Libertinus Math and Cambria Math all have it, at least. I believe that Latin Modern, the TeX Gyre fonts and Fira Math do not (as of 2020). Generally, XITS and STIX Two attempt to be absolutely comprehensive. ETA: New Computer Modern is a replacement for Latin Modern that does.
The very similar Unicode set minus symbol, U+2216 (∖), is much more widely supported. This is called \smallsetminus
in unicode-math
, and in some fonts has a less vertical slant than the traditional LaTeX \setminus
. As of 2020, Latin Modern and all the TeX Gyre fonts have it.
There is an an open bug report about this from 2011 on the unicode-math
tracker, which didn’t result in any consensus on how to resolve the issue. So nothing was ever done, although that doesn’t let GUST off the hook for never updating Latin Modern and the TeX Gyre fonts. The root of the problem was that Microsoft and STIX mapped the Unicode code points differently, and the developers decided not to add a package option for backward slashes like they did for forward slashes. They might also have expected GUST to fix the issue with their fonts sometime that decade.
ETA
Some other solutions no one has yet posted:
Load a math font that contains \setminus
. That is, nearly all of them other than the default! Search this document for \setminus
and you will get half a dozen font specimens.
If you still want to use Latin Modern math for everything else, you can load just this one symbol with:
\setmathfont{Latin Modern Math}
\setmathfont[range=`\setminus, Scale=MatchUppercase]{STIX Two Math}
You can use \smallsetminus
in your source, or redefine \setminus
as:
\AtBeginDocument{\renewcommand\setminus{\smallsetminus}}
The \AtBeginDocument
wrapper is necessary because unicode-math
, for compatibility with other packages, defers most of its definitions until after the preamble.
If you wanted to save the definition from a legacy package such as amssymb
, unicode-math
will overwrite its definition of setminus
even if you include the package afterward. The way to use a legacy definition of a command is to load the legacy package first, save the definition you want with letltxmacro
(in case it’s a robust macro), load unicode-math
, and then restore the saved definition with \AtBeginDocument
.
I would strongly recommend against pasting a backward slash into your source, as there are at least four different backslashes in Unicode and most editors make it impossible to tell them apart. If you do need to insert a specific Unicode codepoint in your source, I would recommend writing it out as, e.g.:
\usepackage{newunicodechar}
\newunicodechar{^^^^29f5}{\smallsetminus} % Remap U+29F5 SET MINUS in the source to U+2216.
which you might conceivably do as a workaround for a document that uses literal ⧵ characters in the source, as at least one other answer has suggested.
Missing character: There is no ⧵ in font [latinmodern-math.otf]/ICU:script=math ;language=DFLT;!
Boguslaw Jackowski
with title\setminus symbol does not show in pdf (Termes, Pagella, Latin Modern)
. Perhaps a second attempt should be done?fontspec
, it seems that an Open Type font is deemed to be a "math" font if it has thessty
feature. Whether or not it has the characters you need, is another story.\setminus
in Latin Modern Math. Should I edit to match the very useful answers?