1

I'd like to draw something like this:

The most versatile solution would be something analogous to the -X> type arrow defined in "Easy way to write below arrow (\arrow{-U>}) in chemfig?", which gives an error. Another definition I've tried is the one in "Position label of curved arrow in chemfig?" but it lacks the tip on the curved arrow.

2

If you would like to use the solution from "Easy way to write below arrow (\arrow{-U>}) in chemfig?", you can change -CF@full to -CF in the definition. That works for me.


I have here an adaptation (really trivial) if you would like to use my solution from "Position label of curved arrow in chemfig?". I point it out in the code using an arrow in comments.

\makeatletter
\definearrow5{-u>}{%
    \CF@arrow@shift@nodes{#3}%
    \expandafter\draw\expandafter[\CF@arrow@current@style](\CF@arrow@start@node)--(\CF@arrow@end@node)node[midway](uarrow@arctangent){};%
    \CF@ifempty{#4}
    {\def\CF@uarrow@radius{0.333}}
    {\def\CF@uarrow@radius{#4}}%
    \CF@ifempty{#5}%
    {\def\CF@uarrow@absangle{60}}
    {\pgfmathsetmacro\CF@uarrow@absangle{abs(#5)}}
    %
    \edef\CF@tmp@str{[\CF@ifempty{#1}{draw=none}{\unexpanded\expandafter{\CF@arrow@current@style}},-]}%
    \expandafter\draw\CF@tmp@str (uarrow@arctangent)%
    arc[radius=\CF@compound@sep*\CF@current@arrow@length*\CF@uarrow@radius,start angle=\CF@arrow@current@angle+90,delta angle=\CF@uarrow@absangle]node(uarrow@start){};
    %
    \edef\CF@tmp@str{[\CF@ifempty{#2}{draw=none}{\unexpanded\expandafter{\CF@arrow@current@style}},-CF]}% <---------- `-CF` instead of `-`
    \expandafter\draw\CF@tmp@str (uarrow@arctangent)%
    arc[radius=\CF@compound@sep*\CF@current@arrow@length*\CF@uarrow@radius,%
    start angle=\CF@arrow@current@angle+90,%
    delta angle=-\CF@uarrow@absangle]%
    node(uarrow@end){};
    \pgfmathsetmacro\CF@tmp@str{\CF@uarrow@radius*cos(\CF@arrow@current@angle)<0?"+":"-"}%
    \ifdim\CF@uarrow@radius pt>\z@
    \CF@arrow@display@label{#1}{0}\CF@tmp@str{uarrow@start}{#2}{1}\CF@tmp@str{uarrow@end}%
    \else
    \CF@arrow@display@label{#2}{0}\CF@tmp@str{uarrow@start}{#1}{1}\CF@tmp@str{uarrow@end}%
    \fi
}
\makeatother

A demonstration:

arr

Full Code:

\documentclass{article}
\usepackage{chemfig}

\makeatletter
\definearrow5{-u>}{%
    \CF@arrow@shift@nodes{#3}%
    \expandafter\draw\expandafter[\CF@arrow@current@style](\CF@arrow@start@node)--(\CF@arrow@end@node)node[midway](uarrow@arctangent){};%
    \CF@ifempty{#4}
    {\def\CF@uarrow@radius{0.333}}
    {\def\CF@uarrow@radius{#4}}%
    \CF@ifempty{#5}%
    {\def\CF@uarrow@absangle{60}}
    {\pgfmathsetmacro\CF@uarrow@absangle{abs(#5)}}
    %
    \edef\CF@tmp@str{[\CF@ifempty{#1}{draw=none}{\unexpanded\expandafter{\CF@arrow@current@style}},-]}%
    \expandafter\draw\CF@tmp@str (uarrow@arctangent)%
    arc[radius=\CF@compound@sep*\CF@current@arrow@length*\CF@uarrow@radius,start angle=\CF@arrow@current@angle+90,delta angle=\CF@uarrow@absangle]node(uarrow@start){};
    %
    \edef\CF@tmp@str{[\CF@ifempty{#2}{draw=none}{\unexpanded\expandafter{\CF@arrow@current@style}},-CF]}%
    \expandafter\draw\CF@tmp@str (uarrow@arctangent)%
    arc[radius=\CF@compound@sep*\CF@current@arrow@length*\CF@uarrow@radius,%
    start angle=\CF@arrow@current@angle+90,%
    delta angle=-\CF@uarrow@absangle]%
    node(uarrow@end){};
    \pgfmathsetmacro\CF@tmp@str{\CF@uarrow@radius*cos(\CF@arrow@current@angle)<0?"+":"-"}%
    \ifdim\CF@uarrow@radius pt>\z@
    \CF@arrow@display@label{#1}{0}\CF@tmp@str{uarrow@start}{#2}{1}\CF@tmp@str{uarrow@end}%
    \else
    \CF@arrow@display@label{#2}{0}\CF@tmp@str{uarrow@start}{#1}{1}\CF@tmp@str{uarrow@end}%
    \fi
}
\makeatother

\begin{document}
    \begin{center}
%       \schemedebug{true} % Activate if you want to see the nodes etc.
        \schemestart
        \arrow{-u>[$x$][$y$][][.5][]}
        \schemestop
    \end{center}
\end{document}
| improve this answer | |
  • There's still an issue with the -X> type arrow in that it doesn't inherit the default arrows settings: I use\setarrowdefault{,,line width=0.06642em} (from here). Can you please point me out to the cause of such behaviour? Your solution, on the other hand, works flawlessly. – Arch Stanton May 31 '17 at 14:17
  • 1
    I haven't got the time now to write a thorough answer, but focus on the \edef's in the -X> arrow's definitions. The OP did not load the \CF@arrow@current@style after the \ifempty...\fi statement. So the resultant arrows will not know of any changes to the default arrow style. – Troy May 31 '17 at 14:37
  • @ArchStanton I would recommend sticking to the code 'style' from the chemfig documentation though, so all the bases are covered (e.g. otherwise arrow styles not inherited, like you said). I might attempt to post an updated solution for -X> in the first link sometime in the future. It'll just be an extension of my above code to take 3 more arguments. – Troy May 31 '17 at 14:48
  • @ArchStanton I've made an update to -X> (the version with 9 (!!) arguments) to accept arrow default settings, as promised. Here: tex.stackexchange.com/a/372947/117534 – Troy Jun 2 '17 at 17:48
  • This works wonderfully when I try it on Overleaf, but for whatever reason does not work on my own computer (TeXLive 2019). Do you know what could be wrong ? – johnymm Sep 8 '19 at 4:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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