# How to typeset the limit of a sequence like so?

I want to write this:

I tried with $x_n \to_{n \to 0} 0$ but the $n \to 0$ doesn't go under the right arrow, it goes under but on the right, and I want it under but in the center, as in the picture above.

-
You should check out Custom-length arrows, text over and under (possible duplicate). –  Werner Sep 16 '13 at 18:17
Ingo suggested as a comment to my answer that you should change the title of your question, to make it clearer for the search engines, since it seems the content of the answers is focused on extensible subscripted arrows, rather than sequences. I'll leave that for you to decide. –  Steven B. Segletes Sep 20 '13 at 11:02

You can also use the function \xrightarrow:

$x_n \xrightarrow[n \to 0]{} 0$


The user's guide of the amsmath package says :

\xleftarrow and \xrightarrow produce arrows that extend automatically to accommodate unusually wide subscripts or superscripts. These commands take one optional argument (the subscript) and one mandatory argument (the superscript, possibly empty)"

-
Is there a way to obtain a shorter arrow? I think that one is too long –  SuperTroll Sep 16 '13 at 18:58
@SuperTroll I know it has to be written but, "in my code my arrow is shorter"... –  Andrea L. Sep 16 '13 at 19:03
@AndreaL. I know, I'm just trying to find out if there's a way to make the arrow shorter with this shorter code. –  SuperTroll Sep 16 '13 at 19:06
@SuperTroll IMHO, this is the right length –  karlkoeller Sep 16 '13 at 19:09
@SuperTroll I agree with karlkoeller's opinion about the length of the arrow, but of you want to reduce it a bit, you could say something like $x_n \xrightarrow[{\makebox[12pt][c]{$\scriptstyle n \to 0$}}]{} 0$. –  Gonzalo Medina Sep 17 '13 at 2:15

You can use the function of \underset and \overset, in this case an arrow is simply defined with:

\underset{n\to 0}{\longrightarrow}


Which points the expression related to "n" under the second argument, here there are two versions depending on the size of the underset (using \scriptscriptstyle):

\documentclass{article}
%
\usepackage{amsmath}
%
\begin{document}
%
$X_n\underset{n\to 0}{\longrightarrow}0 \qquad% X_n\underset{\scriptscriptstyle{n\to 0}}{\longrightarrow}0$
%
\end{document}


Which yields:

-

If you wanted to change the depth of the underset below the arrow (for example, to 1 pt), then this could be done:

\documentclass{article}
\usepackage{stackengine}
\stackMath
\begin{document}
$$X_n \mathrel{\stackunder[1pt]{\longrightarrow}{\scriptscriptstyle n \rightarrow 0}} 0$$
\end{document}


Alternately, one could use something of Heiko's approach using \xrightarrow, but achieving a more snug fit like Fran's result, with the following:

\documentclass{article}
\usepackage{amsmath}
\usepackage{stackengine}
\stackMath
\begin{document}
$x_n \mathrel{\stackunder[-7.5pt]{\xrightarrow[% \scriptscriptstyle\phantom{n \to 0}]{}}{\scriptscriptstyle n \to 0\,}} 0$
\end{document}


Finally, one could create the long arrow manually, and stack the underset below it:

\documentclass{article}
\usepackage{stackengine}
\stackMath
\begin{document}
$$X_n \mathrel{\stackunder[-1pt]{-\mkern-5mu-\mkern-10mu\longrightarrow}{% \scriptscriptstyle n \rightarrow 0}} 0$$
\end{document}


The one thing all three solutions have in common is they use stackengine to underset the subscript, which gives flexibility on the vertical location of the underset.

[Thanks to Qrrbrbirlbel for reminding me I forgot the \mathrel]

-
The spacing around the \longrightarrow is wrong, see the amsmath solutions. –  Qrrbrbirlbel Sep 16 '13 at 18:28
Or also $X_{n}\;_{\mathrel{\stackunder[-5.5pt]{\overrightarrow{\phantom{HHs}}}{_{n\to0}‌​}}}\;0$ that is almost identical to $x_n \xrightarrow[n \to 0]{} 0$ –  Fran Sep 17 '13 at 19:48
@Fran, yes, but the whole reason I stuck to the stack approach is to show how it can be made slightly different in appearance, if the nominal vertical spacing is found undesirable. To make it mimic the \xrightarrow formulation is just wasting extra keystrokes. –  Steven B. Segletes Sep 17 '13 at 20:35
@StevenB.Segletes, I understood perfectly that the advantage of your method is the flexibility of adjusting vertical space. Just wanted to apply to my example, but I did not seem right include this as part of my answer. Setting \stackunder to mimic \xrightarrow spacing (too much for my taste) was just to obtain the reference of -5.5pt, so anyone can imagine how close/far must be the setting of this value to fit their preferences. –  Fran Sep 17 '13 at 22:37
@Fran I see. I'm sorry for not having understood. I see your point now. But by all means, feel free to demonstrate the package in your answers, so that I'm not the only one touting it 8~( .. –  Steven B. Segletes Sep 17 '13 at 23:43

Here's a plain version:

$$X_n \mathrel{\mathop{\kern0pt\longrightarrow}\limits_{n\to0}} 0$$ \bye


which could be shortened like \buildrel with \def\relop#1#2{\mathrel{\mathop{\kern0pt #1}\limits_{#2}}} to be X_n \relop\longrightarrow{n\to0} 0.

-

$X_{n\overrightarrow{_{\;\;n\to0\;\;\;}}}0$


This is not as elegant as \xrightarrow, but like this command (and unlike \undersetmethod) the long arrow could longer (required for some wider than n \to 0). The difference with \xrightarrow is that (a) do not need the amsmath package, (b) long arrow could be also as shorter as the text under it, (c) a smaller arrowhead (d) produce a more compact formula. Bug or feature, depending of what you want. But in case of be regarded as a bug, the horizontal spacing can be solved adding some more spaces. The vertical spacing cab be solved following the Steven's answer. In this MWE the second formula have exactly the same horizontal spacing that using \xarrow.

\documentclass{article}
\begin{document}
$X_{n\overrightarrow{_{\;\;n\to0\;\;\;}}}0$

$X_{n\;\,\overrightarrow{_{\;n\to0\;\;\,}}}\;0$
\end{document}

-