16

I need a symbol as an exclamation mark, on which a negation sign exists:

enter image description here

I've just checked The Comprehensive Latex Symbol List to find something useful but all I've found are the negation symbols of Pages 49-57, where there is no symbol like what I need.

2 Answers2

17

What about this with stackengine?

\documentclass[12pt]{article}
\usepackage{graphicx,amsmath}
\usepackage{stackengine}
\newcommand{\myexc}{\mathrel{\topinset{\rotatebox{-45}{\scalebox{.5}{/}}}{!}{}{}}}
\newcommand{\stevexc}{\mathrel{\stackinset{c}{}{t}{}{\rotatebox{-45}{\scalebox{.5}{$/$}}}{$!$}}}
\newcommand{\steveyc}{\mathrel{\stackinset{c}{}{t}{.15ex}{\scalebox{1.5}[.4]{$/$}}{$!$}}}

\begin{document}
    My original answer:
    \[
    A \myexc B
    \]

    A more correct solution (see Stevens's comment):
    \[
    A \stevexc B
    \]

    Steven's elegant solution without \verb|\rotatebox|:
    \[
    A \steveyc B
    \]
\end{document}

enter image description here

CarLaTeX
  • 62,716
  • Your reputation just keeps "stacking" up! ;^) – Steven B. Segletes May 26 '17 at 18:49
  • I was one of the first to upvote. The other approach I considered was a \scalebox{}[]{/}, with skewed vertical/horizontal magnifications. You might be able to avoid rotating it as such. – Steven B. Segletes May 26 '17 at 18:53
  • I note you did the stack in text mode, which could bite you depending on the font. The use of an inset automatically applied \useanchorwidth, which is good, though \topinset is deprecated towards, instead, the use of \stackinset. – Steven B. Segletes May 26 '17 at 18:54
  • @StevenB.Segletes I didn't manage to get the correct symbol with only \scalebox{}[]{/}. Please look at the \stevexc command and tell me if I correctly understood your suggestion! – CarLaTeX May 26 '17 at 20:28
  • Yes, you transitioned to \stackinset properly, and employed it in math mode. I will try to see if I can do anything with my \scalebox suggestion. – Steven B. Segletes May 26 '17 at 23:50
  • Here is what I had in mind: \newcommand{\steveyc}{\mathrel{\stackinset{c}{}{t}{.15ex}{\scalebox{1.5}[.4]{$/$}}{$!$}}} No rotation required. – Steven B. Segletes May 26 '17 at 23:52
  • @StevenB.Segletes Foolishly, I didn't think to increase the horizontal scaling. I've just added your solution to my answer. Thank you very much! – CarLaTeX May 27 '17 at 06:58
  • 2
    if your stackengines make enough stacks then maybe you can stack exchange? – cat May 27 '17 at 23:44
  • 1
    @cat LOL! stackengine is not mine, it's Steven's. But is your code a catcode? – CarLaTeX May 28 '17 at 03:32
  • Dear @CarLaTeX, is it possible to make the slanted line a bit shorter, similar to its size in \nmid? – Arrow Apr 07 '20 at 20:07
  • @Arrow See egreg's answer, I think it's better than mine, – CarLaTeX Apr 07 '20 at 20:09
13

This might appeal to you.

\documentclass{article}
\usepackage{amsmath}

\DeclareMathSymbol{\smallslash}{\mathord}{operators}{32}
\newcommand{\negexcl}{\mathrel{\smallslash\mkern-5mu{!}}}

\begin{document}

$a\negexcl b$

$a\mathrel{!}b$

\end{document}

enter image description here

A different implementation, with the slash similar to \nmid. The first line shows that the two slashes coincide. The color package is only used for that example.

The symbol won't change according to the math style. It's left as an exercise to adapt it for subscripts and superscripts.

\documentclass{article}
\usepackage{amsmath,amssymb,pict2e,picture}

\usepackage{color}

\newcommand{\negexcl}{\mathrel{\smallslash{!}}}
\makeatletter
\newcommand{\smallslash}{%
  \begingroup
  \sbox\z@{$\m@th\mkern1mu$}%
  \dimen@=\wd\z@
  \begin{picture}(0,0)
  \roundcap
  \put(0,\fontdimen22\textfont2){\line(1,0.9){5\dimen@}}
  \end{picture}%
  \endgroup
}
\makeatother

\begin{document}

{\ooalign{\color{red}$\negexcl$\cr$\nmid$\cr}}
{\ooalign{$\nmid$\cr\color{red}$\negexcl$\cr}}

$a\negexcl b\nmid c$

$a\mathrel{!}b\mid c$

\end{document}

enter image description here

egreg
  • 1,121,712