Hanging footnote numbers

I would like the footnote number at the bottom of the page to show up in the margin, so that if there are multiple footnotes it’s easier to spot where they begin and end, and which one has which number. The footnotes are each a separate paragraph.

This seems directly analogous to the “hanging verse number” option for poetry.

I’ve redefined the caller marker (for other reasons) to be z_f_caller_bottom
This is a start:
\sethook{start}{z_f_caller_bottom}{\kern -13pt}
but it’s hard to get the next part of the footnote (the \fr reference) to automatically set itself on the starting margin. And when the footnote numbering goes to double digits, it moves that reference number too far along the line

I’ve also tried experimenting with the snippet here), but haven’t gotten it to work yet.

Is there some other way of doing it?

Does changing the first line indent of the footnote style work for you? You should be able to make it negative so that it appears in the margin.

Well, that’s an embarrassingly easier and more intuitive way of doing that exact same thing that I accomplished with a sethook and negative kerning…

But it doesn’t solve my problem, which is that when the footnote numbering moves from single to double digits, it messes up the spacing (i.e. where the main footnote falls in relation to the margin).

You’re actually pretty close with your sethook, but what you probably need to do not just kern, but put it into a box, and then \llap that, more like this (untested):

\sethook{start}{z_f_caller_bottom}{\setbox0\hbox\bgroup}
\sethook{end}{z_f_caller_bottom}{\egroup\llap{\box0\kern3pt}}

\llap pushes its contents left so there’s no width taken (it has a friend \rlap if someone needs to make stuff overlap to the right), so what I’m trying to do is make a box that contains the caller, adding 3pt of space to that (feel free to pick another number), and then make it all hang off the left of the paragraph. Hopefully it’ll work!

Note: \box0 is safe to use because (having checked in the .tex file) that’s what’s actually being used to get the caller already. (temporarily using \box0 in the middle of defining box0 isn’t going to override any other boxes).

Note 2: The normal space between note and caller is \kern\NoteCallerSpace
Note 3: llap should give you a zero width box. If you have a non-zero width, then the result will be centred into a box \NoteCallerWidth wide and followed by NoteCallerSpace. That may or may not be what you want!

Thank you. That worked great. I had guessed that \llap might be helpful, but I couldn’t figure out how to read in the contents of the caller. I was trying { }, which obviously don’t work, and had forgotten about \bgroup and \egroup.

To try to understand this better:

  • Is box0 the name of a variable, and \setbox0 set its value equal to the contents of the caller?
  • And (I think you were saying), did you pick that particular variable because it’s the one that was already being used for the caller–so you knew it wouldn’t interfere with anything else.
  • How are you keeping the footnote caller from being processed in it’s normal way? Is it because it’s inside a \bgroup while TeX moves from the start of z_f_caller_bottom to the end?

Bullet point 1a: (Internally) all ‘snippets that go on a page but are being played with’ in TeX are \box 0....\box 65535. (or \box0 ...., in normal conditions the space just helps humans read it, but in some conditions it might actually cause an error).

Numbers get confusing, so we can use \newbox\something replace the number with a label (\something) if we want to permanently reserve it. \box 0 up to \box9 are reserved as unnamed temporary boxes. Various other boxes are also reserved for special functions.

Just a straight \box 0 will output the contents of the box and empty the definition. \copy 0 will output the box and keep the definition. To define the contents, then the syntax is \setbox[number/label][some box] where [some box] is \hbox{contents} \vbox{contents} or a \box or \copy

Bullet point 2: I made a guess that box0 was safe as a general purpose temporary box, and then had a moment of uncertainty and checked it.

Bullet points 3 and 1b: Because you’re using z_f_caller_bottom for the note caller style, the caller in the text and the caller (or callee) in the notes area are treated differently.

Let’s assume that the relevant callee for a given note is ¤. What normally happens in this case is that code defines \box0 to be (effectively) \hbox{\+z_f_caller_bottom ¤\+z_f_caller_bottom*} (although it doesn’t actually generate that exact code), It then processes that box like it would for any callee:

  • it measures how wide that box is and if it’s non-zero but narrower than \NoteCallerWidth it pads to be that size (so things line up more nicely).
  • If the result of that is of non-zero width, then it adds the \NoteCallerSpace

The code I gave you gets interpreted as the character styles are being applied inside the box, so it effectively ends up as:

\setbox0{\+z_f_caller_bottom
  \setbox0\bgroup 
  ¤ 
  \egroup\llap{box0 \kern 3pt}
\+z_f_caller_bottom*}

Except that (a) if you typed that it’d almost certainly break, given catcodes, spaces and other dangerous and confusing things and (b) the hooks are actually processed in the middle of the start and end code for z_f_caller