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

  • We’ll need a minimal working example (MWE). What are monomers? Commented Mar 3, 2013 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
    Commented Mar 3, 2013 at 5:37
  • 1
    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.
    – cgnieder
    Commented Mar 3, 2013 at 7:11
  • @Anthony, can you post or link to the example that you found?
    – alfC
    Commented Jun 21, 2013 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
    Commented Jun 22, 2013 at 19:26

2 Answers 2


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


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...

You must log in to answer this question.

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