¿Una forma de obtener el número de notas a pie de página en la página actual?

¿Una forma de obtener el número de notas a pie de página en la página actual?

¿Hay uno? (Quiero esto porque quiero crear el formato de índice 7 n.\,1si hay más de una nota en la página y 7\,n.

PD. Dicho más claramente, según lo solicitado: ¿se podría definir una macro \fnnonthispageque devolviera el número de notas a pie de página en la página actual? No sé cómo decirlo más claramente.

PD II. Así es como se podría utilizar la macro. En la primera página hay dos notas, por lo que la entrada debe especificar el número; pero de p. 2, solo hay uno, por lo que no se debe especificar el número. Si una página contiene una nota a pie de página parcial, también debería contar como una.

%compile with: pdflatex file; makeindex file; pdflatex file
\documentclass{article}
\usepackage{imakeidx}
\usepackage{hyperref}
\usepackage{letltxmacro}

\makeindex

% \see{} inserts a see in the next entry, after the pp. 
\def\seeentry{}
% must be global to work within footnote
\def\see#1{\gdef\seeentry{#1}} 
\def\seesep{;\space}
\def\seetext{see\space}

% \index{<entry>|fn} marks the ref. as to a note
\def\fn#1#2{% insert see if \seeentry is not empty
\hyperpage{#2} n.\,#1\ifx\seeentry\empty\else\seesep\seetext\seeentry\def\seeentry{}\fi%
% ----- here is how the desired macro could be used:
%\hyperpage{#2}%
%\ifnum\fnnonthispage>1
%\space n.\,#1\ifx\seeentry\empty\else\seesep\seetext\seeentry\def\seeentry{}\fi%
%\else
%\,n.\ifx\seeentry\empty\else\seesep\seetext\seeentry\def\seeentry{}\fi%
%\fi
}%

% Redefining \index to mark reff. to notes as such.
\LetLtxMacro{\oldindex}{\index}
\renewcommand{\index}[1]{%
\if@noftnote%
\oldindex{#1}%
\else%
\oldindex{#1|fn{\number\value{footnote}}}
\fi%
}

\begin{document}
Cheese.\footnote{\index{cake}cake.}
Whether it be cheese or not.\footnote{What?}
\newpage
Oranges are called Chinese apples in German.\footnote{And in
Danish, of course.\index{Danish}}
\printindex
\end{document}

Respuesta1

Aquí hay una solución. Comprobamos si hay más de una nota al pie en cada página de salida, si no \mtfnexiste<pagenumber>hay una macro definida.

NotaEl comentario anterior de John Kormylo es importante, pero no me preocupé del punto aquí. Hágamelo saber.

\documentclass{article}
\usepackage{imakeidx}
\usepackage{hyperref}
\usepackage{letltxmacro}

\makeindex

% \see{} inserts a see in the next entry, after the pp. 
\def\seeentry{}
% must be global to work within footnote
\def\see#1{\gdef\seeentry{#1}} 
\def\seesep{;\space}
\def\seetext{see\space}

% \index{<entry>|fn} marks the ref. as to a note

\newcounter{mtfn}
\setcounter{mtfn}{1}
\makeatletter
\patchcmd\@outputpage{\stepcounter{page}}{%
\ifnum\value{mtfn}<\value{footnote}
\expandafter\gdef\csname mtfnexiste\thepage\endcsname{x}\fi
\setcounter{mtfn}{\value{footnote}}\stepcounter{mtfn}%
\stepcounter{page}}{}{\errmessage{no}}


\def\fn#1#2{% insert see if \seeentry is not empty
\hyperpage{#2}%
\expandafter\ifx\csname mtfnexiste\@secondoftwo#2\endcsname\relax
\,n.\ifx\seeentry\empty\else\seesep\seetext\seeentry\def\seeentry{}\fi%
\else
\space n.\,#1\ifx\seeentry\empty\else\seesep\seetext\seeentry\def\seeentry{}\fi%
\fi
}%
\makeatother

% Redefining \index to mark reff. to notes as such.
\LetLtxMacro{\oldindex}{\index}
\renewcommand{\index}[1]{%
\if@noftnote%
\oldindex{#1}%
\else%
\oldindex{#1|fn{\number\value{footnote}}}
\fi%
}

\begin{document}
Cheese.\footnote{\index{cake}cake.}
Whether it be cheese or not.\footnote{What?}
\newpage
Oranges are called Chinese apples in German.\footnote{And in
Danish, of course.\index{Danish}}
\printindex
\end{document}

ActualizarEjemplo de nota al pie larga: es la segunda nota al pie de la primera página, pero la palabra indexada está en la segunda página con solo una nota al pie, ¡así que el problema!

\documentclass{article}
\usepackage{imakeidx}
\usepackage{hyperref}
\usepackage{letltxmacro}
\usepackage{lipsum}

\makeindex

% \see{} inserts a see in the next entry, after the pp. 
\def\seeentry{}
% must be global to work within footnote
\def\see#1{\gdef\seeentry{#1}} 
\def\seesep{;\space}
\def\seetext{see\space}

% \index{<entry>|fn} marks the ref. as to a note

\newcounter{mtfn}
\setcounter{mtfn}{1}
\makeatletter
\patchcmd\@outputpage{\stepcounter{page}}{%
\ifnum\value{mtfn}<\value{footnote}
\expandafter\gdef\csname mtfnexiste\thepage\endcsname{x}\fi
\setcounter{mtfn}{\value{footnote}}\stepcounter{mtfn}%
\stepcounter{page}}{}{\errmessage{no}}


\def\fn#1#2{% insert see if \seeentry is not empty
\hyperpage{#2}%
\expandafter\ifx\csname mtfnexiste\@secondoftwo#2\endcsname\relax
\,n.\ifx\seeentry\empty\else\seesep\seetext\seeentry\def\seeentry{}\fi%
\else
\space n.\,#1\ifx\seeentry\empty\else\seesep\seetext\seeentry\def\seeentry{}\fi%
\fi
}%
\makeatother

% Redefining \index to mark reff. to notes as such.
\LetLtxMacro{\oldindex}{\index}
\renewcommand{\index}[1]{%
\if@noftnote%
\oldindex{#1}%
\else%
\oldindex{#1|fn{\number\value{footnote}}}
\fi%
}

\begin{document}
\lipsum[1-2]
\footnote{bla bla}
\lipsum[1-2]
\footnote{very very long long footnote
very very long long footnote very very long long footnote
very very long long footnote very very long long footnote
very very long long footnote very very long long footnote
very very long long footnote very very long long footnote
very very long long footnote very very long long footnote
very very long long footnote very very long long footnote
very very long long footnote very very long long footnote
very very long long footnote very very long long footnote
very very long long footnote very very long long footnote
very very long long footnote very very long long footnote
cake\index{cake}}
\lipsum[1-2]
\footnote{last bla bla}
\printindex
\end{document}

información relacionada