0

I'd like to generate a command, \dblsetminus, that will print, in math mode, an operator similar to \setminus, but double. I've been able to approximate my desired operator with the following code:

\newcommand\dblsetminus{\setminus\hspace{-1ex}\setminus}

The problem with this is that the spacing following my version of \dblsetminus doesn't behave like the spacing following \setminus. For instance, in an expression like A\dblsetminus B the spacing after the operator is not the same as the spacing before the operator.

How can I get the surrounding spacing to behave like an operator's spacing should?

1 Answer 1

4

Moving left the second \setminus should not be done with \hspace{-1ex}, but with \mspace. The whole symbol should be made into a \mathbin.

\newcommand{\dblsetminus}{\mathbin{{\setminus}\mspace{-5mu}{\setminus}}}

Full example:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\dblsetminus}{\mathbin{{\setminus}\mspace{-5mu}{\setminus}}}

\begin{document}

$A\dblsetminus B$

\end{document}

enter image description here

Adjust the spacing to suit. Exercise: why {\setminus}?

4
  • Right: why {\setminus}?
    – GuM
    Mar 20, 2018 at 13:49
  • @GuM Better safe than sorry
    – egreg
    Mar 20, 2018 at 16:06
  • So the answer to the exercise is "Should anybody want to try this with three slashes…”.
    – GuM
    Mar 20, 2018 at 18:37
  • @GuM Bingo! :-)
    – egreg
    Mar 20, 2018 at 18:43

You must log in to answer this question.

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