Mrhnhrm wrote:
- Although the perpage package is used, it doesn't reset the footnote counter between minipages. Whereas I would like a separate footnote counter in each minipage.
Well, both
{minipage}
s are on the same page here. Personally, I'd find it rather disorienting to find the same footnotemarks on one and the same page referring to different things. But if you really have to, you could reset the footnote counter between the
{figure}
and
{table}
environments in this case.
Mrhnhrm wrote:
- Although the footnote markers are placed with correctly ordered indices, the actual footnote explanations in the end of the minipage all have the same index (to be specific, the last assigned within the minipage in question, see attachment). If \setcounter{footnote}{0} is used before the \footnotetext statements, then the footnote explanation have empty indices [].
That's because the
\footnotemark
command increments the footnote counter, whereas the
\footnotetext
command leaves it unchanged. For a single
\footnotemark
/
\footnotetext
pair, the mechanism works as expected. As soon as you have more than one
\footnotemark
`in a row', you need to subtract n-1 from the footnote counter before the following
\footnotetext
command, and
\stepcounter{footnote}
before any consecutive
\footnotetext
command.
BTW:
Mrhnhrm wrote:Code: Select all
\caption{Example figure\protect\footnotemark. Lorem ipsum\protect\footnotemark.}
isn't a good idea---you'll see that when adding the list of figures, where you'll have the same footnote marks, but no fitting footnote texts. Better use
\caption
's optional argument (same text without the footnote marks). Guess what, with the optional argument in place you no longer need to protect the footnote marks.
Nevertheless, I let my thoughts churn on the problem a bit...
Code: Select all
\documentclass{article}
\usepackage{perpage} %the perpage package
\MakePerPage{footnote} %the perpage package command
\renewcommand{\thefootnote}{[\alph{footnote}]}
\let\thempfootnote\thefootnote
\makeatletter
\newcommand*\FNXWarning[1]{% derived from \PackageWarning, hence the \@spaces
\GenericWarning{%
(FN experiment)\@spaces\@spaces%\@spaces\@spaces
}{%
Footnote Experiment Warning: #1%
}%
}
\makeatother
\newcounter{markedfootnotes}
\newif\iffnadjneeded
\newcommand*\xfootnotemark{% the `x' means `experimental' here
\iffnadjneeded
% before the first *text was called
\else
% this is the first *mark (or previous *marks have seen at least one *text)
\ifnum\value{markedfootnotes}>0
\FNXWarning{\themarkedfootnotes\space missing text detected.\MessageBreak
Maybe \string\footnotetext\space instead of \string\xfootnotetext\space was used?\MessageBreak
Expect weird numbering of footnotes}%
\fi
\global\fnadjneededtrue
\fi
\stepcounter{markedfootnotes}%
\footnotemark
}
\newcommand*\xfootnotetext{% the text argument will be picked up by \footnotetext later
\ifnum\value{markedfootnotes}<1
\FNXWarning{Footnotetext without preceding mark detected}%
\else
\iffnadjneeded
\addtocounter{footnote}{-\value{markedfootnotes}}%
\global\fnadjneededfalse
\fi
\addtocounter{markedfootnotes}{-1}%
\stepcounter{footnote}%
\fi
\footnotetext
}
\AtEndDocument{%
\ifnum\value{markedfootnotes}>0
\FNXWarning{There appear to be \themarkedfootnotes\space more footnotemark(s) than texts...}%
\fi
}
\begin{document}
\listoffigures
\begin{table}[!h]
\caption{Example table}
\begin{minipage}[t]{1\textwidth}
\begin{tabular}{|c|c|}
\hline
tl \xfootnotemark & tr \\
\hline
bl & br \xfootnotemark \\
\hline
\end{tabular}
\xfootnotetext{top left}
\xfootnotetext{bottom right}
\end{minipage}
\end{table}
\begin{figure}[!h]
\begin{minipage}[t]{1\textwidth}
*placeholder for image*
\caption[Example figure. Lorem ipsum.]% entry in LOF without footnote marks
{Example figure\xfootnotemark. Lorem ipsum\xfootnotemark.}
\xfootnotetext{first sentence}
\xfootnotetext{second sentence}
\end{minipage}
\end{figure}
\end{document}
If I coded this right, you should see a warning in the log file, if the number of
\xfootnotetext
commands doesn't match the number of the preceeding
\xfootnotemark
commands.
Just don't mix
\xfootnotemark
/
\xfootnotetext
with
\footnotemark
/
\footnotetext
here.
KR
Rainer