Still do not understand HMFIGCOUNTER increments

Please post all questions on Help+Manual 8 here

Moderators: Alexander Halser, Tim Green

Post Reply
Gerold Krommer
Posts: 113
Joined: Fri Mar 06, 2015 12:09 pm

Still do not understand HMFIGCOUNTER increments

Unread post by Gerold Krommer »

Hi,

I had a few questions around this end always ended up with a - to me - hack and now I would like to understand it once for all. I hasten to admit it must be my narrow mind...

I start in the source with

Figure <%HMFIGCOUNTER+%> shows ...

<<here comes figure>>

Figure <%HMFIGCOUNTER%>: Rear view of .... this entry is added to the table of figures

The resulting output is

Figure 0 shows...

<<figure>

Figure 1: Rear view of...

However I twist and turn, I do not get the logic. If HMFIGCOUNTER is initially 0 it should be all 1s, right?

I tried explicitly setting <%HMFIGCOUNTER=0%>, that didn't change anything. When I do <%HMFIGCOUNTER=1%> I get

Figure 1 shows...

<<figure>>

Figure 2: Rear view of...

Looks to me the <%HMFIGCOUNTER+%> doesn't add one to the current value of 0... I just do not get ot.

BTW: When I do <%HMFIGURECOUNTER=0%> the 0 appears in the PDF printout, should that be????

Sorry for being stupid, it must be something very basic I'm missing.

/Gerold
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Still do not understand HMFIGCOUNTER increments

Unread post by Tim Green »

Hi Gerold,

This has been improved in the current update. You can get the pre-release version with this link, please see how you get on with it:

https://www.helpandmanual.com/download/ ... p-v840.exe
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Gerold Krommer
Posts: 113
Joined: Fri Mar 06, 2015 12:09 pm

Re: Still do not understand HMFIGCOUNTER increments

Unread post by Gerold Krommer »

Hi Tim,

installed it. No change.

If the first occurrence is <%HMFIGCOUNTER+1%> this comes out as 0 (zero).

BR,

/Gerold
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Still do not understand HMFIGCOUNTER increments

Unread post by Tim Green »

Hi Gerold,
If the first occurrence is <%HMFIGCOUNTER+1%> this comes out as 0 (zero).
You're using the wrong reset method from the older counter types. You need to use an = character and the number you want to reset to. From the documentation:

https://www.helpandmanual.com/help/hm_w ... rsref.html

Resetting the counter

If you don't change anything the figure counter will number your figures consecutively throughout your entire project. If you want to reset the counter, for example to count from 1 in every chapter, you can do this by adding an = sign and the starting value for the counter, like this:

<%HMFIGCOUNTER=12%> (resets the figure counter to 12)
<%HMFIGCOUNTER=1%> (resets the figure counter to 1)

Including manual chapter references in the counter

In addition to resetting the counter you can also include a manual chapter reference in the counter. There just needs to be a non-numeric character before the actual number you are resetting the counter to:

<%HMFIGCOUNTER=3-12%> (resets the figure counter to 3-12)
<%HMFIGCOUNTER=II.1%> (resets the figure counter to II.1)

You only need to make this entry in the first instance of the variable where it is used. After that it will be used automatically until you reset it again. If you are numbering like this you need to include a reset like this in the first figure reference at the beginning of each chapter, of course.

Chapter references in the counters are NOT automatic!

Important: Note that you can't use automatic chapter references! In the examples above the "3" and "II" references will not increment automatically. You need to change them at the beginning of each chapter when you reset the figure counter.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Gerold Krommer
Posts: 113
Joined: Fri Mar 06, 2015 12:09 pm

Re: Still do not understand HMFIGCOUNTER increments

Unread post by Gerold Krommer »

Hi Tim,

thanks for the extensive explanation, but I think you are one step ahead of me and my misunderstanding is earlier in the process.
To begin with, I do not want to reset anything. My first assumption is that all counter variables (be they old or new) are initially set to zero.

I also understand that the new counters are incremented in specific places and not like to old one which were incremented whenever referenced (right?).

