1

I would like to reduce the left side of the "U" arrow in chemfig.

\arrow{-U>[][\chemfig{ROH}][][.25]}[0,2]

enter image description here

Using the "shorten" command results in deformation.

\arrow{-U>[][\chemfig{ROH}][][.25]}[0,2,shorten <=20pt]

enter image description here

Any suggestion?

2
  • From the sketch you added to your question, it seems as if you wanted to shorten the overall width of the arrow. Would you alternatively also be interested in keeping the length of the horizontal arrow while moving the curved arrow more to the left? This would result in a more consistent output, especially if you also use other types of arrows in your document. Here is an example output of such a modified arrow in comparison to the original: i.stack.imgur.com/aeBCv.png
    – leandriis
    Aug 30, 2021 at 15:13
  • @leandriis ---- can be done this way, yes
    – CrocoDuck
    Aug 30, 2021 at 16:53

1 Answer 1

4

enter image description here

I copied the definition of the -lU> type arrow, renamed it to -lU> and altered the line marked with <--------.

\documentclass{article}
\usepackage{chemfig}

\catcode`\_=11
\definearrow5{-lU>}{%
    \CF_arrowshiftnodes{#3}%
    \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode)--(\CF_arrowendnode)node[near start](Uarrow@arctangent){};% <-------- replaced [midway] with [near start]. Alternatively, use [pos=0.25] or any other value of your choice to fine tune the arrow position.
    \CF_ifempty{#4}
        {\def\CF_Uarrowradius{0.333}}
        {\def\CF_Uarrowradius{#4}}%
    \CF_ifempty{#5}%
        {\def\CF_Uarrowabsangle{60}}
        {\pgfmathsetmacro\CF_Uarrowabsangle{abs(#5)}}% ne prendre en compte que la valeur absolue de l'angle
    \expandafter\draw\expanded{[\CF_ifempty{#1}{draw=none}{\unexpanded\expandafter{\CF_arrowcurrentstyle}},-]}(Uarrow@arctangent)%
        arc[radius=\CF_compoundsep*\CF_currentarrowlength*\CF_Uarrowradius,start angle=\CF_arrowcurrentangle-90,delta angle=-\CF_Uarrowabsangle]node(Uarrow@start){};
    \expandafter\draw\expanded{[\CF_ifempty{#2}{draw=none}{\unexpanded\expandafter{\CF_arrowcurrentstyle}}]}(Uarrow@arctangent)%
        arc[radius=\CF_compoundsep*\CF_currentarrowlength*\CF_Uarrowradius,start angle=\CF_arrowcurrentangle-90,delta angle=\CF_Uarrowabsangle]node(Uarrow@end){};
    \pgfmathsetmacro\CF_temp{\CF_Uarrowradius*cos(\CF_arrowcurrentangle)<0?"-":"+"}%
    \ifdim\CF_Uarrowradius pt>0pt
        \CF_arrowdisplaylabel{#1}{0}\CF_temp{Uarrow@start}{#2}{1}\CF_temp{Uarrow@end}%
    \else
        \CF_arrowdisplaylabel{#2}{0}\CF_temp{Uarrow@start}{#1}{1}\CF_temp{Uarrow@end}%
    \fi
}
\catcode`\_=8


\begin{document}
\schemestart
A
\arrow{-U>[][\chemfig{ROH}][][.25]}[0,2]
original
\schemestop

\schemestart
A
\arrow{-lU>[][\chemfig{ROH}][][.25]}[0,2]
modified
\schemestop
\end{document}
4
  • Work very well, thanks.
    – CrocoDuck
    Aug 30, 2021 at 18:02
  • there is a problem. when I use the new command \arrow{-lU>, chemfig has problems with superscripts and subscripts, \chemfig{H_2} results in "H_2".
    – CrocoDuck
    Aug 31, 2021 at 17:08
  • @EdsonMarcon: Sorry, I forgot to add a line which caused this unexpected behavior. I just updated my answer with the corrected code.
    – leandriis
    Aug 31, 2021 at 18:09
  • worked well. thanks again
    – CrocoDuck
    Aug 31, 2021 at 18:21

You must log in to answer this question.

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