I'd like to implement a global
option on a package that I maintain, as per Mats's suggestion (here). The package is sepfootnotes
, and the suggested modification will allow footnotes' content definitions optionally to take global scope. This will make sepfootnotes
compatible with the subfiles
package.
So, the basic idea is to put a macro before \@namedef
, say \sep@scope
, and then let users define this macro either as \global
or as something else to keep it local.
My question is: what should this something else be? What is the safest default expansion for this macro: \relax
?
sepfootnotes.sty (beta, minimal)
\NeedsTeXFormat{LaTeX2e}[1996/06/01]
\ProvidesPackage{sepfootnotes}[2016/07/17 v0.3c Footnotes in separate file]
\DeclareOption{global}{\sep@opt@globaltrue}
\newif\ifsep@opt@global
\ProcessOptions
\newcommand\sep@scope{\relax}
\ifsep@opt@global
\renewcommand\sep@scope{\global}
\fi
\newcommand\sep@namedef[2]{\sep@scope\@namedef{prefix#1}{#2}}
\newcommand\sep@nameuse[1]{\@nameuse{prefix#1}}
\newcommand\sepfootnotecontent{\sep@namedef}
\newcommand\sepfootnote{\sep@nameuse}
\endinput
doc.tex
\documentclass{article}
\usepackage[global]{sepfootnotes}[2016/07/17 v0.3c]
\begin{document}
\begingroup
\sepfootnotecontent{key}{content}
\endgroup
my \sepfootnote{key}
\end{document}
\sep@scope
need to expand to anything? Or the expansion of\sep@scope
itself?\let\sep@scope\global
or\let\sep@scope\empty
. If the choice for the latter is\relax
, is it more than{}
, since it's also not expandable.\long\relax\def\test{A test}
, say, shouldn’t be legal, which suggests that\let\sep@scope\@empty
is the right thing to do; nevertheless, I’ve tried the above input with both TeXLive’spdftex
and with the TeX program incorporated in OzTeX (This is TeX, Version 3.14159
), and both accepted it.\long
, because a footnote can consist of more than one paragraph.