Then why -if the first line in my document is <%HMFIGCOUNTER+1%> - does it come up as zero?
If - just bevore that line - I do a <%HMFIGCOUNTER=0%> (to make sure the counter is initialized to zero) , why does it still come up as zero.

My image captions are alright. I have <%HMFIGCOUNTER%> in the caption and the numbering starts at one and increments by one per image. It is the relative reference that baffle me.

Wäääää! (German soundex for a little baby crying)

Thanks,

Gerold
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Still do not understand HMFIGCOUNTER increments

Unread post by Tim Green »

Hi Gerold,
Then why -if the first line in my document is <%HMFIGCOUNTER+1%> - does it come up as zero?
If - just bevore that line - I do a <%HMFIGCOUNTER=0%> (to make sure the counter is initialized to zero) , why does it still come up as zero.
They don't, and if they do something is wrong in your project or your HM installation.

For example, these variables at the beginning of a topic:

Code: Select all

1: <%HMFIGCOUNTER=0%> (in body text)
2: <%HMFIGCOUNTER%> (in body text)
3: <%HMFIGCOUNTER+1%> (in body text)
4: <%HMFIGCOUNTER%> (in an image caption)
5: <%HMFIGCOUNTER%> (in body text)
6: <%HMFIGCOUNTER%> (in an image caption)
Should result in this output in the published topic:

Code: Select all

1: 0
2: 0
3: 1
4: 1
5: 1
6: 2
Line 1: Set to zero.
Line 2: Returns zero
Line 3: Incremented manually (will now match the following value in the image caption
Line 4: Incremented automatically from the original value in line 1
Line 5: Just returns the current value from the caption
Line 6: Incremented automatically in the next caption

The documentation for this has recently been improved and made clearer, but unfortunately it is not yet online. If the above sequence produces different results for you in the current pre-release version please mail me a small demo project illustrating the behavior and I'll check it for you.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Gerold Krommer
Posts: 113
Joined: Fri Mar 06, 2015 12:09 pm

Re: Still do not understand HMFIGCOUNTER increments

Unread post by Gerold Krommer »

I think I found the problem or misunderstanding.

Your test outputs exactly as you said, but if I do (note no 1 after the +)

1: <%HMFIGCOUNTER=0%> (in body text)
3: <%HMFIGCOUNTER+%> (in body text)
2: <%HMFIGCOUNTER%> (in body text)
Figure <%HMFIGCOUNTER%>:caption
5: <%HMFIGCOUNTER%> (in body text)
Figure <%HMFIGCOUNTER%>:caption 2

I get

1: 0 (in body text)
3: 0 (in body text)
2: 0 (in body text)
Figure 1:caption
5: 1 (in body text)
Figure 2:caption 2

This way is exactly what is offered with 'insert variable'....

baffled

/gerold
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Still do not understand HMFIGCOUNTER increments

Unread post by Tim Green »

Hi Gerold,

Try inserting the 1 after the +. Apart from that everything looks exactly as it should be. :)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Gerold Krommer
Posts: 113
Joined: Fri Mar 06, 2015 12:09 pm

Re: Still do not understand HMFIGCOUNTER increments

Unread post by Gerold Krommer »

Easier said than done...

Ctrl-T (insert variable) uses it without the 1, actually I cannot use that at all, as I cannot edit the value later.

I have to delete the variable and enter the complete name by hand...
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Still do not understand HMFIGCOUNTER increments

Unread post by Tim Green »

Gerold Krommer wrote: Tue Aug 03, 2021 11:44 am I have to delete the variable and enter the complete name by hand...
No, you don't. You can just click in the inserted variable and type to add the number. Give it a try... 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Gerold Krommer
Posts: 113
Joined: Fri Mar 06, 2015 12:09 pm

Re: Still do not understand HMFIGCOUNTER increments

Unread post by Gerold Krommer »

I had situations when the variables were not editable, but I cannot (yet) reproduce them. Will keep trying.

/Gerold
Post Reply