# center label/text over xrightarrow with scaled stackrel

I frequently use the following sort of construct within tabular, to create an ordinal left to right sequnce separated by right arrows -- I use a combination of stackrel and longrightarrow to accomplish the basic 'look':

\begin{center}
\begin{tabular}{ccccc}
\textbf{1} &
$\stackrel{\phi_{1}}{\longrightarrow}$ &
\textbf{2} & $\stackrel{\phi_{2}}{\longrightarrow}$ &
\textbf{3}
\end{tabular}
\end{center}


which generates the following:

However, for various aesthetic reasons, I'm interested in making longrightarrow, well...longer. My approach was to use xrightarrow. The trick is, I want a fixed length for xrightarrow (not dynamic length). If I try something like

\newcommand*{\barrow}{\xrightarrow{\hspace*{0.8cm}}}
\begin{center}
\begin{tabular}{ccccc}
\textbf{1} &
$\barrow$ &
\textbf{2} & $\barrow$ &
\textbf{3}
\end{tabular}
\end{center}


I get something with longer rightarrows,

If I use stackrel to put the labels over each longer arrow,

\begin{center}
\begin{tabular}{ccccc}
\textbf{1} &
$\stackrel{\phi_{1}}{\barrow}$ &
\textbf{2} & $\stackrel{\phi_{2}}{\barrow}$ &
\textbf{3}
\end{tabular}
\end{center}


seems to work fine (they're centered, which is what I want). But, the lables are too small (again, for silly aesthetic reasons).

Since the labels are invariably maths, I make them bigger using scalebox:

\begin{center}
\begin{tabular}{ccccc}
\textbf{1} &
$\stackrel{\scalebox{0.91}{$\phi_{1}$}}{\barrow}$ &
\textbf{2} & $\stackrel{\scalebox{0.91}{$\phi_{2}$}}{\barrow}$ &
\textbf{3}
\end{tabular}
\end{center}


but, the labels are no longer centered:

So, is there a way to get there from here -- longer right arrows, with centered, larger lables which are almost always in math mode?

For a variety of reasons, I'd like to stay in tabuluar (since, in fact, I have multiple rows of this particular kind of construct), but it might not be possible. Demonstrations in another 'package' welcomed (or, better -- demos of how it can be done in tabular most appreciated!)

Thanks in advance.

• \mathmakebox of a certain width combined with \xrightarrow ought to be enough to make a suitable macro. No need to stackrel – daleif Mar 16 '18 at 10:18

## 2 Answers

Since you are already using tabular for this, changing to tikz-cd is not much trouble, if it is an option:

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
\textbf{1} \arrow[rr,"\phi_1"] && \textbf{2} \arrow[rr,"\phi_2"] && \textbf{3}
\end{tikzcd}
\end{document}


Each & you add makes a new column, like with tabular, and an \arrow[rr] goes two columns to the right.

For shorter arrows you can use \arrow[r,"\phi_1"] & and for even longer arrows, \arrow[rrr,"\phi_1"] &&&.

Just add \displaystyle prior to your \phis, using the OP's 3rd block of code.

\documentclass{article}
\usepackage{amsmath}
\newcommand*{\barrow}{\xrightarrow{\kern0.8cm}}
\begin{document}
\begin{center}
\begin{tabular}{ccccc}
\textbf{1} &
$\stackrel{\displaystyle\phi_{1}}{\barrow}$ &
\textbf{2} & $\stackrel{\displaystyle\phi_{2}}{\barrow}$ &
\textbf{3}
\end{tabular}
\end{center}
\end{document}


If you would like more control in setting the vertical gap, here is an alternative that actually takes less typing, using stacks, with the syntax \barrow[<overset>]. In the MWE, I have narrowed the vertical gap.

\documentclass{article}
\usepackage{stackengine,amsmath}
\stackMath
\newcommand*{\barrowaux}{\xrightarrow{\kern0.8cm}}
\newcommand\barrow[1][]{\mathrel{\stackon[-1pt]{\barrowaux}{#1}}}
\begin{document}
\begin{center}
\begin{tabular}{ccccc}
\textbf{1} & $\barrow[\phi_{1}]$ & \textbf{2} & $\barrow[\phi_{2}]$ & \textbf{3}
\end{tabular}
\end{center}
\end{document}