
Gibt es eine? (Ich möchte dies, weil ich das Indexformat erstellen möchte, 7 n.\,1
wenn sich mehr als eine Notiz auf der Seite befindet und 7\,n
…)
PS. Deutlicher ausgedrückt, wie gewünscht: Könnte man ein Makro definieren \fnnonthispage
, das die Anzahl der Fußnoten auf der aktuellen Seite zurückgibt? Ich weiß nicht, wie ich es deutlicher sagen soll.
PS II. So könnte das Makro verwendet werden. Auf der ersten Seite gibt es zwei Anmerkungen, daher sollte der Eintrag die Nummer angeben; auf Seite 2 gibt es jedoch nur eine, daher sollte die Nummer dort nicht angegeben werden. Wenn eine Seite eine teilweise Fußnote enthält, sollte diese auch als eine zählen.
%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}
Antwort1
Hier ist eine Lösung. Wir prüfen, ob auf jeder Ausgabeseite mehr als eine Fußnote vorhanden ist, wenn kein Makro \mtfnexiste<pagenumber>
definiert ist.
NotizDer obige Kommentar von John Kormylo ist wichtig, aber ich habe mich hier nicht um den Punkt gekümmert. Lassen Sie es mich wissen.
\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}
AktualisierenBeispiel für eine lange Fußnote: Es handelt sich um die zweite Fußnote auf der ersten Seite, das indizierte Wort befindet sich jedoch auf der zweiten Seite und enthält nur eine Fußnote. Darin liegt also das Problem.
\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}