Here is a more light-weight approach. Two macros are defined, one for normal style, the other one for script style. In the latter case the \mathrel is dropped as it would have no effect. In the former case the \mathrel causes the thing to look a bit smallish compared to surrounding whitespace.
For the script thing, the optional parameter is the desired length before the ratio to normal size is taken into account, i.e. it should be normally the same as the one used for the normal size thing.
The \scriptveryshortarrow could use \mathrel. The sole effect (in script style for which it is destined) would be to suppress the small space separating from alarge symbol (\sum, \prod, ...) either immediately preceding or following.
The code for \scriptveryshortarrow can be simplified if one removes the two \scriptratio which scale the rule thickness and vertical shift for centering (the one scaling the width must stay).
A perhaps better choice for the thickness of the rule (rather than .4pt as above) is to use \fontdimen8 of the extension font.
I find the horizontal spacing of the chemarrows in mathematical formulas surprisingly bad. It may well be that the spacing is adjusted to the use in chemistry. If you want an arrow with (approximately) the same length and spacing as a \longrightarrow, then you can use this code:
\documentclass{article}
\usepackage{amsmath,xspace}
\usepackage{chemarrow}
\newcommand{\lra}{\ensuremath{\mathrel{%
\mkern1.5mu\textrm{\arro\symbol{71}}%
\mkern-1.1mu\textrm{\arro\symbol{65}}%
}}\xspace}
\begin{document}
Test \lra Result
Test $\longrightarrow$ Result
\end{document}
The xspace package is only needed for having \lra behave in the same way as $\lra$ (otherwise TeX wouldn't put a space after \lra). It is always a good idea to include an \xspace if you use \ensuremath in a macro that takes no arguments.
Best Answer
Here is a more light-weight approach. Two macros are defined, one for normal style, the other one for script style. In the latter case the
\mathrel
is dropped as it would have no effect. In the former case the\mathrel
causes the thing to look a bit smallish compared to surrounding whitespace.For the script thing, the optional parameter is the desired length before the ratio to normal size is taken into account, i.e. it should be normally the same as the one used for the normal size thing.
The
\mkern-4mu
was obtained by trial and error.Equivalent result is obtained via this little bit shorter code which employs
\vcenter
:The
\scriptveryshortarrow
could use\mathrel
. The sole effect (in script style for which it is destined) would be to suppress the small space separating from alarge symbol (\sum
,\prod
, ...) either immediately preceding or following.The code for
\scriptveryshortarrow
can be simplified if one removes the two\scriptratio
which scale the rule thickness and vertical shift for centering (the one scaling the width must stay).A perhaps better choice for the thickness of the rule (rather than
.4pt
as above) is to use\fontdimen8
of the extension font.