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.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI 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 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)"
$x_n \xrightarrow[{\makebox[12pt][c]{$\scriptstyle n \to 0$}}]{} 0$
.
Sep 17, 2013 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:
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
.
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
]
\longrightarrow
is wrong, see the amsmath
solutions.
Sep 16, 2013 at 18:28
$X_{n}\;_{\mathrel{\stackunder[-5.5pt]{\overrightarrow{\phantom{HHs}}}{_{n\to0}}}}\;0$
that is almost identical to $ x_n \xrightarrow[n \to 0]{} 0$
\xrightarrow
formulation is just wasting extra keystrokes.
Sep 17, 2013 at 20:35
\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.
$X_{n\overrightarrow{_{\;\;n\to0\;\;\;}}}0$
This is not as elegant as \xrightarrow
, but like this command (and unlike \underset
method) 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}