Skip to main content
NinaBR
Inspiring
January 21, 2020
Question

How to create variables for "Page [page number] of [total pages in book]"

  • January 21, 2020
  • 4 replies
  • 924 views

Hi, helpful people!

 

I'm hoping this is an easy question to answer. It seems simple enough, but I haven't been able to find anything in the available resources.

 

I have a book that consists of a dozen or so chapters of 10-12 pages each, giving me a book of approximately 140 pages.

 

The book applies for multiple different products, where I use conditional text for each product. So the total page count is unique for each product's version of the book.

 

The pages are numbering correctly throughout, but I want to have the page number in the footer read as "Page [page number] of [total pages in book]" -- for example, "Page 47 of 140." I know that the variable "$curpagenum" will give me the current page number, but is there a variable for "total pages in book"? If not, how would I create one? Would I need to make it a user variable that I update each time I create a new version of the book?

 

Thanks, and apologies if this has been addressed elsewhere.

This topic has been closed for replies.

4 replies

LinSims
Community Expert
Community Expert
January 22, 2020

A while back my coworker and I commissioned Rick Quatro to write a macro for us that would total the number of pages in a book based on the files selected and put the result in a variable that we then stuck in a footer to give us the x of y. He might be willing to sell that to you if you ask. 

Bob_Niland
Community Expert
Community Expert
January 22, 2020

You know about <$curpagenum>. There is also a system variable <$lastpagenum>, but it appears to only reference the current file, and not the last page of the last file in a .book.

 

When I need to do this, I cross-reference to some object that is always on the last page of the last file, often a dedicated paragraph format named "EOD" (possibly invisible), and xref it by <$pagenum>.


The Master Page footer might then have:
Page <$curpagenum> of Xref
where Xref is to the EOD object, format <$pagenum>

Barb Binder
Community Expert
Community Expert
January 22, 2020

Wow, Jeff. I haven't see that post in a while.

 

Ennar, note that it was written for an earlier version of FrameMaker—it still works, but remember that the old Special menu was renamed Insert. So, Insert > Variables and Insert > Cross-References. Any other questions, just ask.

 

~Barb

~Barb at Rocky Mountain Training