[XeTeX] Redefining the footnotes in XeTeX

John Was john.was at ntlworld.com
Wed Nov 21 14:27:11 CET 2007


If you are using plain XeTeX rather than the LaTeX variety, you  might be 
able to tweak the example on p. 398 of _The TeXbook_, perhaps by measuring 
each footnote at the start of your definition of \fn and then if it is over 
a certain percentage of \hsize putting it all in an \hbox of length \hsize:

\hbox to \hsize{Text of longish note.\hfill}

That should, I think, force the relevant notes to occupy a line by 
themselves.  But it might cause formatting difficulties with a preceding 
line of short footnotes, unless you could add \hss at the end of each 
footnote.  Anyway, perhaps worth fiddling with.  (If you have any notes that 
occupy more than one line, you would need to set the calculation _not_ to do 
the above trick since it would overfill the \hbox and in any case you would 
presumably want any following short note to appear in the breakline of the 
long note.)

My own ploy for doubling up footnotes (currently only allowing automatic 
setting of a short footnote full right in the breakline of a previous 
footnote,  though it could in principle be made into a more sophisticated 
routine, I think) is to do various measurements every time a footnote is 
encountered to see if there is enough room (the space available gets put 
into a dimen \availablespace).  The whole of the \fn command is given as an

\if     \else   \fi

sequence (since if the footnote is over a certain length it can't be doubled 
up with the previous note anyway), and I use a double set of braces round 
footnotes since I might want to tweak the footnote arrangement manually 
(either because it has messed up or because it happens to look better on a 
given page - e.g. to reduce white space between text and notes - if a short 
note does after all go into its own line).  So:

{\fn{This is the footnote.}}

If I want to make sure that that footnote is _not_ doubled up (even if there 
is room to do so), I can give

{\availablespace 0pt \fn{This is the footnote.}}

And if I want to ensure that it _is_ doubled up even if (for some reason) it 
isn't doing it, I can give

{\availablespace \hsize \fn{This is the footnote.}}

Now, to calculate the \availablespace on completion of each note (so that 
the next note knows what it is), my version of \fn puts the note into a 
temporary \hbox and then sets up a \vbox which contains the \unhboxed text 
of the note surrounded by $$    $$.  That lets me get at \predisplaysize and 
I can use that to make the calculation, which it does by setting 
\availablespace globally so that the measurement migrates out of the group 
in which all this is going on, and can be used by the next note.

I would post the entire macro but it's embarrassingly ropey, written many 
years ago when I first made acquaintance with TeX and was asked by the 
publisher to double up the footnotes.  It has unresolved glitches (hence the 
double braces {\fn{}} which allow local control immediately before the 
\fn) - in particular, it doesn't interact well with the page-breaking 
mechanism so that it will place a short footnote full right even on a new 
page (I override this by giving \availablespace 0pt).  I've never got round 
to attempting an output routine that would ensure this doesn't happen, 
though it should certainly be possible.

Anyway, perhaps a few ideas for you to ponder over your evening cocoa...



----- Original Message ----- 
From: "Brian Anderson" <briananderson4 at mac.com>
To: "Unicode-based TeX for Mac OS X and other platforms" <xetex at tug.org>
Sent: Tuesday, November 20, 2007 2:32 PM
Subject: JunkEmail: [XeTeX] Redefining the footnotes in XeTeX

> Hello,
> I'm working on a file, and I want to change the layout of the
> footnotes. I've looked at this several times, but haven't found
> anything, or even where to start.
> What I'm trying to do is change the footnotes at the bottom of the
> page from this:
> 1) first note
> 2) second note
> ..
> 6) sixth note
> to this:
> 1) first note 2) second note
> 3) this is a long footnote, so it is on its own line
> 4) short note 5) short note 6) short note
> I'd like to find a way to have XeTeX determine whether there is enough
> space on the line for 2 or more footnotes, or whether there should
> only be one.
> Any suggestions or ideas of where to start welcome.
> Thanks.
> Brian
> _______________________________________________
> XeTeX mailing list
> postmaster at tug.org
> http://tug.org/mailman/listinfo/xetex

More information about the XeTeX mailing list