General ⇒ Footnote question
Footnote question
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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Footnote question
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}