* [NTG-context] chapter counter?
@ 2024-08-26 15:41 Henning Hraban Ramm
2024-08-26 15:57 ` [NTG-context] " Wolfgang Schuster
2024-08-26 15:58 ` Aditya Mahajan
0 siblings, 2 replies; 6+ messages in thread
From: Henning Hraban Ramm @ 2024-08-26 15:41 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi,
I’d like to check the chapter number like
\ifodd\rawcountervalue[chapter]
What an odd chapter!
\fi
but apparently the counter isn’t called "chapter", or I’m doing it wrong
otherwise.
Could you enlighten me?
Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* [NTG-context] Re: chapter counter?
2024-08-26 15:41 [NTG-context] chapter counter? Henning Hraban Ramm
@ 2024-08-26 15:57 ` Wolfgang Schuster
2024-08-26 18:14 ` Henning Hraban Ramm
2024-08-26 15:58 ` Aditya Mahajan
1 sibling, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2024-08-26 15:57 UTC (permalink / raw)
To: mailing list for ConTeXt users, Henning Hraban Ramm
Henning Hraban Ramm schrieb am 26.08.2024 um 17:41:
> Hi,
> I’d like to check the chapter number like
>
> \ifodd\rawcountervalue[chapter]
> What an odd chapter!
> \fi
>
> but apparently the counter isn’t called "chapter", or I’m doing it wrong
> otherwise.
> Could you enlighten me?
\namedheadnumber{chapter}
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* [NTG-context] Re: chapter counter?
2024-08-26 15:41 [NTG-context] chapter counter? Henning Hraban Ramm
2024-08-26 15:57 ` [NTG-context] " Wolfgang Schuster
@ 2024-08-26 15:58 ` Aditya Mahajan
2024-08-26 18:15 ` Henning Hraban Ramm
1 sibling, 1 reply; 6+ messages in thread
From: Aditya Mahajan @ 2024-08-26 15:58 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1: Type: text/plain, Size: 862 bytes --]
On Mon, 26 Aug 2024, Henning Hraban Ramm wrote:
> Hi,
> I’d like to check the chapter number like
>
> \ifodd\rawcountervalue[chapter]
> What an odd chapter!
> \fi
>
> but apparently the counter isn’t called "chapter", or I’m doing it wrong
> otherwise.
> Could you enlighten me?
You need: \somenamedheadnumber{chapter}{current}
\starttext
\startsection[title=First]
This is: \somenamedheadnumber{section}{current}
\ifodd\somenamedheadnumber{section}{current}\relax
This is odd
\else
This is even
\fi
\stopsection
\startsection[title=Second]
This is: \somenamedheadnumber{section}{current}
\ifodd\somenamedheadnumber{section}{current}\relax
This is odd
\else
This is even
\fi
\stopsection
\stoptext
Aditya
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* [NTG-context] Re: chapter counter?
2024-08-26 15:57 ` [NTG-context] " Wolfgang Schuster
@ 2024-08-26 18:14 ` Henning Hraban Ramm
2024-08-26 18:30 ` Wolfgang Schuster
0 siblings, 1 reply; 6+ messages in thread
From: Henning Hraban Ramm @ 2024-08-26 18:14 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 26.08.24 um 17:57 schrieb Wolfgang Schuster:
> Henning Hraban Ramm schrieb am 26.08.2024 um 17:41:
>> Hi,
>> I’d like to check the chapter number like
>>
>> \ifodd\rawcountervalue[chapter]
>> What an odd chapter!
>> \fi
>>
>> but apparently the counter isn’t called "chapter", or I’m doing it
>> wrong otherwise.
>> Could you enlighten me?
>
> \namedheadnumber{chapter}
Thank you, but it doesn’t work in my setup where I’m trying to change a
background image depending on the chapter number:
\defineoverlay[BG][\start
\ifodd\namedheadnumber{chapter}\relax
\externalfigure[bgimage][height=\overlayheight]
\else
\mirror{\externalfigure[bgimage][height=\overlayheight]}
\fi
\stop]
This is then used with
\setlayerframed[papier][background=BG]
I guess it’s expanded only once.
But it was a bad idea anyway, I wanted more than two variants and now
just set them as a uservariable.
Sorry for the effort.
Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* [NTG-context] Re: chapter counter?
2024-08-26 15:58 ` Aditya Mahajan
@ 2024-08-26 18:15 ` Henning Hraban Ramm
0 siblings, 0 replies; 6+ messages in thread
From: Henning Hraban Ramm @ 2024-08-26 18:15 UTC (permalink / raw)
To: ntg-context
Am 26.08.24 um 17:58 schrieb Aditya Mahajan:
> On Mon, 26 Aug 2024, Henning Hraban Ramm wrote:
>
>> Hi,
>> I’d like to check the chapter number like
>>
>> \ifodd\rawcountervalue[chapter]
>> What an odd chapter!
>> \fi
>>
>> but apparently the counter isn’t called "chapter", or I’m doing it wrong
>> otherwise.
>> Could you enlighten me?
>
> You need: \somenamedheadnumber{chapter}{current}
Thank you, esp. for the effort!
See my other mail – expansion got into my way, and I found a different
solution.
Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* [NTG-context] Re: chapter counter?
2024-08-26 18:14 ` Henning Hraban Ramm
@ 2024-08-26 18:30 ` Wolfgang Schuster
0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2024-08-26 18:30 UTC (permalink / raw)
To: mailing list for ConTeXt users, Henning Hraban Ramm
Henning Hraban Ramm schrieb am 26.08.2024 um 20:14:
> Am 26.08.24 um 17:57 schrieb Wolfgang Schuster:
>> Henning Hraban Ramm schrieb am 26.08.2024 um 17:41:
>>> Hi,
>>> I’d like to check the chapter number like
>>>
>>> \ifodd\rawcountervalue[chapter]
>>> What an odd chapter!
>>> \fi
>>>
>>> but apparently the counter isn’t called "chapter", or I’m doing it
>>> wrong otherwise.
>>> Could you enlighten me?
>>
>> \namedheadnumber{chapter}
>
> Thank you, but it doesn’t work in my setup where I’m trying to change a
> background image depending on the chapter number:
>
> \defineoverlay[BG][\start
> \ifodd\namedheadnumber{chapter}\relax
> \externalfigure[bgimage][height=\overlayheight]
> \else
> \mirror{\externalfigure[bgimage][height=\overlayheight]}
> \fi
> \stop]
>
> This is then used with
>
> \setlayerframed[papier][background=BG]
>
> I guess it’s expanded only once.
>
> But it was a bad idea anyway, I wanted more than two variants and now
> just set them as a uservariable.
Without more information there is no way to provide a solution but for
the archive there is below a solution to get mirrored images for even
chapters. The background has also a check an image before the start of
the first chapter.
\setupexternalfigure[location=default]
\defineoverlay
[BackGround]
[\ifzeronum\namedheadnumber{chapter}\relax
%
\orelse\ifodd\namedheadnumber{chapter}\relax
\externalfigure[mill][factor=min]%
\else
\mirror{\externalfigure[mill][factor=min]}%
\fi]
\setupbackgrounds[page][background=BackGround]
\starttext
FooBar
\chapter{Foo}
\chapter{Bar}
\stoptext
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-08-26 18:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-26 15:41 [NTG-context] chapter counter? Henning Hraban Ramm
2024-08-26 15:57 ` [NTG-context] " Wolfgang Schuster
2024-08-26 18:14 ` Henning Hraban Ramm
2024-08-26 18:30 ` Wolfgang Schuster
2024-08-26 15:58 ` Aditya Mahajan
2024-08-26 18:15 ` Henning Hraban Ramm
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).