0

Using chemfig I want to draw something like that enter image description here but I don't know how to make these arrows. I stuck in this place:

\documentclass[a4,10pt]{article}
\usepackage{chemmacros}
\usepackage{chemfig}
\usepackage{tikz}
\begin{document}
\chemleft[ 
\chemfig{H-[,0.6]C(-[6,0.6]H)=[,0.6]C(-[6,0.6]H)-[,0.6]O-[,0.6]H} 
\chemright]
\end{document}

1 Answer 1

1

First you need to enter the starting and ending points of the arrows (@{x}) in the molecule, then use \chemmove to define the arrows.

\documentclass[a4,10pt]{article}
\usepackage{chemmacros}
\usepackage{chemfig}
\usepackage{tikz}
\begin{document}
    \chemleft[ 
    \chemfig{H(-[2,1.3,,,,draw=none])-@{a}C(-[6]H)=[@{b}]C(-[6]H)-[@{c}]O-[@d]@{e}H} 
    \chemmove{  
    \draw[red,shorten <=2pt,shorten >=1pt](b).. controls +(90:8mm) and +(90:8mm)..(a);
    \draw[red,shorten <=1pt,shorten >=1pt](e).. controls +(90:18mm) and +(120:18mm)..(a);
    \draw[red,shorten <=1pt,shorten >=1pt](d).. controls +(-90:6mm) and +(-90:6mm)..(c);
    }
    \chemright]
\end{document}

the "invisible bond" on the first hydrogen adds a space above the molecule so that the arrows remain inside the [...]

enter image description here

6
  • It works, thank you so much, but in your code is a little mistake, you forgot about right ), after this "invisible bond" :). Could you explain me what that "controls +(90:8mm) and +(90:8mm)" mean? I don't understand what represent these numbers in brackets. My second question is can I customize length of bonds in that code? Sep 2, 2022 at 17:48
  • Thanks for the correction. (90:8mm) -- 90 is the angle (departure or arrival) of each arrow, and 8mm is the distance the arrow will travel at that angle. The chemfig usually adds more length to the arrow to fill in the distance between the start and finish lines.
    – CrocoDuck
    Sep 2, 2022 at 18:00
  • change the values of these angles and distances and see the results.
    – CrocoDuck
    Sep 2, 2022 at 18:08
  • Ok thanks I've tried change the values and I understand this now. But do you know how to customize length of bonds, when in the [ ] brackets are these arrows' starting and ending points? Sep 2, 2022 at 18:46
  • Bond length is the second number in the chemical bond options, eg C-[0,2]H a bond twice the default length. When a chemical bond has a tag, it comes before all options, eg C-[@{a}0,2]H . As the "0" direction is the default direction, it does not need to be set explicitly. So we could write C-[@{a},2] as well.The same happens with the length of the chemical bond, it may not be explicit. customize the length of links by changing the second parameter. If it is not explicit, add it.
    – CrocoDuck
    Sep 2, 2022 at 21:55

You must log in to answer this question.

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