Overlay symbol with another
You can overlay the symbols the following way: Box the wider one and let the other one lap over it (using \rlap
or \llap
). The correct centering is achieved by placing the second character into a box with the equal width but using \hss
to center it. The correct size for the different math modes can be adjusted using \mathchoice
.
\documentclass{article}
\def\qeq{\mathrel{%
\mathchoice{\QEQ}{\QEQ}{\scriptsize\QEQ}{\tiny\QEQ}%
}}
\def\QEQ{{%
\setbox0\hbox{=}%
\rlap{\hbox to \wd0{\hss?\hss}}\box0
}}
\textwidth=2cm
\begin{document}
$ A \qeq B $
$ A = B $
\[ A \qeq B \]
\[ A = B \]
$ S_{ A \qeq B } $
$ S_{ A = B } $
$ S_{S_{ A \qeq B }} $
$ S_{S_{ A = B }} $
\end{document}
Result
You could also use the Plain macro \ooalign
:
$\mathrel{\ooalign{\hss?\hss\cr=}}$\bye
The just submitted stackengine
package is tailor made for combining glyphs. Since it was just submitted to CTAN, it will hopefully propagate this weekend.
\documentclass{article}
\usepackage{stackengine}
\usepackage{graphicx}
\parskip 1ex\parindent 0in
\begin{document}
%Arguments to inset commands{overlay image}{base image}{V-offset}{H-offset}
Relative to bottom vs. top:\\
\bottominset{*}{O}{}{}%
\topinset{*}{O}{}{}%
With V and H shifting:\\
\topinset{*}{O}{}{}%
\topinset{*}{O}{1pt}{}%
\def\stackalignment{r}%
\topinset{*}{O}{2pt}{-1pt}%
Glyphs of different scales:\\
\def\stackalignment{c}%
\def\newi{\stackon[-.4ex]{i}{\scalebox{3}{.}}}
\def\useanchorwidth{T}
Th\newi s uses width of anchor alone
\def\useanchorwidth{F}
Th\newi s uses width of complete stack
\end{document}