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


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.

    \rlap{\hbox to \wd0{\hss?\hss}}\box0


$ 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 }} $




  • 4
    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
  • It didn't work for math mode symbols: tried with \cdot and \Diamond and got a missing $ error. – 6005 Jul 1 '18 at 6:30

You could also use the Plain macro \ooalign:

  • (Plain) TeX never ceases to amaze me. – Andrey Vihrov Mar 8 '11 at 8:02
  • 2
    And while morbusg gave a plain TeX MWE, the code between the $ works perfectly in LaTeX. – Hendrik Vogt Mar 8 '11 at 8:07
  • 1
    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

The just submitted stackengine package is tailor made for combining glyphs. Since it was just submitted to CTAN, it will hopefully propagate this weekend.

\parskip 1ex\parindent 0in
%Arguments to inset commands{overlay image}{base image}{V-offset}{H-offset}
Relative to bottom vs. top:\\

With V and H shifting:\\

Glyphs of different scales:\\
Th\newi s uses width of anchor alone

Th\newi s uses width of complete stack

enter image description here

  • Later revisions of stackengine deprecate \topinset and \bottominset, and replace them both with \stackinset. It gives more alignment options and has a syntax more suited for nesting. – Steven B. Segletes Feb 4 '14 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.