答案1
以下示例将两个符号叠加:
通过 实现,可以尊重当前的数学风格
\mathpalette
。水平
1
居中。波浪号垂直居中。
该实现不需要任何额外的包。
示例文件:
\documentclass{article}
\makeatletter
\newcommand*{\tildeone}{%
\mathord{% or whatever
\mathpalette\@tildeone{}%
}%
}
\newcommand*{\@tildeone}[2]{%
% #1: math style
% #2: unused
\sbox0{$#1\sim\m@th$}% tilde
\sbox2{$#11$}% for height of "1"
\sbox4{$#1\vcenter{}$}% math axis, presumably the middle of "\sim"
\rlap{% place "1"
\hbox to\wd0{\hfil$#11\m@th$\hfil}%
}%
% place the tilde raised to the correct height
\raise\dimexpr.5\ht2 - \ht4\relax\copy0 %
}
\makeatother
\begin{document}
\[ 1 + {\sim} = \tildeone \]
\end{document}
答案2
以下是基于\mathclap
from\mathtools
和\stackinset
from 的三种解决方案stackengine
:
\documentclass[12pt]{article}
\usepackage{mathtools}
\usepackage{stackengine}
\begin{document}
\[ \mathclap {1}\mathclap{\sim}\qquad \mathclap {1}\mathclap{\raisebox{0.1ex}{$ \sim $}}\qquad \stackinset{c}{0pt}{c}{-0.2ex}{$ \sim $}{$ 1 $} \]%
\end{document}