I use stackrel to define a custom stacked relation symbol:


However, the question mark is not centered properly and has too much distance from the \Mapsfrom. Is there a way to fine-adjust the vertical and horizontal spacing of \stackrel?

2 Answers 2


For the vertical spacing you can use \raisebox{<amount>}{<content>} to raise or lower (negative amount) the content. The horizontal centering was already shown for the similar question Overlay symbol with another, which might need a little adjustment here:

Here my suggestion. It works in the shown tests in all the different math modes.



    \rlap{\hbox to \wd0{\hss\hss\hss\raisebox{-.15\height}{?}\hss}}\box0


$ A \qMapsfrom B $

$ A \Mapsfrom B $

\[ A \qMapsfrom B \]
\[ A \Mapsfrom B \]

$ S_{ A \qMapsfrom B } $

$ S_{ A \Mapsfrom B } $

$ S_{S_{ A \qMapsfrom B }} $

$ S_{S_{ A \Mapsfrom B }} $



I just remembered that amsmaths \text can be used for math style depending scaling. It already uses similar code as the one above. This simplifies the macro to:

    \rlap{\hbox to \wd0{\hss\hss\hss\raisebox{-.15\height}{?}\hss}}\box0



There's a neater way, which avoids many of Martin's boxes


The code is actually inspired by Martin's, but seems to be clearer and more easily adaptable to other fonts (some trial and error is necessary for positioning correctly the question mark).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .