Why is \nsim thicker than \sim?
It seems that it depends on the font — the \nsim
glyph is a different glyph and not made by composition (which, with the default fonts for article
class, comes out quite ugly):
\documentclass{article}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{amssymb}
\begin{document}
\begin{center}
\scalebox{10}{%
$\sim$
$\nsim$
\makebox[0pt][l]{$\nsim$}%
\color{red}$\sim$%
}
\scalebox{10}{%
$\sim$
$\not\sim$
\makebox[0pt][l]{$\not\sim$}%
\color{red}$\sim$%
}
\end{center}
\end{document}
With stix2
fonts things are (in my opinion) much better:
\documentclass{article}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{stix2}
\begin{document}
\begin{center}
\scalebox{10}{%
$\sim$
$\nsim$
\makebox[0pt][l]{$\nsim$}%
\color{red}$\sim$%
}
\scalebox{10}{%
$\sim$
$\not\sim$
\makebox[0pt][l]{$\not\sim$}%
\color{red}$\sim$%
}
\end{center}
\end{document}
...and looking at the example, I think that amssymb
is using the stix glyph under the hood...
With amssymb
, the \thicksim
and \nsim
are a pair, but \sim
and \nsim
are not. To get more consistent output, you can redefine \sim
to \thicksim
by \let\sim\thicksim
.
\documentclass{article}
\usepackage{amssymb}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[blend group=screen, scale=10, every node/.style={scale=10}]
\node[red] {$\sim$};
\node[blue] {$\nsim$};
\begin{scope}[xshift=10pt]
\node[red] {$\thicksim$};
\node[blue] {$\nsim$};
\end{scope}
\end{tikzpicture}
\end{document}
Related implementations:
% latex2e kernel
\DeclareSymbolFont{symbols} {OMS}{cmsy}{m}{n}
\DeclareMathSymbol{\sim} {\mathrel}{symbols}{"18}
% amsfonts.sty
\DeclareSymbolFont{AMSb} {U}{msb}{m}{n}
% amssymb.sty
\DeclareMathSymbol{\thicksim} {\mathrel}{AMSb}{"73}
\DeclareMathSymbol{\nsim} {\mathrel}{AMSb}{"1C}
Since the issue seems to be with the definition of \nsim
, I suggest you redefine it:
\makeatletter
\renewcommand{\nsim}{\mathrel{\mathpalette\n@sim\relax}}
\newcommand{\n@sim}[2]{%
\ooalign{%
$\m@th#1\sim$\cr
\hidewidth$\m@th#1\rotatebox[origin=c]{50}{$#1-$}$\hidewidth\cr
}%
}
\makeatother
For users unfamiliar with \mathpalette
: The mysteries of \mathpalette
For general advice on designing your own symbols: How do you make your own symbol when Detexify fails?
For additional details regarding \ooalign
: https://tex.stackexchange.com/a/22375/125871
To use the above code, the call $a\nsim b_{a\nsim b_{a\nsim b}}$
produces the output
Since the original \sim
command is used to redefine \nsim
, the thickness is equal:
Using mathdesign
: