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@scopeneed to expand to anything? Or the expansion of\sep@scopeitself? – eduardo.tex Jul 18 '16 at 04:38\let\sep@scope\globalor\let\sep@scope\empty. If the choice for the latter is\relax, is it more than{}, since it's also not expandable. – Werner Jul 18 '16 at 05:15\long\relax\def\test{A test}, say, shouldn’t be legal, which suggests that\let\sep@scope\@emptyis the right thing to do; nevertheless, I’ve tried the above input with both TeXLive’spdftexand with the TeX program incorporated in OzTeX (This is TeX, Version 3.14159), and both accepted it. – GuM Jul 18 '16 at 07:15\long, because a footnote can consist of more than one paragraph. – egreg Jul 18 '16 at 08:11\long\relax\defhas always worked but I can't actually justify it via the syntax production in the texbook, maybe a documentation bug? – David Carlisle Jul 18 '16 at 08:14sepfoot.) Users may even use multiple prefixes and then have multiple, independent footnote series in the same document. – eduardo.tex Jul 18 '16 at 13:10