![](https://secure.gravatar.com/avatar/e5aa6984b53b8925e405ebbdbc051ad9.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/74d41c3215dcdd377343cdc47311757c.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/e5aa6984b53b8925e405ebbdbc051ad9.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/74d41c3215dcdd377343cdc47311757c.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/c5ae4f9aa0d3a9bd5376e92b322c3e50.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/e5aa6984b53b8925e405ebbdbc051ad9.jpg?s=120&d=mm&r=g)
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
participants (3)
-
Aditya Mahajan
-
Henning Hraban Ramm
-
Wolfgang Schuster