Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using \longrightarrow{} in my document. however in the PDF it appears in two pieces instead of a long line. I tried using \chemarrow but it produces very short arrow. The size of arrow thats produce by \longrightarrow{} is just right for my document. Is there a way to make it one line. Thanks

Since the topic came, is there a way to set the desired length of arrow. Here is sample code with result

\documentclass[fleqn,12pt,a4paper]{article}
\usepackage{amstext, amsmath}
\usepackage{chemarrow}
\newcommand{\lra}{\ensuremath{\longrightarrow{}}}
\let\rightarrow\chemarrow
\begin{document}
Test \lra Result 
\end{document} 

alt text

share|improve this question
    
Could you please add a minimal code example where this behavior is visible. –  Caramdir Jan 17 '11 at 5:43
    
@Caramdir - I edited my post provided a sample code with results. –  Aku Jan 17 '11 at 13:06
1  
Whatever is going on here is caused by the \let\rightarrow\chemarrow command. If you remove it there is no break in the arrow. –  Alan Munn Jan 17 '11 at 16:06
    
@Alan- I used \rightarrow{} but did not like the arrow head, I asked the group here and they told me to use \let\rightarrow\chemarrow which I did but later on I ran into this problem. –  Aku Jan 17 '11 at 18:13
add comment

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
The core of the spacing problem is that \chemarrow is not of type \mathrel. For example, replacing \let\rightarrow\chemarrow by \renewcommand\rightarrow{\mathrel{\textrm{\arro\symbol{65}}}} in Aku's original code will be enough to make the gap disappear. But for coherence's sake, \relbar (used in \longrightarrow in the form \relbar\joinrel\rightarrow) should also be changed into chemarrow's equivalent, which gives a code not very different from yours (\joinrel is just \mathrel{\mkern-3mu}). –  Philippe Goutet Jan 18 '11 at 22:05
    
@Philippe: Well, the main problem is that \relbar essentially is a -, and this contains some white space in the left (and in the right) of its bounding box. Chemarrow's equivalent has to be based on \textrm{\arro\symbol{71}}, and this doesn't contain the white space in the left; thus you get different spacing. Does it make sense what I wrote? –  Hendrik Vogt Jan 19 '11 at 18:01
    
it does ;) I had understood that the reason of the \mkern1.5mu at the beginning of your code was the absence of a right sidebearing for \textrm{\arro\symbol{71}}; this also means that \joinrel introduces a bit too much negative spacing would you try to use it as it with a chemarrow. My point was more to explain why Aku's code resulted in an arrow in two pieces and how one could adapt the definition of \longrightarrow to avoid this. But as I said at the end of my comment, doing that would not result in something simpler than your solution. –  Philippe Goutet Jan 19 '11 at 22:12
    
@Philippe: Thanks. Your explanation as to where the gap came from was also helpful for me. –  Hendrik Vogt Jan 20 '11 at 6:59
add comment

You can use

$\rarrowfill{0.8cm}$  

from the chemarrow package, which will produce an arrow with a given length. 0.8 cm is roughly the length of the broken arrow in the minimal example.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.