1

This question already has an answer here:

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.

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    \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
4

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.