1

Like the command \notin, I want to create a \notBox.

So far I have made $\Box\!\!\!\!\diagdown$, but it does not look good.

May be I need to raise the \diagdown by a little.

Please help making such a symbol.

CarLaTeX
  • 62,716

1 Answers1

3

Let stackengine do the work for you!

I have also changed \diagdown with / to make the symbol similar to \notin.

Edit: I've added a solution without stackengine.

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{stackengine}
\usepackage{graphicx}
\newcommand{\notBox}{\mathrel{\stackinset{c}{}{c}{}{$/$}{$\Box$}}}

\newcommand{\notBoxsimple}{\mathrel{\ooalign{$\Box$\cr$\raise.24ex\hbox{$\mkern2.1mu/$}$\cr}}}

\begin{document}
    Benchmark:
    \[
    A \notin B
    \]
    With \texttt{stackengine}:
    \[
    A \notBox B 
    \]
    Without \texttt{stackengine}:
    \[
    A \notBoxsimple B 
    \]
\end{document}

enter image description here

CarLaTeX
  • 62,716
  • Your output is different than the command provided. But the command is correct. I got what I need. Thanks. – G_0_pi_i_e Sep 01 '17 at 04:18
  • @G_0_pi_i_e Sorry, I wrote my answer with my smartphone and I unwillingly mirrored the image while I was cropping it. It should be correct now, please check, thank you! – CarLaTeX Sep 01 '17 at 04:25
  • It is not working everywhere the same way. In one of my article the / gets misplaced. – G_0_pi_i_e Sep 01 '17 at 04:54
  • Is it possible to make without using stackengine package – G_0_pi_i_e Sep 01 '17 at 04:58
  • @G_0_pi_i_e Of course, it is possible, now I'll try to add an alternative solution, but it's strange that it doesn't work, could you please add an MWE of the case where it doesn't work? – CarLaTeX Sep 01 '17 at 05:02
  • Presence of \usepackage{latexsym} creates the problem. – G_0_pi_i_e Sep 01 '17 at 05:11
  • 1
    @G_0_pi_i_e Problably latexsym modifies the dymension of /. In that case you can simply raise a bit the /: \documentclass{article} \usepackage{amsmath,amssymb} \usepackage{latexsym} \usepackage{stackengine} \newcommand{\notBox}{\mathrel{\stackinset{c}{}{c}{.2ex}{$/‌$}{$\Box$}}} \begin{document} \[ A_1\notBox A_2 \] \end{document} – CarLaTeX Sep 01 '17 at 05:19
  • @G_0_pi_i_e For a solution without stackengine, see my renewed answer. – CarLaTeX Sep 01 '17 at 05:45