Equal sign with vertical line
The vertical line |
is a little tall for my taste. The following definition for \vneq
decreases the total height of the vertical line to match the total height of \neq
. Resizing vertical height will not change the line thickness in horizontal direction.
- The final witdh and height of the vertical line can be fine-tuned by redefining macros
\vneqxscale
and \vneqyscale
. The default is 1
.
\mathpalette
allows the symbol to resize automatically.
Example file:
\documentclass{article}
\usepackage{amssymb}% \varnothing
\usepackage{graphicx}% \resizebox
\makeatletter
\newcommand*{\vneq}{%
\mathrel{%
\mathpalette\@vneq{=}%
}%
}
\newcommand*{\@vneq}[2]{%
% #1: math style (\displaystyle, \textstyle, ...)
% #2: symbol (=, ...)
\sbox0{\raisebox{\depth}{$#1\neq$}}%
\sbox2{\raisebox{\depth}{$#1|\m@th$}}%
\ifdim\ht2>\ht0 %
\sbox2{\resizebox{\vneqxscale\width}{\vneqyscale\ht0}{\unhbox2}}%
\fi
\sbox2{$\m@th#1\vcenter{\copy2}$}%
\ooalign{%
\hfil\phantom{\copy2}\hfil\cr
\hfil$#1#2\m@th$\hfil\cr
\hfil\copy2\hfil\cr
}%
}
\newcommand*{\vneqxscale}{1}
\newcommand*{\vneqyscale}{1}
\makeatother
\begin{document}
\[
% Comparison \neq vs. vneq
\varnothing \neq \emptyset \vneq \varnothing \\
\]
\[
% Check sizes:
\vneq^{\vneq^{\vneq}} \\
\]
\[
% Bounding box checks:
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{.1pt}
\fbox{$\neq$}\,\fbox{$\vneq$}\,\fbox{$|$}
\]
\end{document}

The height can be further decreased, e.g.
\renewcommand*{\vneqyscale}{.8}

Result for mathabx
:

Result for txfonts
:

Result for MnSymbol
:

Here the vertical line is too thick and the horizontal resizing needs shrinking:
\renewcommand*{\vneqxscale}{.67}
Result for MnSymbol
and \vneqxscale
= .67
:

Alternative to varnothing
Instead of changing \neq
, the empty set symbol \varnothing
could be constructed using \not
to match the slope of the slanted vertical lines.
However, \circ
is too small and \bigcirc
too big. Therefore this method is shown for txfonts
that provides \medcirc
and MnSymbol
with \medcircle
.
\documentclass{article}
%\usepackage{txfonts}
%\newcommand*{\varemptysetcircle}{\medcirc}
\usepackage{MnSymbol}
\newcommand*{\varemptysetcircle}{\medcircle}
\makeatletter
\newcommand*{\varemptyset}{%
{% mathord
\vphantom{\not=}% correct height and depth of the final symbol
\mathpalette\@varemptyset\varemptysetcircle
}%
}
\newcommand*{\@varemptyset}[2]{%
% #1: math style (\displaystyle, \textstyle, ...)
% #2: circle
\ooalign{%
\hfil$\m@th#1\not\hphantomeq$\hfil\cr
\hfil$\m@th#1#2$\hfil\cr
}%
}
% \not can be redefined to take an argument
\newcommand*{\hphantomeq}{%
\mathrel{\hphantom{=}}%
}
\makeatother
\usepackage{color}
\begin{document}
\[
\not=\; \color{blue}\neq \varemptyset\; \color{black}\varnothing
\]
\end{document}
Result for txfonts
:

Result for MnSymbol
:

The effect depends a lot on the viewer, I just tried your file and it's more noticeable in xpdf than acrobat, but in both it comes and goes to a certain extent at different zoom levels.
It's hard to make the two parts exactly match at all resolutions as the left hand part is made of one or more characters from the font so is subject to the renderer's font hinting and anti-aliasing (note a slight fuzziness in the small horizontal segment in the left of your image) But the horizontal rule is drawn as a rule not using a font character so goes through a different code path in the renderer. This means that even if they are specified to be exactly the same width and alignment, then at certain resolutions they may snap to different pixel boundaries.
Best Answer
Here is another way of achieving this. You use the command
\equalto{equation}{value}
.And this is the output:
As you can see, I added some spacing to the vertical equal manually (and some horizontal spacing to the
\equalto
command), of course, you can tweak both to get the exact output you want.