TransWikia.com

How to set a counter like last page, so I can call its LAST value?

TeX - LaTeX Asked by CasperYC on December 14, 2020

I read here on how to extract the value of a counter.

So for my generic sols_preamble.tex I want to for example, to be able to do something like printing

foreach n in {1,...,theqnumber}{ n, }

What I am doing is to give an indication just like the lastpage thing. I want to say for exmaple, there are 8 questions in the file, you can go to Q1,2,3,4,5,6,7,8. on everypage of that file.
At the momemt, I am getting

you can go to Q1,2,3   on pages 3,4,5 of that file
you can go to Q1,2,3,4 on pages 6,7,8,9 of that file
... ... 
... ...
you can go to Q1,2,3,4,5,6,7,8 on pages 10 of that file

if there are only 10 pages and 8 quesitons.

Basically, what I need is it call the last value of my counter qnumber.
How could I archieve that?

After a bit of study at here.
I think I ran into the exact problme as discussed in the comments by Schweinebacke.

Thanks.

https://stackoverflow.com/questions/2561791/iteration-in-latex

One Answer

Sorry about the confusion in my post, as I was trying to illustrate two problems.

I finally solved with further reseach and found it here.

How to display the final value of a counter at the beginning of a document?

The answer by user31729 and the use of usepackage[nonumberofruns]{xassoccnt} worked fine with single tex file, or use structures files using input.

Answered by CasperYC on December 14, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP