# Is there a box with a slash? [duplicate]

In my current project, I'm using the boxed versions of certain operations. The amsmath package provides convenient \boxtimes and \boxplus operators for this, which are the same size as \square.

However, I haven't been able to find a box with a slash (i.e. set-minus symbol). Is there a straightforward way I could make one, e.g. by somehow removing one of the lines from \boxtimes, or overlaying \square with an equally-sized slash symbol? The straightforward \not\square looks rather dreadful: . \cancel\square looks somewhat better, but the line still extends beyond the edges of the square: .

## marked as duplicate by Werner, Zarko, Stefan Pinnow, Phelype Oleinik, TeXnicianAug 31 '18 at 20:38

• \boxslash from [stmaryrd](stmaryrd)... – Werner Aug 31 '18 at 19:54
• @Werner That \boxslash is excellent but unfortunately not the same size and position as \square, \boxtimes, and \boxplus. – Draconis Aug 31 '18 at 20:17
• That can easily be changed using a \resizebox or \scalebox and placed in a new command of your choice. – Werner Aug 31 '18 at 20:48

You can use tikz to make your own:

\documentclass{article}
\usepackage{tikz}
\newlength\squareheight
\setlength\squareheight{6.75pt}
\newcommand\squareslash{\tikz{\draw (0,0) rectangle (\squareheight,\squareheight);\draw(0,0) -- (\squareheight,\squareheight)}}
\begin{document}
$A \squareslash B$
\end{document}


Output:

You can then get proper spacing using \DeclareMathOperator:

\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\newlength\squareheight
\setlength\squareheight{6.75pt}
\newcommand\squareslash{\tikz{\draw (0,0) rectangle (\squareheight,\squareheight);\draw(0,0) -- (\squareheight,\squareheight)}}
\DeclareMathOperator\squarediv{\squareslash}
\begin{document}
$A \squarediv B$
\end{document}


Output: