# Overlay symbol with another

Is it possible to overlay a symbol with another?

I want to write an equal sign with a question mark overlayed (or the other way around).

Note I don't want

\stackrel{?}{=}


I want the question mark to be right on top, to cross over the equal sign (which creates kind of a new sign).

Is this possible? How? Or is there a one character sign for this?

-
 Can you try this? \DeclareMathOperator{\maybe}{\stackrel{?}{=}} – Chuang Mar 7 '11 at 20:17 There must be a better way, but \DeclareMathOperator{\overlay}{?\hspace{-9pt}=} seems to work. With this version you'll have to adjust the spacing depending on the size of the font and the characters being overlaid. – John Palmieri Mar 7 '11 at 20:39 @masterxilo: Thanks for accepting my answer. However in the meantime better answers appeared and one of it should be accepted to indicate the preferred solution to other users with the same issue. – Martin Scharrer♦ Jul 19 '11 at 10:25

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

-
For centering there's \mathclap if you're willing to load mathtools. – Hendrik Vogt Mar 7 '11 at 21:10
Thanks @Hendrik, mathtools seems to be the way to go. I didn't know it before. As an engineer I'm not doing this much math with LaTeX... – Martin Scharrer Mar 7 '11 at 21:12
Thanks a lot for this, exactly what I was looking for! However, this seems pretty complex for something I'd expect LaTeX to have built-in support for. Doesn't anyone ever use this sign? I use it all the time to start proofs... – masterxilo Mar 7 '11 at 22:28
@masterxilo: I've never seen it before. I don't believe it's a common symbol in math or computer science. Maybe it is unique to your field. – TH. Mar 10 '11 at 9:04

You could also use the Plain macro \ooalign:

\mathrel{\ooalign{\hss?\hss\cr=}}\bye

-
(Plain) TeX never ceases to amaze me. – Andrey Vihrov Mar 8 '11 at 8:02
And while morbusg gave a plain TeX MWE, the code between the \$ works perfectly in LaTeX. – Hendrik Vogt Mar 8 '11 at 8:07
See the answer by egreg to similar question why you'd want to use '\hidewidth' instead of '\hss': tex.stackexchange.com/questions/22371/… – morbusg Jul 19 '11 at 13:42