![](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