Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
Do you use any special footnote packages? Please provide a minimal working example (MWE) that shows your use-case. –  Werner Apr 15 '14 at 17:31
I think this may be rather difficult to do. Biblatex does it, but it involves many lines of code patching various footnote commands (which vary depending on class and package loaded). You could, if you feel strong, borrow/steal that code. It's around lines 134-197 of biblatex2.sty. Or, if you load biblatex anyway you could piggy-back on its commands. –  Paul Stanley Apr 15 '14 at 17:40
Stricly speaking, \footnote is just a macro, not an environment. –  Jubobs Apr 15 '14 at 17:55

2 Answers 2

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

share|improve this answer

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
share|improve this answer
The \footnote macro defined by the LaTeX kernel also accepts an optional argument. –  Jubobs Apr 15 '14 at 17:56
This is just the idea. –  nicolai.rostov Apr 15 '14 at 17:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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