# How do I selectively change bond length in 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)}

-

## migrated from stackoverflow.comNov 18 '13 at 7:05

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Nov 18 '13 at 7:09

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}


-