# Redefining eplain’s \numberedfootnote within a plain tex document

eplain provides a macro \numberedfootnote which, as might be inferred from the name, produces a raised number followed by the footnote text with the number increasing by one each time it is called.

\numberedfootnote is defined in eplain.tex at line 2997 as:

\def\numberedfootnote{%
\@eplainfootnote{$^{\number\footnotenumber}$}%
}%


I would like to be able to, on a document by document basis, control how the number is displayed. For example, because I usually use XeTeX, I might use the font's built-in superscript rather than switch into maths mode and so change:

$^{\number\footnotenumber}$


to

\sup \number\footnotenumber


or switch from \number to \romannumeral.

I simply do not understand the interactions of the macros in eplain to understand how I might be able to change this within a document. For example, if I try adding:

\def\numberedfootnote{%
\@eplainfootnote{ \romannumeral\footnotenumber}%
}%


The command is ignored as it is if I try \global\def. I therefore wondered if I needed something like \xdef but that simply gives me the warning:

Undefined control sequence.
l.36   \@
eplainfootnote{ \romannumeral\footnotenumber}%
?


Is there a simple command I could use to redefine this macro from within a document?

-

Quoting from the TeXbook, page 344:

At this point plain.tex completes its initialization of category codes by setting \catcode\@=11, thereby making the character ‘@’ behave temporarily like a letter. The command \catcode\@=12 will appear later, hence at-sign characters will act just like ordinary punctuation marks when TeX is running. The idea is to make it easy for plain TeX to have private control sequences that cannot be redefined by ordinary users; all such control sequences will have at least one ‘@’ in their names.

So this is the same problem described in What do \makeatletter and \makeatother do? for LaTeX.

For plain TeX there are no specific macros, but

\catcode@=11
\def\numberedfootnote{%
\@eplainfootnote{ \romannumeral\footnotenumber}%
}
\catcode@=12


would do.

The same convention is used in eplain.tex; but, actually, eplain.tex does have \makeatletter and \makeatother

292 \def\makeatletter{%
293   \edef\resetatcatcode{\catcode\noexpand\@\the\catcode\@\relax}%
294   \catcode\@11\relax
295 }%
296 \def\makeatother{%
297   \edef\resetatcatcode{\catcode\noexpand\@\the\catcode\@\relax}%
298   \catcode\@12\relax
299 }%


So it's better using them:

\makeatletter
\def\numberedfootnote{%
\@eplainfootnote{ \romannumeral\footnotenumber}%
}
\makeatother

-
Thanks: that makes sense. I’d encountered the at-sign problem in LaTeX before but not in plain TeX. – JacobH Mar 5 at 15:27
@JacobH Further research has revealed a better method. – egreg Mar 5 at 15:37
Thanks. It’s actually clearly set out in the eplain manual at 7.1: Sometimes you might want to temporarily change the category code of the ‘@’ character to \letter, so that you can use or define macros which are normally inaccessible to the user. For such situations, Eplain provides the \makeatletter command. It sets the category code of ‘@’ to \letter (11) and defines \resetatcatcode to restore the category code to whatever it was before the call to \makeatletter. – JacobH Mar 5 at 15:49