[cl-typesetting-devel] Page n of m?
Marc Battyani
marc.battyani at fractalconcept.com
Thu Sep 30 19:57:17 UTC 2004
Peter Seibel wrote:
> I haven't really spent much time on this, mostly because I somehow
> picked up the impression that it'd would be a pain. But maybe I'm
> wrong. Is there an easy way to typeset a document and generate
> something like a header with "Page n of m" in it where n is the
> current page number and m is the total number of pages. I've got "Page
> n" already but I have no idea to get the whole number of pages in
> advance.
>
> -Peter
>
> P.S. A more complex version of this is something like cross-references
> where I want to insert some text along the lines of (see page X) where
> X is determined at typesetting time based on where some anchor ended
> up getting placed. And of course there's the wrinkle that depending on
> the value of X, inserting the text might change the way the pages
> break. But maybe someone has solved this problem and I just missed it.
Hum, you should follow more closely the evolution of cl-typesetting ;-)
What you want is called references and it's in references.lisp.
If you want a reference to the last page of a document, just call something
like
(mark-ref-point :the-end)
At the end of the document.
And put this in your footer:
(format-string "Page ~d of ~d"
pdf:*page-number*
(find-ref-point-page-number :the-end))
This works also for things like "(see page ~d)"
See test.lisp for more details.
Cheers,
Marc
More information about the cl-typesetting-devel
mailing list