7

I'm trying to define Boolean operators NAND and NOR, using a tilde that overlaps either a \wedge or a \vee. I can't find these in the comprehensive list of LaTeX symbols. I tried using \llap, but I'm getting error messages because \wedge and \vee are defined as operators. This is how I would like, them to look:

nor, nand

  • Those tags were absolutely useless. I changed them to something more appropriate. – Henri Menke Jun 13 at 5:33
9

You can exploit \ooalign:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\DeclareRobustCommand{\nand}{\mathbin{\mathpalette\n@and@or\land}}
\DeclareRobustCommand{\nor}{\mathbin{\mathpalette\n@and@or\lor}}

\newcommand{\n@and@or}[2]{%
  \vphantom{#2}%
  \ooalign{$\m@th#1#2$\cr\hidewidth$\m@th#1\sim$\hidewidth\cr}%
}
\makeatother

\begin{document}

$a \land b$ $a \lor b_{a\lor b\land c}$

$a \nand b$ $a \nor b_{a\nor b\nand c}$

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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