def preParse(self, tex): """ This is getting tricky. The ContinuedFloat tells whether or not the counter should be incremented. We save the lastvalue of the counter in the userdata so we can get it back here. """ doc = self.ownerDocument c = doc.context if doc.userdata.getPath('packages/subfig/continued'): v = doc.userdata.getPath('packages/subfig/subfloats/%s/lastvalue' % self.tagName, 1) c.counters[self.counter].setcounter(v+1) doc.userdata.setPath('packages/subfig/continued', False) else: doc.userdata.setPath('packages/subfig/subfloats/%s/lastvalue' % self.tagName, c.counters[self.counter].value) return Command.preParse(self, tex)