How do I detect whether I'm in a \footnote environment or not?


I just \def\infootnote to T or F. If you needed to branch on that basis, you could perform \if T\infootnote TRUE code\else FALSE code\fi.

\textheight 1in
Footnote status: \infootnote.  Now entering a footnote%
\footnote{The status now: \infootnote.  Done.}
Continuing with status: \infootnote.  Again.
\footnote{The status now: \infootnote.  Done.}

enter image description here


Define a conditional \iffootnote and redefine \footnote so that it makes \iffootnote come out true inside its parameter, but false outside. For example:


foo\footnote{a\iffootnote yes\else no\fi}

bar \iffootnote yes\else no\fi
  • The \footnote macro defined by the LaTeX kernel also accepts an optional argument. – jub0bs Apr 15 '14 at 17:56
  • This is just the idea. – n.r. Apr 15 '14 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.