Forum How do I...?

How to get target-countr page to refer to *facing* page?

Chris Thorman
Especially in old-fashioned books, references to photographs and figures refer to the page number of the *facing* page (where a page number actually appears, because commonly there were no page numbers on the page with the photos on it.)

I can't see a way to do this in CSS currently.

If there is no way, then maybe a new feature could be proposed: how about a pseudo-counter, facingpage, which would always be a function of page:

The pseudocode formula for this function would be:

// right page: facing is prior pg; left page: facing is next pg
facingpage = (page mod 2 ? page-1 : page+1)

Typical usage might be, instead of this...

content: " " leader(' . ') target-counter(attr(href), page);

this...

content: " " leader(' . ') target-counter(attr(href), facingpage);

-c
mikeday
Support for arbitrary arithmetic expressions would allow you to express that directly as you have written it. However, the facing page keyword does seem like an easier way to support this in the short-term, and probably easier for authors to remember. :)
carl johnson
Can't you just put an id="blah" on your image and have the CSS reference the page number of that?
Chris Thorman
Yes, if you want the page number that the image is *on*. In this case, we want the page number that the image is *across from*. Again, this is something they mainly did in the old days when photos were on "plates", usually different kind of paper from the rest of the book, and those pages often did not have page numbers printed on them, so they were referenced by the facing page.
mikeday
In Prince 8.0 the prince-script() value can now be used to do things like this. However, there are limitations in line-breaking script generated content that will be lifted in Prince 8.1 to make this more practical.