# How can I lower an \xrightarrow

I'm referring to a previous post where I asked how to handle lines that are too tall due to stacked mathematical symbols. In particular, the problem occurs in my texts when using \xrightarrow like in the following picture.

One solution mentioned was to lower the arrow produced by \xrightarrow.

I tried this using the \raisebox command but was not successfull. My solution

\newcommand{\myrightarrow}[1]{\ensuremath{\raisebox{-2pt}{$\xrightarrow{#1}$}}}


lowers the arrow correcly but completely ruins the kerning before and after the arrow, i.e., there is no space between the arrow and the preceeding and following symbols. The problem seems to be that \raisebox does not work in math mode and, hence, breaks the kerning.

Does anyone know a way around this?

A minimum working example is

\documentclass{article}
\usepackage{amsmath}
\newcommand{\myrightarrow}[1]{\ensuremath{\raisebox{-2pt}{$\xrightarrow{#1}$}}}
\begin{document}
$a\myrightarrow{b}c$ vs.\ $a\xrightarrow{b}c$
\end{document}


which produces

• Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – jubobs May 6 '13 at 11:55
• if instead of \ensuremath you use \mathrel that will treat the "adjusted" symbol as a relation, which in turn will add the proper spacing around it. you don't need \ensuremath anyway, since it's highly unlikely that you will ever use it outside of a math expression. – barbara beeton May 6 '13 at 12:01
• @barbarabeeton As this seems to settle the issue, could you please post an answer? – Stephan Lehmke May 6 '13 at 16:27

\newcommand{\myrightarrow}[1]{\ensuremath{\raisebox{-2pt}{$\xrightarrow{#1}$}}}


if instead of \ensuremath you use \mathrel, like this,

\newcommand{\myrightarrow}[1]{\mathrel{\raisebox{-2pt}{$\xrightarrow{#1}$}}}


that will treat the "adjusted" symbol as a relation, which in turn will add the proper spacing around it. you don't need \ensuremath anyway, since it's highly unlikely that you will ever use it outside of a math expression.

Rather than answering the question directly, let me give my opinion that the paragraph as you've written it is rather cramped and needs to be broken up with some displayed equations. My personal rule for this is that any math of significant length (say, likely to be broken across a line) or height or depth (anything, really, exceptions made for simple \tfracs) needs to be displayed.

\documentclass{article}
\usepackage{amsmath,amssymb,mathtools}
\newcommand*\aut{\mathcal{A}}
\newcommand*\strings{\Sigma^*}
\newcommand*\trans[1]{%
\xrightarrow{a_{#1}}%
}
\newcommand*\transu{%
\xrightarrow{u}%
}
\begin{document}
\noindent
\emph{final} states.  A \emph{run} of an NFA $\aut$ from a state $q_1 \in Q$ on some word
$u = a_1 \dots a_n \in \strings$
is a sequence $q_1$, \dots, $q_{n + 1}$ of states $q_i \in Q$ such
that $(q_i, a_i, q_{i + 1}) \in \Delta$ for $i = 1$,~\dots, $n$;
we also write
$\aut\colon q_1 \trans1 q_2 \trans2 \dots \trans{n} q_{n + 1}$
or $\aut\colon q_1 \transu q_{n + 1}$ for short.  A word $u$ is
\emph{accepted} by $\aut$ if $\aut \colon q_0 \transu q$ with $q \in F$.
The language accepted by $\aut$ is the set
$L(\aut) = \{u \in \strings \mid \aut \colon q_0 \transu q, \, q \in F\}.$
A language $L \subseteq \strings$ is called \emph{regular} if an NFA $\aut$

\end{document}


This makes your problem go away and also makes it, I think, easier on the eye of the reader to get through the nest of symbols. I want to note that the two arrows not displayed appear right underneath a display, so their raised labels are absorbed into its surrounding space. My advisor once referred to a paragraph with too few displays as "composed in haste" and I had to agree after fixing it up. (That's not to say you didn't put time into yours; I certainly hadn't put any into mine, though.)

• I've taken the liberty of reformatting your source code so that displays appear more clearly also at the "LaTeX level". You can roll back the edit, if you prefer, but I believe this style makes the source more readable. – egreg May 6 '13 at 16:35
• No, that's fine. It was written in haste :) – Ryan Reich May 6 '13 at 16:36