I want to write a "approximately equivalent" symbol, which has three strokes like equivalent symbol $$\equiv$$
(≡), but the strokes are like that of approximate symbol $$\approx$$
(≈)
Do you know how to write it in LaTeX?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI want to write a "approximately equivalent" symbol, which has three strokes like equivalent symbol $$\equiv$$
(≡), but the strokes are like that of approximate symbol $$\approx$$
(≈)
Do you know how to write it in LaTeX?
Here I use stacks to set 3 \sim
s vertically. The scalerel
package allows me to preserve the math style of the invocation, and to define the stacking gap as a combination of .5pt
plus 1.5 scaled-to-local-math-style points, given as 1.5\LMpt
.
\documentclass{article}
\usepackage{scalerel,stackengine}
\def\apeqA{\SavedStyle\sim}
\def\apeq{\setstackgap{L}{\dimexpr.5pt+1.5\LMpt}\ensurestackMath{%
\ThisStyle{\mathrel{\Centerstack{{\apeqA} {\apeqA} {\apeqA}}}}}}
\begin{document}
$A \apeq B \equiv C$\par
$\scriptstyle A \apeq B \equiv C$\par
$\scriptscriptstyle A \apeq B \equiv C$\par
\end{document}
If you can use the stix
package (or unicode-math
), then the symbol is available as \approxident
.
Note however that \usepackage{stix}
in a pdfLaTeX document will change all math symbols. Also importing only the symbol from the STIX fonts might give one that's not compatible with your symbols.
There is a solution in the Comprehensive List of Symbols:
\newcommand*{\approxident}{%
\mathrel{\vcenter{\offinterlineskip
\hbox{$\sim$}\vskip-.35ex\hbox{$\sim$}\vskip-.35ex\hbox{$\sim$}}}}
If you don't need the symbol in subscripts, this should be sufficient.
If the symbol \approxident
is not available, see greg's answer,
the following definition provides the symbol by using \sim
three times moved with a gap close to the gap of the \equiv
symbol (more or less because of line thickness issues).
The symbol works in the different math style versions and the lower border of the bounding box is fixed to get a correct bounding box:
\documentclass{article}
\makeatletter
\providecommand*{\approxident}{%
\mathrel{%
\mathpalette\@approxident\sim
}%
}
\newcommand*{\@approxident}[2]{%
% #1: math style
% #2: \sim
% Math axis in \ht0
\sbox0{$#1\vcenter{}$}%
% Gap stored in \dimen2, approximated by the half height
% of \equiv, which is centered around the math axis.
\sbox2{$\m@th#1\equiv$}%
\dimen2=\dimexpr\ht2 - \ht0\relax
% The wave symbol of #2 (\sim) is stored in box 4
\sbox4{$\m@th#1\sim$}%
% and the half height is calculated in \dimen4
\dimen4=\dimexpr\ht4 - \ht0\relax
% Then the movement for the gap in the following \vcenter
% is calculated in \dimen6
\dimen0=\dimexpr
% go back
-\ht4 - \dp4 %
% add gap
+ \dimen2 %
\relax
\vcenter{\offinterlineskip
\copy4 %
\kern\dimen0 %
\copy4 %
\kern\dimen0 %
\copy4 %
% Correction for the lower bounding box border, if the
% wave symbol does not extend to the base line
\ifdim\dp4=\z@
\kern\dimexpr -\ht0 + \dimen4\relax
\fi
}%
}
\makeatother
\begin{document}
\[
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{.1pt}
\fbox{$\approxident$}\;
\equiv\approxident\;
\scriptstyle\equiv\approxident\;
\scriptscriptstyle\equiv\approxident
\]
\end{document}
\approxident
inunicode-math
orstix
packages.