[texhax] macro for numbering footnotes on each page

Pierre MacKay pierre.mackay at comcast.net
Sun May 30 00:44:26 CEST 2010


On 05/29/2010 02:33 AM, Adam Fenn wrote:
>
>    
>> Well ... I notice that \@@footnote is \let within
>> a \begingroup ... \endgroup nest; maybe try a \global
>> prefix on the \let and see if that helps,
>>      
> With \global it runs without an error and produces footnotes
> but they do not start from one on each new page (they just run consecutively as normal).
>   		 	   		
>    
Since I do not do Latex for anything but business invoices, I cannot be 
positive of this, but surely the footnote mechanism has a global counter 
that increments before or after each footnote. \show<footnotemacro> 
might reveal this. Assuming it does (it really has to) the problem 
reduces to a need to reset this counter globally just after each call to 
your \output macro---you must have one somewhere.

As long as your footnotes are short enough to avoid breaking over into 
the next page, this may be all you need. If there is a possibility of 
breaking, the task is more complex, because you may have to monitor what 
part of any long footnote is on what page.

Page breaking is asynchronous, and it is sometimes necessary to insert a 
"pseudoparagraph" to get the regular page breaking mechanism to fire up 
when */you/* want it to, and not when an arbitrarily long paragraph says 
it ought to happen. That requires inspecting the penultimate version of 
your text and inserting a paragraph break with a 0pt \parfillskip 
followed by a \noindent before the rest of the long original paragraph. 
I think I do this about ten times in each journal issue I set. 
Occasionally I have to put an \eject before the \noindent.

\def\pseudopar{\parfillskip=0pt\par\parfillskip=0pt plus 1fil} % make 
sure you restore the normal \parfillskip

Pseudopar is only necessary when the counter appears to have been reset 
on the wrong footnote.

You can also inspect the penultimate printout for obvious cases of 
misnumbered footnotes and, just preceding the note, force the 
footnotenumber counter to restart (using a global) \count<whatever>=1 
(or zero, depending on whether the footnote counter increments before or 
after the footnote is committed to temporary storage).

You may find that you don't have to do this often. I have been surprised 
by how effective it is to use the "pseudoparagraph" macro to trick the 
output macro into setting things correctly.

Pierre MacKay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20100529/f3ec5c9f/attachment-0001.html>


More information about the texhax mailing list