5

I have a reaction scheme with three compounds. In this I'd like to use a L-shaped arrow having the possibiliy to put labels on. This kind of arrow is not provied by chemfig, so I customized my first arrow. Here it is:

\documentclass[border=5pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{chemfig}

\makeatletter
\definearrow2{|->}{%
\expandafter\draw\expandafter[shorten <=\CF@arrow@offset,shorten >=\CF@arrow@offset,\CF@arrow@current@style,-CF]
    (\CF@arrow@start@name)--(\CF@arrow@start@name |- \CF@arrow@end@name)--(\CF@arrow@end@name);
\CF@arrow@display@label{#1}{0.5}{+}{\CF@arrow@start@name |- \CF@arrow@end@name}{#2}{0.5}{-}{\CF@arrow@end@name}}
\makeatother

\begin{document}
%\schemedebug{true}
\schemestart
{\Huge A}
\arrow(.south west--.north west){0}[-20]
{\Huge B}
\arrow(.south west--.north west){0}[270,.2]
{\Huge C}
\arrow(@c1.south--@c2.west){|->[+1]}
\arrow(@c1.south--@c3.west){|->[+2]}
\schemestop
\end{document}

The coordinate (\CF@arrow@start@name |- \CF@arrow@end@name) is at the intersection of a vertical line from A and a horizontal line from B. At this point the L gets its edge.

In my first attempt I used \CF@arrow@start@node instead of \CF@arrow@start@name for the starting point (and end point as well). With this, the arrows are not aligned properly. Thus I changed it as discribed in sec. 10.2 in the chemfig manual. In this case, the arrow has to be shorten by shorten <=\CF@arrow@offset,shorten >=\CF@arrow@offset to get a gap between compound and arrow.

However, if I add the shortening to the draw command, I get the desired gap but also an error massage: Package pgf Error: Unknown arrow tip kind 'CF,'. \schemestop

Does anyone have a clue why the error message is showing up only when the shorten <=\CF@arrow@offset,shorten >=\CF@arrow@offset is included?

Working (?) example

1
  • 1
    Welcome to TeX.SX! Great question, I hope someone can answer it for you :-)
    – darthbith
    Jan 6, 2016 at 17:16

1 Answer 1

2

Your \expandafter expand the "s" of shorten... They should expand \CF@arrow@current@style:

\documentclass[border=5pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{chemfig}

\makeatletter
\definearrow2{|->}{%
\expandafter\draw\expandafter[\CF@arrow@current@style,shorten <=\CF@arrow@offset,shorten >=\CF@arrow@offset,-CF]
    (\CF@arrow@start@name)--(\CF@arrow@start@name |- \CF@arrow@end@name)--(\CF@arrow@end@name);
\CF@arrow@display@label{#1}{0.5}{+}{\CF@arrow@start@name |- \CF@arrow@end@name}{#2}{0.5}{-}{\CF@arrow@end@name}}
\makeatother

\begin{document}
%\schemedebug{true}
\schemestart
{\Huge A}
\arrow(.south west--.north west){0}[-20]
{\Huge B}
\arrow(.south west--.north west){0}[270,.2]
{\Huge C}
\arrow(@c1.south--@c2.west){|->[+1]}
\arrow(@c1.south--@c3.west){|->[+2]}
\schemestop
\end{document}
1
  • Uh ... that easy? And it is really working! Thank you very much!
    – Klusch
    Jan 6, 2016 at 17:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .