How can I typeset the hollow forward and backward slashes (in mathmode) as used in the attached image? They need to be used alongside normal forward and backward slashes.
Asked
Active
Viewed 931 times
2 Answers
10
You can use \holwd to set the gap.
\documentclass[12pt]{article}
\usepackage{stackengine}
\newcommand\hollowslash{\setbox0=\hbox{/}\def\holwd{3pt}%
\stackengine{-.3pt}{/}{\rlap{\kern-1pt\rule{\holwd}{.4pt}}}{O}{r}{F}{F}{S}%
\kern\dimexpr\holwd-\wd0-.2pt\relax%
\stackengine{-.4pt}{/}{\llap{\rule{\holwd}{.4pt}\kern-1pt}}{U}{l}{F}{F}{S}%
}
\newcommand\hollowbackslash{\setbox0=\hbox{\textbackslash}\def\holwd{2.8pt}%
\stackengine{-.4pt}{\textbackslash}{\rlap{\kern-1pt\rule{\holwd}{.4pt}}}{U}{r}{F}{F}{S}%
\kern\dimexpr\holwd-\wd0-.2pt\relax%
\stackengine{-.3pt}{\textbackslash}{\llap{\rule{\holwd}{.4pt}\kern-1pt}}{O}{l}{F}{F}{S}%
}
\usepackage{amsmath}
\begin{document}
$C\hollowslash(A\hollowbackslash B)$
\end{document}
If you don't mind loading the graphicx package, you can use \reflectbox to cut down on the code. Here it is with \holwd set to 2pt:
\documentclass[12pt]{article}
\usepackage{stackengine}
\newcommand\hollowslash{\setbox0=\hbox{/}\def\holwd{2pt}%
\stackengine{-.3pt}{/}{\rlap{\kern-1pt\rule{\holwd}{.4pt}}}{O}{r}{F}{F}{S}%
\kern\dimexpr\holwd-\wd0-.2pt\relax%
\stackengine{-.4pt}{/}{\llap{\rule{\holwd}{.4pt}\kern-1pt}}{U}{l}{F}{F}{S}%
}
\newcommand\hollowbackslash{\reflectbox{\hollowslash}}
\usepackage{amsmath,graphicx}
\begin{document}
$C\hollowslash(A\hollowbackslash B)$
\end{document}
Steven B. Segletes
- 237,551
-
-
Interesting, but I don't understand why your
\dimexprworks. Isn't a\relaxat the end a required part of the syntax? – Harald Hanche-Olsen Aug 16 '19 at 14:07 -
1@HaraldHanche-Olsen I should add it, but I don't believe it is mandatory unless I start nesting things. The reason it is best practice is to cover those situations when you don't know in advance what will follow. If what follows just happened to be
+3pt, that would get sucked into the\dimexprunexpectedly. I knew that\stackengine, which actually follows the dimensional calculation, would not be confused for a dimensional operation. – Steven B. Segletes Aug 16 '19 at 14:12 -
2OK. I just looked it up, and it says
\dimexpr⟨dimen expr⟩⟨optional spaces and\relax⟩, which makes it clear that the\relaxis also optional. I have clearly been too hasty reading the docs. – Harald Hanche-Olsen Aug 16 '19 at 14:13 -
1@HaraldHanche-Olsen It is certainly a best practice, and I will make an edit. – Steven B. Segletes Aug 16 '19 at 14:14
8
These symbols are defined by the stmaryrd package under the names \fat(b)slash (the spacing for \fatslash is not so good):
\documentclass{article}
\usepackage{stmaryrd}
\begin{document}
\[ A\fatbslash B\qquad C \fatslash D \]
\end{document}
Edit: as suggested by @AndrewSwann, we can have a much better spacing for \fatslash using this code:
\documentclass{article}
\usepackage{stmaryrd}
\newcommand{\myfatslash}{\mathbin{\mkern-6mu\fatslash}}
\begin{document}
\[ A\fatbslash B\qquad C\myfatslash D \]
\end{document}
Bernard
- 271,350
-
2+1 The spacing can be helped with
\newcommand{\myfatslash}{\mathbin{\mkern-6mu\fatslash}}– Andrew Swann Aug 16 '19 at 14:23





stmaryrdhas\fatslashand\fatbslash, but I can never remember how it interacts withamssymb. – campa Aug 16 '19 at 11:39latex double slash symbol. – albert Aug 16 '19 at 11:40\fatslash. The glyph isn't at all centred in its box: there is a huge space on the left, and the glyph protrudes on the right. That's quite strange... – campa Aug 16 '19 at 12:25stmaryrdplays well withamssymb. Agreed, the bounding box is very strange. – Andrew Swann Aug 16 '19 at 14:24heavyvirclesin mind and for some reason I thought it had something to do withamssymb. Now I've looked at the doc again. Thanks for the heads-up. – campa Aug 16 '19 at 14:32