Please enable JavaScript to view this site.

Navigation: More Advanced Procedures > Using Variables

Counter variables for numbering

Scroll Prev Top Next More

You can use counter variables to number anything in your project that needs consecutive numbering, such as illustrations and so on. There are two kinds of counter variables: User-defined counter variables, which cannot be referenced, and two special predefined counter variables for numbered figures and tables, which can be referenced. With these two variables you can use references like "See Fig. X" or "See Table Y", both in plain text and in hyperlinks.

Important resriction: Counter variables are not supported in the TOC

Because of the way that counter variables are processed, you can only use them in the body of your topic texts. If you use them in the table of contents (TOC) the counters will be incorrect. This is because the TOC is processed separately from the topic files. Since the counter variables can only be incremented when they are processed, this means that all counter variables in the TOC will be processed, and then the counter variables in the topics. This means that it is impossible for the count to proceed logically from a variable in the TOC to the same variable in one of the topics.

You might then assume that you can use counter variables in the TOC if they are only used there, but that also won't work. The reason for this is that in some circumstances it is quite possible for the TOC to be processed multiple times when you publish your project. If this happens, the values of the variables will be incremented every time the TOC is processed.