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.
\documentclass[12pt]{article}
\usepackage[version=3]{mhchem}
\begin{document}
   \ce{CH2OH + ATP <=>>[\text{Hexokinase}] + \text{glucose 6-phosphate} + ADP + H+} \\
   \ce{CH2OH + ATP <=>> + \text{glucose 6-phosphate} + ADP + H+}
\end{document}

See the resulting Latex output, and compare. In [1] the difference between the two arrows of the unequal equilibrium sign becomes less perceptible because the sign has been stretched by the text. Compare to the same sign without the text [2]. I want the the differences between the upper and lower arrows to be exacerbated a bit more. How can I achieve this in LaTEX?

share|improve this question

3 Answers 3

Another answer because I misunderstood your question. Digging around in the source code there are several macros which effect the length of the arrows.

From mhchem.sty we have

\newcommand*\mhchem@xlongrightshortleftharpoons[2][]{\mathrel{%
  \sbox{\mhchem@arrows@box}%
    {$\mkern9mu\ext@arrow 3399\mhchem@leftharpoondownfill@%
     {#1}{\hphantom{#2}\mkern-6mu\mkern-12mu}$}%
  \rlap{\protect\raisebox{-.22ex}{\usebox{\mhchem@arrows@box}}}%     
  \protect\raisebox{.22ex}{$\ext@arrow 3399\mhchem@rightharpoonupfill@%
    {\hphantom{\usebox{\mhchem@arrows@box}}\mkern-6mu}{#2}$}%
  }}

It's basically a front end to amsmath's \ext@arrow macro:

\def\ext@arrow#1#2#3#4#5#6#7{%
  \mathrel{\mathop{%
    \setbox\z@\hbox{#5\displaystyle}%
    \setbox\tw@\vbox{\m@th
      \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}%
      \hbox{$\scriptstyle\mkern#3mu{#7}\mkern#4mu$}%
      \copy\z@
    }%
    \hbox to\wd\tw@{\unhbox\z@}}%
  \limits
    \@ifnotempty{#7}{^{\if0#1\else\mkern#1mu\fi
                       #7\if0#2\else\mkern#2mu\fi}}%
    \@ifnotempty{#6}{_{\if0#1\else\mkern#1mu\fi
                       #6\if0#2\else\mkern#2mu\fi}}}%
}

So playing around with the arguments to \ext@arrow in lines 3-4 will affect the length of the lower arrow. I could not grok the \ext@arrow code enough to figure out how.

Instead I tried the option of drawing arrows with pgf. You have to put

\usepackage{tikz}
\mhchemoptions{arrows=pgf}

in the preamble. Then the relevant macro is:

\newcommand*\mhchem@longrightshortleftharpoons@pgf[1]{%
  \begin{tikzpicture}[baseline]%
    \draw[use as bounding box] (0,0) (#1,1ex);
    \draw[cap=round, join=round, line width=0.09ex]
        (0.0cm,0.575ex+0.22ex) -- ++(#1,0cm) arc (250:198:0.9ex);  
    \draw[cap=round, join=round, line width=0.09ex]
        (#1+0.5em-1em,0.575ex-0.22ex) -- (0.5em,0.575ex-0.22ex) arc (70:18:0.9ex);
  \end{tikzpicture}%
}% 

From this you can see that the bottom arrow is 1em shorter than the top one. To make it even shorter, change the last line to something like:

(#1-0.75em,0.575ex-0.22ex) -- (0.75em,0.575ex-0.22ex) arc (70:18:0.9ex);

This will make the bottom arrow 1.5em shorter.

To make this configurable, define a key and invoke it. Here's the complete example:

\documentclass[12pt]{minimal}
\usepackage[version=3]{mhchem}
\usepackage{tikz}
\mhchemoptions{arrows=pgf}

\makeatletter
\newlength{\mhchem@shortarrow@reduction}
\define@key{mhchem}{shortarrowreduction}{\setlength{\mhchem@shortarrow@reduction}{#1}}
\renewcommand*\mhchem@longrightshortleftharpoons@pgf[1]{%
  \begin{tikzpicture}[baseline]%
    \draw[use as bounding box] (0,0) (#1,1ex);
    \draw[cap=round, join=round, line width=0.09ex]
        (0.0cm,0.575ex+0.22ex) -- ++(#1,0cm) arc (250:198:0.9ex);  
    \draw[cap=round, join=round, line width=0.09ex]
       % was: (#1+0.5em-1em,0.575ex-0.22ex) -- (0.5em,0.575ex-0.22ex) arc (70:18:0.9ex);
        (#1-\the\mhchem@shortarrow@reduction,0.575ex-0.22ex) 
        -- (\the\mhchem@shortarrow@reduction,0.575ex-0.22ex) arc (70:18:0.9ex);
  \end{tikzpicture}%
}
\AtBeginDocument{\mhchemoptions{shortarrowreduction=0.5em}}
\makeatother


\begin{document}

\noindent%
   \ce{CH2OH + ATP <=>>[\text{Hexokinase}] + \text{glucose 6-phosphate} + ADP + H+} \\
   {\mhchemoptions{shortarrowreduction=2em}
   \ce{CH2OH + ATP <=>>[\text{Hexokinase}] + \text{glucose 6-phosphate} + ADP + H+}} \\
\end{document}

sample code output

share|improve this answer
1  
Go TikZ! (and some more to get to 15 characters) –  Loop Space Apr 28 '11 at 13:37
    
Thank you - very good sir. For a novice like me though, that is a touch daunting being somewhat of a hacky - though clever - way of going about it... Isn't there an easier, officially supported way? Perhaps some package supports it? –  ptrcao May 1 '11 at 12:25
    
Perhaps you should ask the packages author, or read te source code. There didn't appear to be an elegant solution to me. –  Matthew Leingang May 1 '11 at 16:09

A good trick is the \phantom command which typesets things invisibly:

\documentclass[12pt]{article}
\usepackage[version=3]{mhchem}
\begin{document}
   \ce{CH2OH + ATP <=>>[\text{Hexokinase}] + \text{glucose 6-phosphate} + ADP + H+} \\
   \ce{CH2OH + ATP <=>>[\phantom{\text{Hexokinase}}] + \text{glucose 6-phosphate} + ADP + H+}
\end{document}

enter image description here

share|improve this answer
    
TY, that was insightful Matthew. However my question was a little different; my apologies for not being clearer. What I meant to ask was how do I make the lower arrow in the equilibrium sign much smaller, to emphasise the lopsidedness of the equilibrium? –  ptrcao Apr 27 '11 at 7:01

Here is a solution using (my own) chemmacros. It provides the option arrow-ratio=<num> where <num> should be a value between 0 and 1:

\documentclass{article}
\usepackage{chemmacros}

\begin{document}

\ch{CH2OH + ATP <=>>[Hexokinase] "glucose~6-phosphate" + ADP + H+}

\ch[arrow-ratio=.2]{CH2OH + ATP <=>>[Hexokinase] "glucose~6-phosphate" + ADP + H+}

\end{document}

enter image description here

Note: the quotation marks around "glucose~6-phosphate" prevent it from being treated as a formula.

share|improve this answer

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.