ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: Re: Can \note repeat its footnote?
Date: Fri, 25 Jun 2004 19:25:48 +0200	[thread overview]
Message-ID: <40DC601C.7010107@wxs.nl> (raw)
In-Reply-To: <40D98CFD.5080308@gmx.de>

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

  reply	other threads:[~2004-06-25 17:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-17 13:01 Stefan Wachter
2004-06-18 17:23 ` Peter Münster
2004-06-21 17:45 ` Hans Hagen
2004-06-23 14:00   ` Stefan Wachter
2004-06-25 17:25     ` Hans Hagen [this message]
2004-06-30 16:02       ` Stefan Wachter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40DC601C.7010107@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).