Tell me more ×
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 have been using chemfig for a while and I like it very much. But some small things I still can't do. Check this example:

\schemestart
\chemname{\chemfig{[2]OH-[4]CH_2-CH(-[0]OH)-CH_2(-[0]OH)}}{Glycerol} 
\hspace{.3cm}
\arrow{-U>[\footnotesize ATP][\footnotesize ADP + H$^{+}$][][0.6][45]}
\hspace{.7cm}
\chemname{\chemfig{[2]O(-[0]\circleatom{P})-[4]CH_2-CH(-[0]OH)-CH_2(-[0]OH)}}{Glycerol 3-phosphate} 
\schemestop

I would like to write the enzyme's name (glycerol kinase) below the U-shaped arrow. Is there an easy way to do that?

share|improve this question
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. In particular, indicate what packages you're using for typesetting the chemical formulas. – egreg Sep 30 '12 at 15:50
I think a MWE here would be something like \documentclass{article} \usepackage{chemfig} \begin{document} \schemestart A \arrow{-U>[X][Y]} B \schemestop \end{document}, where without the U the Y text would appear under the arrow. – Joseph Wright Sep 30 '12 at 16:14

1 Answer

up vote 4 down vote accepted

I'm guessing the \circleatom is a copy of what I used here. I vaguely remembered having defined something like it before.

The middle of an -U> arrow is a node named Uarrow@arctangent. If you have only one such arrow you can use that fact to write something beneath it with \chemmove:

\documentclass{article}
\usepackage{chemfig}
\newcommand*\circleatom[1]{\tikz\node[circle,draw]{\printatom{#1}};}

\begin{document}

\setarrowoffset{1cm}
\schemestart
 \chemname{\chemfig{[2]OH-[4]CH_2-CH(-[0]OH)-CH_2(-[0]OH)}}{Glycerol} 
 \arrow{-U>[\footnotesize ATP][\footnotesize ADP + H$^{+}$][][.25]}[,3]
 \chemname{\chemfig{[2]O(-[0]\circleatom{P})-[4]CH_2-CH(-[0]OH)-CH_2(-[0]OH)}}{Glycerol 3-phosphate} 
\schemestop
\makeatletter
  \chemmove{\node[below] at (Uarrow@arctangent) {below}; }
\makeatother

\end{document}

enter image description here

If you need that more often you should consider usings chemfig's possibility to add new arrow types. You could for example adapt the definition of the -U> arrow to define a variant that takes a third argument:

\makeatletter
\definearrow6{-y>}{%
    \CF@arrow@shift@nodes{#4}%
    \expandafter\draw\expandafter[\CF@arrow@current@style,-CF@full](\CF@arrow@start@node)--(\CF@arrow@end@node)node[midway](yarrow@arctangent){};%
    \edef\CF@tmp@str{\ifx\@empty#1\@empty[draw=none]\fi}%
    \expandafter\draw\CF@tmp@str (yarrow@arctangent)%
        arc[radius=\CF@compound@sep*\CF@current@arrow@length*\ifx\@empty#5\@empty0.333\else#5\fi,start angle=\CF@arrow@current@angle-90,%
        delta angle=-\ifx\@empty#6\@empty60\else#6\fi]node(yarrow@start){};
    \edef\CF@tmp@str{[\ifx\@empty#2\@empty draw=none,\fi-CF@full]}%
    \expandafter\draw\CF@tmp@str (yarrow@arctangent)%
        arc[radius=\CF@compound@sep*\CF@current@arrow@length*\ifx\@empty#5\@empty0.333\else#5\fi,start angle=\CF@arrow@current@angle-90,%
        delta angle=\ifx\@empty#6\@empty60\else#6\fi]node(yarrow@end){};
    \edef\CF@tmp@str{\if\string-\expandafter\@car\detokenize{#4.}\@nil-\else+\fi}%
    \CF@arrow@display@label{#1}{0}\CF@tmp@str{yarrow@start}{#2}{1}\CF@tmp@str{yarrow@end}%
    \CF@arrow@display@label{#3}{0.5}-\CF@arrow@start@node{}{}{}\CF@arrow@end@node
}
\makeatother

It can now be used as follows:

\schemestart
 A
 \arrow{-y>[a][b][below]}
 B
\schemestop

enter image description here

It has three further optional arguments which are the same as the ones of -U>.

The complete code:

\documentclass{article}
\usepackage{chemfig}
\newcommand*\circleatom[1]{\tikz\node[circle,draw]{\printatom{#1}};}

\makeatletter
\definearrow6{-y>}{%
    \CF@arrow@shift@nodes{#4}%
    \expandafter\draw\expandafter[\CF@arrow@current@style,-CF@full](\CF@arrow@start@node)--(\CF@arrow@end@node)node[midway](yarrow@arctangent){};%
    \edef\CF@tmp@str{\ifx\@empty#1\@empty[draw=none]\fi}%
    \expandafter\draw\CF@tmp@str (yarrow@arctangent)%
        arc[radius=\CF@compound@sep*\CF@current@arrow@length*\ifx\@empty#5\@empty0.333\else#5\fi,start angle=\CF@arrow@current@angle-90,%
        delta angle=-\ifx\@empty#6\@empty60\else#6\fi]node(yarrow@start){};
    \edef\CF@tmp@str{[\ifx\@empty#2\@empty draw=none,\fi-CF@full]}%
    \expandafter\draw\CF@tmp@str (yarrow@arctangent)%
        arc[radius=\CF@compound@sep*\CF@current@arrow@length*\ifx\@empty#5\@empty0.333\else#5\fi,start angle=\CF@arrow@current@angle-90,%
        delta angle=\ifx\@empty#6\@empty60\else#6\fi]node(yarrow@end){};
    \edef\CF@tmp@str{\if\string-\expandafter\@car\detokenize{#4.}\@nil-\else+\fi}%
    \CF@arrow@display@label{#1}{0}\CF@tmp@str{yarrow@start}{#2}{1}\CF@tmp@str{yarrow@end}%
    \CF@arrow@display@label{#3}{0.5}-\CF@arrow@start@node{}{}{}\CF@arrow@end@node
}
\makeatother

\begin{document}

\setarrowoffset{1cm}
\schemestart
 \chemname{\chemfig{[2]OH-[4]CH_2-CH(-[0]OH)-CH_2(-[0]OH)}}{Glycerol} 
 \arrow{-y>[\footnotesize ATP][\footnotesize ADP + H$^{+}$][below][][.25]}[,3]
 \chemname{\chemfig{[2]O(-[0]\circleatom{P})-[4]CH_2-CH(-[0]OH)-CH_2(-[0]OH)}}{Glycerol 3-phosphate} 
\schemestop

\end{document}
share|improve this answer
Hey cgnieder, ideed, I have "borrowed" your \circleatom and I appreciate very much your effort maintaining all these packages. Thank you for the answer! – bispo Sep 30 '12 at 22:17
@bispo you're welcome! BTW: I don't maintain chemfig (nor could I). All credits go to Christian Tellechea (@unbonpetit). – cgnieder Sep 30 '12 at 22:21

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.