ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	"Thomas A. Schmitz" <thomas.schmitz@uni-bonn.de>
Subject: Re: register entries in footnotes
Date: Sun, 26 Apr 2020 19:43:02 +0200	[thread overview]
Message-ID: <ba7716ce-9ed7-158e-6078-d449ddb5e46e@xs4all.nl> (raw)
In-Reply-To: <375ef14d-1ea7-8d10-8ba1-3fee6fa486f3@uni-bonn.de>

On 4/26/2020 4:35 PM, Thomas A. Schmitz wrote:
> A similar question has been asked three years ago, and Rik Kabel posted 
> a partial solution, adapted here:
> 
> \defineprocessor [Footnote] [right={ n}]
> 
> \define[1]
>    \fnindex{\index[Footnote->]{#1}}
> 
> \starttext
> 
> This is a sentence with a term in the index: cat\index{cat}. This 
> sentence also has an indexed term, dog\index{dog}, as well as a 
> footnote.\footnote{The footnote also contains an indexed term, 
> mouse.\fnindex{mouse}}
> 
> \page
> 
> \placeregister [index]
> 
> \stoptext
> 
> And about a year ago, Hans made a different suggestion to my own 
> question; however, I didn't realize then that it was not what I was 
> looking for:
> 
> \starttext
> 
>            Test1: \index{cat}cat.
> \footnote{Test2: \index{mouse}mouse.}
> \footnote[note:cat]{Test3: \index[cat]{cat in \in{note}[note:cat]}cat.}
> 
> \page
> 
> \placeregister [index]
> \stoptext
> 
> This creates two index entries for cat, which is not the intended result.
> 
> My questions are:
> 
> 1. I would like to have the footnote number appear in the index, so it 
> says something like "cat 1 n. 1." Is that possible?
> 
> 2. Is it necessary to define an extra command for index entries in 
> footnotes? Is context clever enough to know that it's processing a 
> footnote, so one could write a condition such as (pseudocode):
> 
> \define [1]
>    \myindex
>    {\infinfootnoteelse
>      {\index[Footnote]->{#1}}
>      {\index{#1}}}
> 
> Thanks a lot, have a good Sunday!
You probably know intuitively that there is an answer, don't you?

\unexpanded\def\doifelseinnote
   {\ifconditional\processingnote
      \expandafter\firstoftwoarguments
    \else
      \expandafter\secondoftwoarguments
    \fi}

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

      reply	other threads:[~2020-04-26 17:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26 14:35 Thomas A. Schmitz
2020-04-26 17:43 ` Hans Hagen [this message]

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=ba7716ce-9ed7-158e-6078-d449ddb5e46e@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=ntg-context@ntg.nl \
    --cc=thomas.schmitz@uni-bonn.de \
    /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).