GeneralFootnote question

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
spkmn
Posts: 4
Joined: Wed Jan 28, 2009 3:31 pm

Footnote question

Post by spkmn »

Hi all,

For one of my documents, whenever I use a 'special term' I have to index it and footnote it... every time. Easy enough with a macro. However, a special term may appear several times on one page. It doesn't look very nice to have footnotes on a single page that all refer to the same section.

Is there a way to suppress footnotes so only the unique ones are shown? So the first special term on a page would be footnote 1, and every other use of it would be footnote 1, the second special term on that page would be footnote 2, etc.

Thanks in advance
James

Recommended reading 2024:

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

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

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Footnote question

Post by phi »

Here is an example that you might find useful:

Code: Select all

\documentclass{article}

\usepackage{makeidx}
\usepackage{etoolbox}

\newrobustcmd*\newterm[3][]{%
	\edef\x{\ifstrempty{#1}{#2}{#1}}%
	\protected\csedef{term.\x.name}{#2}%
	\protected\csedef{term.\x.desc}{#3}%
}

\newrobustcmd*\term[1]{%
	\ifcsdef{term.#1.name}{%
		\letcs\x{term.#1.name}%
		\x\expandafter\index\expandafter{\x}%
		\ifcsdef{term.#1.note}{%
			\footnotemark[\csuse{term.#1.note}]%
		}{%
			\footnotemark\footnotetext{\csuse{term.#1.desc}}%
			\csedef{term.#1.note}{\thefootnote}%
		}%
	}{%
		\PackageWarning{xyz}{Term `#1' not defined}%
		#1%
	}%
}

\makeindex


\begin{document}

\newterm{A}{Description of A}
\newterm{B}{Description of B}

\term{A} \term{A} \term{B} \term{A} \term{B}

\printindex

\end{document}
Post Reply