ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* check if inside footnote
@ 2020-08-04  9:04 Henning Hraban Ramm
  2020-08-04 11:20 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Henning Hraban Ramm @ 2020-08-04  9:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi, me again...

Is there a check if a macro is called from inside of a footnote, like a system mode *footnote?
(Same with captions?)

In my current project, index entries should get italic page numbers if they occurr inside of a footnote (or a caption, but that is rare).
I’m using different shortcuts for both cases (that call \index with or without processor), but some paragraphs are very confusing (many long footnotes, or footnotes within footnotes), and I could avoid manually analyzing the structure if my macro could determine on its own if it’s called from a footnote.

Not-working example:


\setupinteraction[state=start]
\defineprocessor[kursiv][style=italicface]

\define[1]\Idx{\doifmodeelse{*footnote}{\index{#1}}{\index[kursiv->]{kursiv->#1}}#1}

\starttext

Text

---
\index[C]{A}{B}\footnote{Inside\index{FN}}\index{BF}
---

\placeregister[index][criterium=all]

\stoptext


This also shows the text-running-into-footnotes problem with both of my ConTeXt versions:
ConTeXt  ver: 2020.01.30 14:13 MKIV beta  fmt: 2020.4.12
ConTeXt  ver: 2020.07.27 16:30 LMTX  fmt: 2020.7.28


Hraban
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: check if inside footnote
  2020-08-04  9:04 check if inside footnote Henning Hraban Ramm
@ 2020-08-04 11:20 ` Hans Hagen
  2020-08-04 11:47   ` Henning Hraban Ramm
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2020-08-04 11:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Henning Hraban Ramm

On 8/4/2020 11:04 AM, Henning Hraban Ramm wrote:
> Hi, me again...
> 
> Is there a check if a macro is called from inside of a footnote, like a system mode *footnote?
> (Same with captions?)
> 
> In my current project, index entries should get italic page numbers if they occurr inside of a footnote (or a caption, but that is rare).
> I’m using different shortcuts for both cases (that call \index with or without processor), but some paragraphs are very confusing (many long footnotes, or footnotes within footnotes), and I could avoid manually analyzing the structure if my macro could determine on its own if it’s called from a footnote.
> 
> Not-working example:
> 
> 
> \setupinteraction[state=start]
> \defineprocessor[kursiv][style=italicface]
> 
> \define[1]\Idx{\doifmodeelse{*footnote}{\index{#1}}{\index[kursiv->]{kursiv->#1}}#1}
> 
> \starttext
> 
> Text
> 
> ---
> \index[C]{A}{B}\footnote{Inside\index{FN}}\index{BF}
> ---
> 
> \placeregister[index][criterium=all]
> 
> \stoptext
bad MWE ... took me more time to se that \Idx was not used than this:

\appendtoks
     \setsystemmode\currentnote
\to \everysynchronizenote

can you check if that works ok?

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: check if inside footnote
  2020-08-04 11:20 ` Hans Hagen
@ 2020-08-04 11:47   ` Henning Hraban Ramm
  2020-08-04 12:35     ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Henning Hraban Ramm @ 2020-08-04 11:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> Am 04.08.2020 um 13:20 schrieb Hans Hagen <j.hagen@xs4all.nl>:
> 
> On 8/4/2020 11:04 AM, Henning Hraban Ramm wrote:
>> Hi, me again...
>> Is there a check if a macro is called from inside of a footnote, like a system mode *footnote?
>> (Same with captions?)
>> In my current project, index entries should get italic page numbers if they occurr inside of a footnote (or a caption, but that is rare).
>> I’m using different shortcuts for both cases (that call \index with or without processor), but some paragraphs are very confusing (many long footnotes, or footnotes within footnotes), and I could avoid manually analyzing the structure if my macro could determine on its own if it’s called from a footnote.
>> Not-working example:
>> \setupinteraction[state=start]
>> \defineprocessor[kursiv][style=italicface]
>> \define[1]\Idx{\doifmodeelse{*footnote}{\index{#1}}{\index[kursiv->]{kursiv->#1}}#1}
>> \starttext
>> Text
>> ---
>> \index[C]{A}{B}\footnote{Inside\index{FN}}\index{BF}
>> ---
>> \placeregister[index][criterium=all]
>> \stoptext
> bad MWE ... took me more time to se that \Idx was not used than this:

Ouch, sorry! That means I didn’t even check if that mode existed before; I also swapped the if/else brackets.


> \appendtoks
>    \setsystemmode\currentnote
> \to \everysynchronizenote
> 
> can you check if that works ok?

Yes, that works. Thank you very much!

i.e. MWE =

\setupinteraction[state=start]
\defineprocessor[kursiv][style=italicface]

\define[1]\Idx{\doifmodeelse{*footnote}{\index[kursiv->]{kursiv->#1}}{\index{#1}}#1}

\appendtoks
   \setsystemmode\currentnote
\to \everysynchronizenote

\starttext

Text

---
\index[C]{A}{B}\footnote{Inside\Idx{FN}}\Idx{BF}
---

\placeregister[index][criterium=all]

\stoptext



Hraban
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: check if inside footnote
  2020-08-04 11:47   ` Henning Hraban Ramm
@ 2020-08-04 12:35     ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2020-08-04 12:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Henning Hraban Ramm

On 8/4/2020 1:47 PM, Henning Hraban Ramm wrote:
> 
>> Am 04.08.2020 um 13:20 schrieb Hans Hagen <j.hagen@xs4all.nl>:
>>
>> On 8/4/2020 11:04 AM, Henning Hraban Ramm wrote:
>>> Hi, me again...
>>> Is there a check if a macro is called from inside of a footnote, like a system mode *footnote?
>>> (Same with captions?)
>>> In my current project, index entries should get italic page numbers if they occurr inside of a footnote (or a caption, but that is rare).
>>> I’m using different shortcuts for both cases (that call \index with or without processor), but some paragraphs are very confusing (many long footnotes, or footnotes within footnotes), and I could avoid manually analyzing the structure if my macro could determine on its own if it’s called from a footnote.
>>> Not-working example:
>>> \setupinteraction[state=start]
>>> \defineprocessor[kursiv][style=italicface]
>>> \define[1]\Idx{\doifmodeelse{*footnote}{\index{#1}}{\index[kursiv->]{kursiv->#1}}#1}
>>> \starttext
>>> Text
>>> ---
>>> \index[C]{A}{B}\footnote{Inside\index{FN}}\index{BF}
>>> ---
>>> \placeregister[index][criterium=all]
>>> \stoptext
>> bad MWE ... took me more time to se that \Idx was not used than this:
> 
> Ouch, sorry! That means I didn’t even check if that mode existed before; I also swapped the if/else brackets.
> 
> 
>> \appendtoks
>>     \setsystemmode\currentnote
>> \to \everysynchronizenote
>>
>> can you check if that works ok?
> 
> Yes, that works. Thank you very much!
> 
> i.e. MWE =
> 
> \setupinteraction[state=start]
> \defineprocessor[kursiv][style=italicface]
> 
> \define[1]\Idx{\doifmodeelse{*footnote}{\index[kursiv->]{kursiv->#1}}{\index{#1}}#1}
> 
> \appendtoks
>     \setsystemmode\currentnote
> \to \everysynchronizenote

Ok, so when no one sees a problem I'll add it.

> \starttext
> 
> Text
> 
> ---
> \index[C]{A}{B}\footnote{Inside\Idx{FN}}\Idx{BF}
> ---
> 
> \placeregister[index][criterium=all]
> 
> \stoptext
> 
> 
> 
> Hraban
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
> 


-- 

-----------------------------------------------------------------
                                           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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-04 12:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-04  9:04 check if inside footnote Henning Hraban Ramm
2020-08-04 11:20 ` Hans Hagen
2020-08-04 11:47   ` Henning Hraban Ramm
2020-08-04 12:35     ` Hans Hagen

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).