# Lower arrow within subscript

I'm using redesigned arrows (for maps, limits, etc.) that look better to me with Lucida Bright fonts than do the defaults.

For the \tendsto command, for limits, it seems that I have to explicitly use a \raisebox{negativeAmount}{\to} in the command

 \newcommand{\tendsto}{\mathrel{\raisebox{-0.5pt}{\to}}}


But while this looks OK in normal math, the arrow is not quite low enough when it appears within a subscript.

How can I cause the amount that the \to arrow is lowered for \tendsto so to adapt to when it is within a subscript vs. when it is in ordinary math — without having to invoke a separate command in the subscript situation?

\documentclass[10pt]{article}
\usepackage[left=2in,right=0.75in]{geometry}

\usepackage{amsmath}
\usepackage[lucidasmallscale]{lucidabr}

\newcommand{\N}{\mathbb{N}}
\newcommand{\from}{\protect\colon}

\usepackage{scalerel}
\usepackage{tikz-cd}
\usetikzlibrary{arrows.meta}
\tikzcdset{every arrow/.append style = -{Stealth[scale=1]}}
\tikzcdset{arrows={line width=0.4pt}}

%% SAVE OLD DEFS
\mathchardef\oldrightarrowchar=\numexpr\rightarrow-"3000\relax
\mathchardef\oldmapstochar=\numexpr\mapsto-"3000\relax
\newcommand{\oldrightarrow}{\mathrel{\oldrightarrowchar}}
\newcommand{\oldto}{\mathrel{\oldrightarrowchar}}
\newcommand{\oldmapsto}{\mathrel{\oldmapstochar}}
\newcommand{\oldtendsto}{\mathrel{\oldrightarrowchar}}
\newcommand{\oldrightinf}{\mathord{\oldrightarrowchar}}
%% MY NEW
\newcommand{\basicrightarrow}{\mathrel{\,\tikz[baseline,line width=0.4pt]\draw[arrows=-{Stealth[scale=0.75]},yshift=0.75ex] (0,0) -- (1em,0);\,}}
\renewcommand{\rightarrow}{\scalerel*{\basicrightarrow}{\oldrightarrow}}
\renewcommand{\to}{\scalerel*{\basicrightarrow}{\oldrightarrow}}
\newcommand{\barredrightarrow}{\mathrel{\,\tikz[baseline,line width=0.425pt]\draw[arrows={Bar[line width=0.85pt,scale=1]}-{Stealth[scale=0.75]},yshift=0.75ex] (0,0) -- (1em,0);\,}}
\renewcommand{\mapsto}{\scalerel*{\barredrightarrow}{\oldrightarrow}}
%% the issue is in following command:
\newcommand{\tendsto}{\mathrel{\raisebox{-0.5pt}{\to}}}
\newcommand{\shortrightarrow}{\mathord{\tikz[baseline,line width=0.4pt]\draw[arrows=-{Stealth[scale=0.5]},yshift=0.75ex] (0,0) -- (0.65em,0);}}
\newcommand{\rightinf}{\scalerel*{\shortrightarrow}{\raisebox{-0.25ex}{$\infty$}}}

% test command for the math with arrows:
\newcommand*{\test}[4]{% params: tendsto, to, mapsto, right-infinite %
\texttt{\textbackslash#1}, \texttt{\textbackslash#2}, \texttt{\textbackslash#3}, and \texttt{\textbackslash#4}:\\[6pt]
Let $(x_n)_{n \in \N} \csname#1\endcsname x$ in~$X$ where $f \from X \csname#2\endcsname Y$ \& $x \csname#3\endcsname y$;
that is, $\lim_{n \csname#1\endcsname \infty} x_n = x$%
\begin{gather*}%
\lim_{n \csname#1\endcsname \infty} x_n = x \text{ where } f \from X \csname#2\endcsname Y \text{ and } x \csname#3\endcsname y \text{ on } [x, \csname#4\endcsname).\\%
\lim_{t \csname#1\endcsname x} f(t) = y, \text{ that is,} \quad t \tendsto x \, \implies \, f(t) \tendsto y.%
\end{gather*}
}

\begin{document}

\noindent%
\test{oldtendsto}{oldto}{oldmapsto}{oldrightinf}
\test{tendsto}{to}{mapsto}{rightinf}

\end{document}


You should use variable amounts depending on the current math style. The amount should be in ex units rather than pt, so it adapts to the current font size.

\makeatletter
\newcommand{\tendsto}{%
\mathrel{\fix@height\oldrightarrow{-0.0625ex}{-0.03ex}{-0.01ex}}%
}
\newcommand{\fix@height}[4]{%
\mathchoice
{\fix@@height{#1}\textstyle{#2}}
{\fix@@height{#1}\textstyle{#2}}
{\fix@@height{#1}\scriptstyle{#3}}
{\fix@@height{#1}\scriptscriptstyle{#4}}%
}
\newcommand{\fix@@height}[3]{\raisebox{#3}{$\m@th#2#1$}}
\makeatother


With this definition we have from

\noindent
\test{tendsto}{to}{mapsto}{rightinf}

\noindent
$x\tendsto\infty$\qquad
$\scriptstyle x\tendsto\infty$\qquad
$\scriptscriptstyle x\tendsto\infty$

\Large\noindent
\test{tendsto}{to}{mapsto}{rightinf}

\noindent
$x\tendsto\infty$\qquad
$\scriptstyle x\tendsto\infty$\qquad
$\scriptscriptstyle x\tendsto\infty$


the following output

Fine tune the amounts to suit your taste.

• I'm usure what's going on here: is this still basing my new \tendsto, as I want to do, on my new kind of arrow constructed via tikz-arrows? – murray Oct 29 '18 at 22:10
• And should I be handling the other kinds of new arrows differently than by using \scalerel*? – murray Oct 29 '18 at 22:16
• @murray I don't use scalerel, so I don't know about it. – egreg Oct 29 '18 at 22:29
• Seems to me I want your way of defining \tendstoshould use \to rather than \oldrightarrow, so that it's based on my newly-defined (via tikz-arrows) kind of arrow rather than on the original – murray Oct 30 '18 at 1:10
• @murray To be honest, I didn't really understand too much of all the juggling you make; the method for different amount raising in the various math styles is independent on the particular symbol you use. – egreg Oct 30 '18 at 10:08