TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a molecule (in this case a copolymer) where I would like to hilight the monomers by colouring a number of atoms. Is there a more efficient way to do this than colouring each atom and bond individually? chemfig syntax can get rather verbose.

A Google search for "copolymer" turns up this, which is essentially what I'm trying to achieve.

enter image description here

share|improve this question
We’ll need a minimal working example (MWE). What are monomers? – Qrrbrbirlbel Mar 3 '13 at 5:31
I found an example of what I'm trying to do. A monomers is a small molecule that link up to form long chains, or polymers. – Anthony Mar 3 '13 at 5:37
You can color the entire molecule by using the optional argument of \chemfig. I am not aware of a way of coloring parts of molecules other than using the optional arguments of each bond, though. – clemens Mar 3 '13 at 7:11
@Anthony, can you post or link to the example that you found? – alfC Jun 21 '13 at 6:44
I don't remember if I ever found a chemfig example; I think I might have been referring to the image in the question. – Anthony Jun 22 '13 at 19:26

Here is a method to color both all atoms and bonds:

\def\paren#1{\rlap{\kern-.75em$\left(\vrule height1ex width0pt depth1ex\vrule height0pt width2.5em depth0pt\right)_{\!#1}$}}
\chemfig{[:30]!\Purple EtO-([,.75]=[2]S)-[:-30]S-[,,,,,black]!\Green(-[6,0.25]\paren n)
    ([,.75]-[2]O-(=[2]O)-[:-30])-[:-30,1.25]-[,1.25,,,,black]!\Red(-[6,0.25]\paren m)

enter image description here

share|improve this answer

Here's a simple solution. It still needs some tweaking but the idea, how to proceed is the following:

enter image description here




{$\left\delimleft\vrule height\delimhalfdim depth\delimhalfdim
{$\left.\vrule height\delimhalfdim depth\delimhalfdim




But as cgnieder mentioned, you have to probably color "manually" each bond separately...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.