GeneralHow can I tell when I'm inside a footnote?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
alanq
Posts: 21
Joined: Mon Dec 28, 2009 3:03 am

How can I tell when I'm inside a footnote?

Post by alanq »

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
Last edited by alanq on Thu Aug 26, 2010 11:27 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

How can I tell when I'm inside a footnote?

Post by CrazyHorse »

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}
Herbert
alanq
Posts: 21
Joined: Mon Dec 28, 2009 3:03 am

How can I tell when I'm inside a footnote?

Post by alanq »

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
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How can I tell when I'm inside a footnote?

Post by localghost »

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
Post Reply