I teach chemistry and wish to demonstrate drawing and naming of chemical structures
I use chemfig to draw my molecules and I can do that fine. However, in for example the molecule 4-ethyl-3,3-dimethylhexane there are a number of components to the molecule which I want to uncover bit by bit to illustrate the naming/drawing of such a molecule.

We have a hexane root - draw this

add an ethyl group on carbon 4 - highlight this addition

add two methyl groups on carbon 3 - highlight these additions

Below is the code to build the molecule bit by bit as individual figures but I would like to be able to uncover on one molecule and highlight the pieces as they are added.

I had tried to use \onslide<n->in the parts I wanted to uncover but just got goobleydegook. I would be grateful if anyone has any ideas...

Below is fine but I would prefer to add to the parent molecule bit by bit...

2 Answers
2

We can set the opacity of the bonds we do want to hide to zero and make them visible again with \pgfkeysalso.

Sadly, I have not found a simple way to pass TikZ options to the nodes (the atoms like C and H_3) otherwise it would work like the same with visible on=<slides>.

I propose two solutions:

Redefinition of \printatom with checks a set of integers against the current node number.

To see the numbers one has to use \qrrDebugNodes which needs to enclosed in { } if it shouldn’t be global or one reset at the end of the to analyzed \chemfig with

\qrrDebugNodes[false]

The bonds can still be placed on different atoms (whatever the syntax).

A simply \unc macro that is built upon \uncover which hides its argument on the specified slides. This has the disadvantages that CH_3 is seen as one atom and not as two (C and H_3), which makes the placements of the bonds defunct, even if we use more than one \unc (for every atom one).

Output

Nice. The issue with the CH_3 is not too critical as it is assumed the end is CH_3 if not explicitly written in. I'll wait a while before I accept this as an answer in case another solution is presented
–
LeeserFeb 16 '13 at 17:32

Can this be expanded to take into account a reaction scheme; ie uncover a reaction step by step, or add electron motion step by step?
–
LeeserMar 20 '13 at 12:47

I thought about that but I often put my examples inside an exampleblock or other block environment which have differing background colours so would have to be adapted for this each time.
–
LeeserFeb 15 '13 at 13:59

If it is a solid color, you may replace the white color by the background color.
–
Lionel MANSUYFeb 15 '13 at 14:01