[NTG-context] Re: Can \note repeat its footnote?
Hans Hagen
ntg-context@ntg.nl
Fri Jun 25 18:25:48 CEST 2004
Stefan Wachter wrote:
> Hi Hans,
>
> thanks for your reply. Unfortunately your solution does not work
> correctly. The following example produces one footnote at the first
> page but no footnote on the second page.
>
> \starttext
>
> funny\myfootnote[funny]{funny} funny\mynote[funny]
> \page
> funny\mynote[funny] funny\mynote[funny]
>
> \stoptext
>
> --Stefan
>
> PS: Would it be possible to use the same footnote mark again when a
> footnote is repeated?
sure but this needs some thought (for instance clashing numbers/symbols)
\def\myfootnote[#1]#2% let's guess that #2 is without catcode problems
{\setgvalue{note:t:#1}%
{\setxvalue{note:l:#1}{\getvalue{note:n:#1}}%
\footnote[note:a:#1:\getvalue{note:l:#1}]{#2}}%
\setgvalue{note:n:#1}%
{1}%
\getvalue{note:t:#1}}%
\def\mynote[#1]%
{\removeunwantedspaces
\scratchcounter\getvalue{note:n:#1}\relax
\edef\NoteNumber{\the\scratchcounter}%
\doglobal\incrementvalue{note:n:#1}\relax
\doifreferencefoundelse{note:a:#1:1}
{\edef\NotePageA{\number\currentrealreference}%
\doifreferencefoundelse{note:a:#1:\getvalue{note:n:#1}}
{\edef\NotePageB{\number\currentrealreference}%
\doifreferencefoundelse{note:a:#1:\NoteNumber}
{\ifnum\currentrealreference=\NotePageB\relax
\pagereference[note:a:#1:\getvalue{note:n:#1}]%
\note[note:a:#1:\getvalue{note:l:#1}]%
\else\ifnum\NotePageA=\NotePageB\relax
\pagereference[note:a:#1:\getvalue{note:n:#1}]%
\note[note:a:#1:\getvalue{note:l:#1}]%
\else
\getvalue{note:t:#1}%
\fi\fi}
{\ifnum\NotePageA=\NotePageB\relax
\pagereference[note:a:#1:\getvalue{note:n:#1}]%
\note[note:a:#1:\getvalue{note:l:#1}]%
\else
\getvalue{note:t:#1}%
\fi}}
{\pagereference[note:a:#1:\getvalue{note:n:#1}]%
\note[note:a:#1:\getvalue{note:l:#1}]}}
{\pagereference[note:a:#1:\getvalue{note:n:#1}]%
\note[note:a:#1:\getvalue{note:l:#1}]}}
\starttext
% test \myfootnote[funny]{first occurence} test\mynote[funny]
% test \myfootnote[again]{first occurence} \page test \mynote[again]
funny \myfootnote[funny]{funny} funny \mynote[funny] \page
funny \mynote[funny] funny \mynote[funny] funny \mynote[funny] \page
funny \mynote[funny] funny \mynote[funny] \page
funny \mynote[funny] funny \mynote[funny] funny \mynote[funny] \page
\stoptext
More information about the ntg-context
mailing list