I have a customized command that I need to make operate differently when inside a footnote.
Is there an environment variable that I could test for?
All ideas much appreciated.
Thanks
Alan
General ⇒ How can I tell when I'm inside a footnote?
How can I tell when I'm inside a footnote?
Last edited by alanq on Thu Aug 26, 2010 11:27 pm, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

-
- Posts: 351
- Joined: Sat Aug 02, 2008 8:47 am
How can I tell when I'm inside a footnote?
alanq wrote:I have a customized command that I need to make operate differently when inside a footnote.
Is there an environment variable that I could test for?
Code: Select all
\documentclass[12pt]{article}
\newif\ifinFN\inFNfalse
\makeatletter
\let\@Footnotetext\@footnotetext
\renewcommand\@footnotetext[1]{%
\global\inFNtrue\@Footnotetext{#1}\global\inFNfalse}
\makeatother
\def\Test{\ifinFN in \else not in \fi footnote}
\begin{document}
\textsf{\Test}
\footnote{foo \Test \par bar \Test}
\Test
\end{document}
How can I tell when I'm inside a footnote?
Dear CrazyHorse
Thank you.
I'm relatively new to TeX/LaTeX, but already a fan, so learning how all that works will add much to my armoury
I have Knuth's Volume A on it's way...
Regards
Alan
Thank you.
I'm relatively new to TeX/LaTeX, but already a fan, so learning how all that works will add much to my armoury

I have Knuth's Volume A on it's way...
Regards
Alan
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How can I tell when I'm inside a footnote?
Now that the problem is solved, please mark the topic accordingly as described in Section 3 of the Board Rules (to be read before posting).
Best regards
Thorsten
Best regards
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10