0

I have a single footnote that appears once, with many references to it in a series of tables. What I have below is almost right:

\documentclass[12pt]{book}

\usepackage{ragged2e}         % For \RaggedRight
\usepackage[symbol]{footmisc} % Enable footnote symbols
\usepackage{array}            % Enable array environments

\begin{document}

\footnotetext[1]{One footnote text throughout.}

\begin{tabular}%
 {p{.15\linewidth}%
 >{\RaggedRight\hangindent=4em}p{.75\linewidth}
}

nighean & Thainig an nighean bu
shine dhiubhsan a bha beò an àite a h-athar gu 
seilbh air oighreachd Bhrathainn.\footnotemark[1] \\

bheatha & \quad~Bheir sinn fainear a nis mar a 
thainig crioch a bheatha air 
Coinneach\footnotemark[1] Odhar.\\

bhliadhna & Rugadh Fraing\footnotemark[1] Mac 
Coinnich so air a' bhliadhna 1764.~---\\

storach & \quad~Bha na ceithir tighearnan eile 
'nan comh-aoisibh do Mhac Coinnich, Sir
Eachann Ghearrloch, an tighearna storach, an 
Siosalach,\footnotemark[1] air an robh
milleadh maighich, tighearna Ghrannda bha 'na 
amadan, agus Mac-Gille-Challuim gagach. \\
\end{tabular}

\end{document}

But I would like that one footnote text to appear (once) on each page where any reference to it occurs, and not to appear at all on any page where there is no reference to it.

At the moment, if you modify the MWE so that the table repeats many times, the footnote text only appears on the first page. And the footnote text appears, even if there are no footnote marks in the document at all.

Here's the full page, without the table actually repeated:


Output of single page with only one table

  • BTW, the optional parameter for tabular is [t],[b] or [c] for top, bottom or center (baseline) and has to do with aligning boxes side by side. [h] is an optional parameter for table (a float). – John Kormylo Sep 2 '18 at 13:21
1

The problem isn't so much with tabular as with \parbox or p{}. See Why does parbox lose footnotes?.

I first created a solution to check for the first \footnotemark on each page and use \footnote instead. It uses a counter for the number of times \myfootnotemark is used on each page. You will need to create a new counter for every mark used.

For parboxes I created a wrapper environment to check for the first usage. It is a bit of a kludge, but everypage is too late. Also, I should allow a list of marks to be passed as an argument, but didn't want to put that much effort into it.

\documentclass{article}

\newcounter{footnote1}[page]% resets to 0 every page
\newcount{\savefoot}% reserve global value

\newcommand{\myfootnotetext}[2]% #1 = number, #2 = text
 {\expandafter\gdef\csname footnote#1\endcsname{#2}}

\newcommand{\myfootnotemark}[1]% #1 = number
 {\stepcounter{footnote#1}%
  \ifnum\value{footnote#1}=1
    \footnote[#1]{\csname footnote#1\endcsname}%
  \else
    \footnotemark[#1]%
  \fi}

\newenvironment{footcheck1}{\global\savefoot=\value{footnote1}}%
 {\ifnum\savefoot=0
    \ifnum\value{footnote1}>0
      \footnotetext[1]{\csname footnote1\endcsname}%
    \fi
  \fi}

\begin{document}

\myfootnotetext{1}{One footnote text throughout.}% can also be in preamble

\begin{footcheck1}
\begin{tabular}{p{\linewidth}}
first time.\myfootnotemark{1}\\
Second time.\myfootnotemark{1}
\end{tabular}
\end{footcheck1}
\newpage
\begin{footcheck1}
\begin{tabular}{p{\linewidth}}
Third time.\myfootnotemark{1}\\
Fourth time.\myfootnotemark{1}
\end{tabular}
\end{footcheck1}
\end{document}
  • That's very interesting about \parbox; I wouldn't have thought to look at that link. – brannerchinese Sep 2 '18 at 14:25
  • Works like a dream. I've expanded it for a second footnote mark, counter, and environment. Many thanks! – brannerchinese Sep 2 '18 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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