4

I want to use chemfig for my academic work - but I have a lot of problems. I have found something as my inspiration to write this code.

\documentclass[12pt,a4paper,onecolumn]{article}
\usepackage{chemfig}
\usepackage{tikz}   

\begin{document}
\begin{tikzpicture}   
\path node(A){\chemfig{
@{H1}H-[@{HB1}:30]@{C1}C(=[@{CDB1}:90]@{O1}O)-[@{CB2}:-30]@{O2}O-[@{OBH1}:30]@{H2}H
}};
\chemmove{
\draw (HB1) node[above] {$\alpha$};
\draw (CDB1) node[right] {$\beta$};
\draw (CB2) node[above] {$\gamma$};
\draw (OBH1) node[above] {$\zeta$};
\draw (CB2) node[above] {$\gamma$};
\draw (C1) node[below] {$\theta_A$};
\draw (O2) node[above] {$\theta_b$};
}
\end{tikzpicture} 
\end{document}

But I am still far from what I would like to have.

Wishes

Molecule in GIMP.

  • Drawing the two red arrows to show where the angles are.
  • Replacing Alpha to Zeta with a to d. Problem: the letters are too big. I would like to have them tiny (didn't worked). I would like to have them in grey. And it would look nice if they could rotate - they should (if possible) have the same rotation as the bonds they show to.
  • The "thetas" are too big. I would like to have the smaller. And they are too close to the letters C and O. And it would be nice if they could have the two red arrows around to show that they are angles.
  • Using the correct angles to draw the molecule. Theta_A has an angle of 112, while Theta_B has an angle of 110. All in degrees.
  • In the GIMP figure the size is really bad. The letters (not the molecule letters) are too big (in my opinion) in proposition to the bonds. But I think if you could make the letters smaller it would look nice?

Kind regards! And thank you very much in advance!

PS! The picture frame is nothing that should be written in LaTeX. It was just to show you the molecule in a fancy way.

  • Two things: 1) It is unclear to me which angle labels go to which angles and the molecule, and also with respect to what reference those angles are measured; can you please clarify? 2) You don't need to load all of the packages that you have to have a true MWE, i.e. you can delete all of the ams packages, graphicx and inputenc and then it will be a true minimal working example :-) – darthbith Mar 9 '15 at 14:23
  • @darthbith angles are in degrees. I have uploaded the image where I have drawn some colored lines to show which number (red) belongs to which angle and which number (black) belongs to which bond. img4.fotos-hochladen.net/uploads/chemie2szf69acpvm.png – Basilius Sapientia Mar 9 '15 at 14:32
  • 2
  • @BasiliusSapientia I have uploaded the image you created to the StackExchange account, so that if your link goes down, people can still see the picture. I hope you don't mind :-) I'm also curious, the three angles around the double bond oxygen don't add up to 360 degrees, so the drawing is not possible as shown – darthbith Mar 9 '15 at 14:55
  • @darthbith you are right. Hmm. Just use the 112 and 110 angle instead and ignore the other two angles. :-) – Basilius Sapientia Mar 9 '15 at 14:59
4

With the help of Section 12.7 of the chemfig manual I was able to get something that should be close. The distance between atoms can be changed with \setatomsep, and font colors, sizes, etc. can be modified as per usual TikZ commands.

\documentclass[border=2pt]{standalone}
\usepackage{chemfig}
\usepackage{siunitx}

\newcommand\namebond[5][-1pt]{\chemmove{\path(#2)--(#3)node[midway,#4,yshift=#1,black!60]{#5};}}
\newcommand\arcbetweennodes[3]{%
\pgfmathanglebetweenpoints{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}% 
\let#3\pgfmathresult}

\newcommand\arclabel[6][red,-stealth,shorten <=1pt,shorten >=1pt]{%
\chemmove{%
\arcbetweennodes{#4}{#3}\anglestart \arcbetweennodes{#4}{#5}\angleend \draw[#1]([shift=(\anglestart:#2)]#4)arc(\anglestart:\angleend:#2); \pgfmathparse{(\anglestart+\angleend)/2}\let\anglestart\pgfmathresult \node[shift=(\anglestart:#2+1pt)#4,anchor=\anglestart+180,inner sep=0pt,
outer sep=0pt]at(#4){#6};}}

\begin{document}
\setatomsep{2cm}
\chemfig{@{hl}H-[:34]@{c}C(=[:+90]O@{ot})-[::+-56]@{ob}O-[::55]@{hr}H}
\namebond{hl}{c}{above,sloped}{$a$}
\namebond{c}{ot}{right}{$b$}
\namebond{c}{ob}{above,sloped}{$c$}
\namebond{ob}{hr}{above,sloped}{$d$}
\arclabel{0.5cm}{hl}{c}{ob}{\footnotesize \SI{112}{\degree}}
\arclabel{0.5cm}{c}{ob}{hr}{\footnotesize \SI{110}{\degree}}
\end{document}

enter image description here

  • You're welcome. I didn't pay attention to the C=O angle though, so it might be a bit off. – erik Mar 10 '15 at 22:09
  • How do you got the angle @{hl} to 34 and the angle @{ot} to +-56? – Basilius Sapientia Mar 10 '15 at 22:39
  • 1
    I used 56 because it's half of 112, and I used 34 because it's half of the remaining interior angles, i.e., (180-112)/2=34. The minus sign before 56 just indicates the direction of the relative change in angle. – erik Mar 10 '15 at 23:03
  • sorry to ask a new question, but I have problems with placing the last angle (between db O and O). I have posted the new question here: tex.stackexchange.com/questions/232515/… ... so if you have time appetite, it would be nice if you could me once more :-) – Basilius Sapientia Mar 11 '15 at 11:48
  • 1
    @BasiliusSapientia I'll try to get to it later this afternoon. – erik Mar 11 '15 at 14:03

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.