[Tex/LaTex] How to selectively change bond length in chemfig

chemfig

Hi I am trying to create a triacylglycerol molecule with the chemfig package.. I am pretty close. The backbone has three side chains and double bond off the C atom is running into the previous side chain. Ideally if the double bond is shorter or the single bond separating the backbone molecules is longer, this problem would be fixed. I have not been able to work out how to selectively change the bond length so it doesn't affect the other bond lengths.

Help would be very much appreciated.

Thanks.

%try number 1:

\setatomsep{50pt}\chemfig{CH([:45]-[0]O-[1]C(=[::+45]O)-[7]R_2)([:90]-CH_2 -[0]O-[1]C(=[::+45]O)-[7]R_1)([:-90]-CH_2 -[0]O-[1]C(=[::+45]O)-[7]R_3)}

% try number 2:

\definesubmol{x}{\setatomsep{2em}-[1]C(=[::+45]O)-[7]R_2}
\definesubmol{y}{\setatomsep{2em}-[1]C(=[::+45]O)-[7]R_1}
\definesubmol{z}{\setatomsep{2em}-[1]C(=[::+45]O)-[7]R_3}
\chemfig{CH([:45]-[0]O!x)([:90]-CH_2-[0]O!y)([:-90]-CH_2-[0]O!z)}

Best Answer

Chemfig's bonds have an optional argument that takes several parameters one of them being a factor to scale the bond length:

<bond>[<angle spec>,<length factor>,<other parameters>]

So you can just add that option to the bonds you want shorter:

\documentclass[a4paper,11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{chemfig}

\begin{document}

\setatomsep{50pt}
\chemfig{
  CH
   (-O-[:30]C(=[:90,.7]O)-[:-30]R_2)
   (-[:90]CH_2-O-[:30]C(=[:90,.7]O)-[:-30]R_1)
   (-[:-90]CH_2-O-[:30]C(=[:90,.7]O)-[:-30]R_3)
}

\end{document}

enter image description here

Related Question