1

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: enter image description here. \cancel\square looks somewhat better, but the line still extends beyond the edges of the square: enter image description here.

Draconis
  • 900

1 Answers1

7

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:

enter image description here

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:

enter image description here