2

Instead of one line above the arrow I want to be able to write two lines over it. How can I achieve this? With this code I can only achieve one line:

\xrightarrow[]{something}
2
  • 1
    One line above the arrow is not really clear to me. Please explain your question more, and don't forget adding a code.
    – user156344
    Mar 14, 2019 at 13:46
  • I think you need to elaborate more on what you are trying to achieve. That is how us what you have so far (the code + a picture of the compiled result) and then maybe grab paint and try to illustrate the wanted behaviour with that
    – Raven
    Mar 14, 2019 at 13:46

2 Answers 2

7

Abusing a little bit the \substack macro from amsmath (whose original purpose is for multiline sub/superscripts in operators):

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\[
A \xrightarrow[\substack{def \\ \text{below}}]{\substack{abc \\ \text{above}}} B
\]
\end{document}

enter image description here

4
  • Thanks. This is exactly what I was looking for
    – Al_Fh
    Mar 14, 2019 at 13:49
  • What about two lines under the arrow?
    – Al_Fh
    Mar 14, 2019 at 13:50
  • Same thing, with the optional argument. See edit.
    – campa
    Mar 14, 2019 at 13:54
  • I see. Thank you very much.
    – Al_Fh
    Mar 14, 2019 at 13:55
2

you mean something like this:

\documentclass{article}
    \usepackage{amssymb,amsmath}
    \usepackage{stackengine}
    \newcommand\stackrightarrow[3]{%
        \mathrel{{{\stackon[4pt]{$\xrightarrow[#3]{#1}$}{$\scriptscriptstyle#2$}}}}}
    \begin{document}
        $   a \stackrightarrow{x}{y}{z} b$


\end{document}

enter image description here

Finally, welcome to TeX.SE, from next time, please add a MWE to show what you have tried so-far.

1
  • Thank you. This also worked for me.
    – Al_Fh
    Mar 14, 2019 at 14:02

You must log in to answer this question.

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