Forum How do I...?

...make multiple references to the same footnote?

CCIT
Rather than having numbered footnotes, our publication has footnotes marked by asterisks.
.fn {
	display: prince-footnote;
	font-size: 7pt;
	footnote-style-position: inside;
}
.fn::footnote-call {
	content: "*";
}
.fn::footnote-marker {
	content: "*";
	footnote-style-position: inside;
}

So when someone wants to call a footnote, the code goes something like this:
This is a line of text with an interesting footnote.<span class="fn">This is the interesting footnote.</span>

Let's say the next sentence refers to the same footnote. How do you "phrase" the markup/styling to accommodate these kind of footnotes?
mikeday
At the moment this is tricky, as every footnote is unique. What you really need is a method for linking to the same piece of text from separate locations, have the text appear as a footnote and the correct footnote marker be used on each link. I'm not sure if this is possible yet, but it is something we plan to add in the future.
Zot
Any news about this feature? Is there some way to accomplish this with javascript?
mikeday
I think there is a way to do this by messing around with counters. Here is an example:
<html>
<head>
<style>
body { counter-reset: my-footnote }

.fn {
    float: footnote;
    counter-increment: my-footnote
}

.rfn {
    color: inherit;
    text-decoration: none;
    content: target-counter(attr(href), my-footnote);
    vertical-align: super;
    line-height: none;
    font-size: 83%
}
</style>
</head>
<body>
<p>
This paragraph has a footnote.<span class="fn" id="fn1">First footnote.</span>
</p>
<p>
This paragraph also has a footnote.<span class="fn" id="fn2">Second footnote.</span>
</p>
<p>
This paragraph refers to the first footnote.<a class="rfn" href="#fn1">yay</a>
</p>
<p>
This paragraph refers to the second footnote.<a class="rfn" href="#fn2">yay</a>
</p>
</body>
</html>

We use links with generated content and the target-counter() function to grab the footnote number that we are referring to. However, due to a limitation of Prince we cannot refer directly to the footnote counter, it always just comes back as zero. So we make a copy of it called my-footnote and increment that on each real footnote, and refer to that, and it works! :)
Rutger
Have there been any updates on this issue?

I understand what happens in the above example. but that would fail if the content runs over multiple pages.
If the last paragraph would be on page 2, the footnote would not be rendered on that page.

Is there a way to get this done in a more flexible way?
Rutger
Could you tell me if the 2-pass solution could possibly help out to get this solved?

We are at the point of purchasing Prince but i need to get this solved in order to meet our requirements.

Thanks in advance!
mikeday
Yes the two pass solution can probably work, I am just checking if we can support target-counter() properly for the footnote counter directly, as this would be considerably simpler to use.
Rutger
Thank you for your answer!

It would be really great if that would work.
I will wait for the outcome of that before looking into the 2 pass solution.
mikeday
We have a latest build of Prince available now with support for using target-counter() with the footnote counter, hopefully this will help. Please let me know if you run into any issues using this feature.
Rutger
Thank you very much for the fast response!!

I will try to get it working as soon as i can and keep you updated!

Edited by Rutger

Rutger
Could you maybe give a small example on how to use this feature?
I'm not sure how my HTML should look to make this work.

mikeday
Please try the attached HTML file.
  1. target.html1.0 kB
chazelwood
The example (target.html) is not working as expected for me--the footnotes are numbered 0 instead of their respective numbers. How can this be fixed?

The results I see in the PDF created through Prince with target.html are the following:

This paragraph refers to the first footnote.0
This paragraph refers to the second footnote.0
This paragraph has a footnote.1
This paragraph also has a footnote.2
This paragraph refers to the first footnote.0
This paragraph refers to the second footnote.0
This paragraph refers to the third footnote.0 (it's on the next page)


1. First footnote.
2. Second footnote.

-------- page break ---------

This paragraph has a footnote.3



3. First footnote.
mikeday
Which version of Prince are you using?
chazelwood
Hi Mike,

I am using 11.3.
chazelwood
I have upgraded to 12.4 with the same results.

Edited by chazelwood

mikeday
Please try the latest build.