# Redefining \smallsetminus by smaller \setminus

I don't like the appearance of \setminus (it's big and doesn't look good), and also don't like the appearence of \smallsetminus (its size is perfect but, in my opinion, it's too horizontal and it's not vertically center).

I found that in normal math this is what I can use:

$A \mathbin{\vcenter{\hbox{\scriptscriptstyle\setminus}}} B$


Which looks like . But it's super thin. So I made the next one (I don't really now how many of those commands work, it has a lot of trial and error):

$A \mathbin{\vcenter{\hbox{\scriptscriptstyle\mathrlap{\setminus}{\hspace{.2pt}\setminus}}} B$


Which looks more like .

At this point I got the desired thickness. But it's ugly if you zoom it, it's not well designed, and does not match the correct size if it's in a subscript (and less in a sub subscript).

## Question:

Any ideas about how to redefine \setminus in order to get that orientation (the same as the usual \setminus), more or less the height is shown in the pictures and the same thickness of the usual \setminus (in all sizes: displaysytle, textstyle (the same as displaystyle), scriptstyle and scriptscriptstyle)?

I listen to all your ideas (including that ones where you try to convince me that the usual \setminus or \smallsetminus ar perfect).

EDIT: Here your are an example of how all looks (\setminus, my macro, \smallsetminus):

Here another example including @AndrewSwann \fgebackslash (\setminus, \smallsetminus, my macro, modified smaller \fgebackslash, \fgebackslash)

-

Given that you don't like the existing shapes in the available fonts, my other suggestion would be to use tikz to draw the symbol; you can then adjust all parameters and coordinates as you wish.

\documentclass{article}

\usepackage{amssymb,tikz}

\newcommand{\mysetminusD}{\hbox{\tikz{\draw[line width=0.6pt,line cap=round] (3pt,0) -- (0,6pt);}}}
\newcommand{\mysetminusT}{\mysetminusD}
\newcommand{\mysetminusS}{\hbox{\tikz{\draw[line width=0.45pt,line cap=round] (2pt,0) -- (0,4pt);}}}
\newcommand{\mysetminusSS}{\hbox{\tikz{\draw[line width=0.4pt,line cap=round] (1.5pt,0) -- (0,3pt);}}}

\newcommand{\mysetminus}{\mathbin{\mathchoice{\mysetminusD}{\mysetminusT}{\mysetminusS}{\mysetminusSS}}}

\begin{document}
\thispagestyle{empty}

\verb+\setminus,\mysetminus,\smallsetminus+:
\begin{displaymath}
A\smallsetminus B
\end{displaymath}

\verb+\mysetminus+ in display, script and scriptscript styles
\begin{displaymath}
\scriptscriptstyle A\mysetminus B
\end{displaymath}

\end{document}


The code provides separate commands for displaystyle, textstyle, scriptstyle and scriptscriptstyle and uses \mathchoice to select the correct one. I have put the textstyle version equal to the displaystyle one. In the \tikz command you can now specify exactly which line to use and what width it should have. I have made the ends of the lines round, instead of square, with the line cap option. Finally, if neccessary you can specify a different bounding box for these characters by addingg the tikz construction

\useasboundingbox (-0.5pt,-0.5pt) rectangle (5pt,8pt);


with appropriate choices of coordinates. (This will avoid the \vcenter type juggling you have in your code.)

Addition If you are worried about the overhead of using a tikz command each time, which I don't think is high in this case, then you can instead of using newcommands use boxes as follows with \newsavebox, \sbox and \usebox:

\newsavebox{\mysetminusD}
\sbox{\mysetminusD}{\hbox{\tikz{\draw[line width=0.6pt,line cap=round]
(3pt,0) -- (0,6pt);}}}
\newsavebox{\mysetminusT}
\sbox{\mysetminusT}{\mysetminusD}
\newsavebox{\mysetminusS}
\sbox{\mysetminusS}{\hbox{\tikz{\draw[line width=0.45pt,line
cap=round] (2pt,0) -- (0,4pt);}}}
\newsavebox{\mysetminusSS}
\sbox{\mysetminusSS}{\hbox{\tikz{\draw[line width=0.4pt,line cap=round] (1.5pt,0) -- (0,3pt);}}}

\newcommand{\mysetminus}{\mathbin{\mathchoice{\usebox{\mysetminusD}}{\usebox{\mysetminusT}}{\usebox{\mysetminusS}}{\usebox{\mysetminusSS}}}}

-
I didn't know this: line cap=round. A new little question. With the other methods we are using letters or modified letters, but with this method we are using TikZ every time we write \mysetminus. I don't know if this is a real problem or not. But I would like to save the command into a glyph or letter (I don't know how to say that, like take a snapshot). If this is a silly thing just don't answer me. However, I like the answer. –  Manuel Dec 16 '12 at 17:38
@Manuel I have updated my answer to include a version that saves the glyphs in boxes. –  Andrew Swann Dec 16 '12 at 18:29
Mmm, sorry, but it's not perfect. I imagined that those saveboxes should work as I have in mind (but they don't, apart that you didn't know what I had in mind because I didn't explained well). My idea, when I say save to a glyph is that it scales with the font: in this case, if you write \Large at the beginning of the document, the \mysetminus doesn't scale and look small. Is possible to make it scale good? –  Manuel Dec 16 '12 at 19:18
OK that is new information. If you retain the unsaved tikz version, then you can use em as units instead of pt. These following the scaling of the font. For the savedbox version, you could use the graphicx package and a scalebox command, appropriately adapted. –  Andrew Swann Dec 16 '12 at 19:27
Okey. Thank you! –  Manuel Dec 16 '12 at 19:37

You could rotate \smallsetminus:

\documentclass{article}
\usepackage{graphicx,amsmath,amssymb}

\newcommand\rsetminus{\mathbin{\mathpalette\rsetminusaux\relax}}
\newcommand\rsetminusaux[2]{\mspace{-4mu}
\raisebox{\rsmraise{#1}\depth}{\rotatebox[origin=c]{-20}{$#1\smallsetminus$}}
\mspace{-4mu}
}
\newcommand\rsmraise[1]{%
\ifx#1\displaystyle .8\else
\ifx#1\textstyle .8\else
\ifx#1\scriptstyle .6\else
.45%
\fi
\fi
\fi}

\begin{document}
$A\rsetminus B_{A\rsetminus B_{A\rsetminus B}}$
\end{document}


-
Thanks for the great answer. This is more a kind of personal choice, but again this doesn't satisfy me at all. I would like the backslash to be smaller (like the pictures I posted). And if I substitute the \textstyle by the \scriptstyle we are again in the same problem (it's thinner than it should). –  Manuel Dec 15 '12 at 17:30

As you are not happy with the standard choices I suggest you try the \fgebackslash from the fge package. Here it is in the middle between \setminus and \smallsetminus:

\documentclass{article}

\usepackage{amssymb,fge}
\newcommand{\mysetminus}{\mathbin{\fgebackslash}}

\begin{document}

$$A\setminus B \qquad A \mysetminus B \qquad A\smallsetminus B$$

\end{document}

-
Thanks for the answer, but I don't like it. It's too thick and too tall. But at this moment, it's better than my solution because if you define \newcommand{\mysetminus}{\mathbin{\vcenter{\hbox{$\scriptstyle\fgebackslash$}}}‌​} it is very similar and has the extra that it works in a subscript (with \scriptscriptstyle). –  Manuel Dec 15 '12 at 14:01
Thinking a little bit more, if we could scale only x axis of the symbol we could get a thinner and perfect one. I will look around. –  Manuel Dec 15 '12 at 17:34