You can define as many user counter variables as you like and you can define the starting number to be used for each variable, which makes it possible to use the variables across multiple projects. User-defined counter variables cannot be referenced. They simply provide consecutive automatic numbering, with no additional functionality.
Key Information
If you use a counter variable inside topic or image captions you must only use it in topic or image captions. If you also use it in normal topic text the numbering will be wrong. (Variables in captions are evaluated in a separate pass when you publish.)
|
Counter variables are simple counters that cannot be referenced
User-defined variables are quite simple. They will provide you with continuous numbering but that is all. You cannot "refer" to them with variables in references like "See Figure XX". See Figure and table counters for instructions on how to create referencing counters for figures and tables.
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.
|
User counter variables are identified by two ++ characters at the end of the variable name. Otherwise counter variables can have any name you like, just like normal user-defined variables.
Every time Help+Manual encounters the variable in a project it increases its value by 1. This means if you want to start with 1 you must enter "0" as the variable's initial value when you define it. If you want to start with 10 you must enter "9" and so on (without the quotes).
1.Define a text variable with two + characters at the end of its name, for example ITEM++, VIEW++ and so on.
2.Set the value of the variable to 0 if you want to start counting at 1, to 89 if you want to start counting with 90 and so on. (Always one less than the number you want to use, the value is always incremented whenever the variable is used.) |
Just insert the variable in the place where you want the count to be displayed. Each time you use the same variable the variable's last value will be increased by 1. For example, to number your images just type the counter variable in the image caption field of the Insert Image dialog with appropriate text, for example
The Insert Image dialog (select Write > Insert > Image, or double-click an existing image to display)
User variables in image captions:
User-defined variables cannot be referenced. Use the special figure and table counter variables for creating numbered figures and tables that you can reference in other places in your text.
If you do use user counter variables in image captions it's important to know that they are evaluated in a separate pass when you publish. This means that if you use a counter variable in an image caption you must never use the same variable anywhere else in the current project. You can only use that variable in image captions. If you also use the variable in other locations the count will be incorrect.
|
You can use these variables in modular projects. You just need to reset the starting value of the variables in your child projects if you are using runtime merging in HTML Help.
Publish time merging:
If you are using publish time merging you just need to define the variable in the master project and then use it throughout all your projects. Publish time merging is the only available option for all formats except HTML Help. In HTML Help you can choose either publish time merging or runtime merging,
Runtime merging in HTML Help:
If you are using runtime merging for your HTML Help output you must define the correct starting values for each variable in the child projects. To do this you need to check the final value in the preceding project and set the starting value to that value.
For example, if the final value of your IMAGENO++ variable in Project A is 63 you need to define the value of IMAGENO++ in Project B as 63. Then the value will be incremented correctly to 64 the first time you use the variable in Project B.
|
See also:
Working with Modular Help Systems