Is there a way to test whether the current point is inside or outside a footnote or not?
The use case I have in mind is to provide two versions of a document, a "screen" one and a "printed" one and I'd like in the printed one automatically change the \href{<URL>}{<text>} into <text>\footnote{\url{<URL>}}, except in footnotes where this wouldn't make sense and \href{<URL>}{<text>} could be changed into <text> (\url{<URL>}).
\letas in\let\origfootnote\footnoteis not the recommended way anymore and that patching commands with e.g.etoolboxpatching tools is preferable (okay, that requires e-TeX): am I wrong? – Denis Bitouzé Nov 29 '13 at 07:44etoolboxpackage at all. Hence, I can only provide the following alternative to avoid the\letconstruction: Define\newcommand{\myfootnote}[1]{\foottrue\footnote{#1}\footfalse}in theifprintedstatement, add an\elsewith\newcommand{\myfootnote}[1]{\footnote{#1}}, and replace every\footnotewith\myfootnotein the body of the text. – crixstox Nov 29 '13 at 12:20\letis not recommended: in the documentation of thexpatchpackage, section 5 page 6 (though no explanation is given). In fact, it concerns only redefinition of macros that have an optional argument, hence your redefinition of\footnotewith\let\origfootnote\footnoteis perfectly advisable: sorry to have been suspicious ;) – Denis Bitouzé Dec 16 '13 at 15:57In fact, it concerns only redefinition of macros that have an optional argument, hence your redefinition of
\footnotewith\let\origfootnote\footnoteis perfectly advisable.Actually,
– Jim Ratliff Mar 05 '19 at 05:03\footnotedoes have an optional argument. "The optional argument number allows you to specify the number of the footnote." See §11.1\footnoteof the LaTeX2e unofficial reference manual (October 2018).