I'm using the
chemstyle package to handle automatic numbering of compounds. It apparently uses the
chemcompounds package to handle this. In the documentation for the latter, it explains compounds can be 'created' implicitly, just by referring to a label that doesn't yet exist:
Generally this works great, but when I try to do it inside a caption, it seems to forget the compound straight away. For example, I have two figures side-by-side, I refer to different compounds in each caption, but they get assigned the same compound number. When I create a new compound in the text following, it gets the number assigned to the first compound in the figures... so basically as soon as the caption ends the package forgets all the compounds.
I should mention I'm aware it is possible to work around this (eg. by making sure things are referred to in text before captions), but I'm looking for a foolproof solution. After all I'm using LaTeX for this so I don't have to worry about misnumbered compounds constantly.