Hi Hraban !
Would this approach be better for solving your problem: why not define
the headers *once*
and *only* worry about setting the marks? At the beginning of each
chapter, the section mark is explicitly set to "*reset*".
% ---MWE (only setup marking and setup headers) --------
% On s'assure que chapitre/section produisent bien des marks exploitables.
\setupmarking[chapter][state=start]
\setupmarking[section][state=start]
% Fallback : si le mark de section est vide, on affiche "?"
\def\SectionOrQuestion{%
\doifelseempty{\getmarking[section]}{?}{\getmarking[section]}%
}
% --- Headers-------------------------------------------------
% Page paire (gauche) : chapitre | numéro
% Page impaire (droite): numéro | section (ou ?)
\setupheadertexts
[\getmarking[chapter]][\pagenumber]
[\pagenumber][\SectionOrQuestion]
% --- Chapters ------------------------------------------
% Point clé : au début de chaque chapitre, on "vide" la section,
% pour éviter la rémanence de la dernière section du chapitre précédent.
% Key point: at the beginning of each chapter, the section is “cleared”
% to avoid any lingering effects from the last section of the previous
chapter.
\setuphead[chapter][
page=leftempty,
before={\resetmarking[section]},
]
Then : re-set only marks instead of headers. What do you think ?
Best//JP
Le 26/12/2025 à 16:39, Hraban Ramm a écrit :
Hi, I found a solution for this problem, but I think it’s ugly,
because I re-setup the header texts all the time. Is there a better
(more elegant…) way?
Hraban
"""
\usemodule[visual]
\setuppagenumbering[alternative=doublesided,location=,]
\setupheadertexts[chapter][pagenumber][pagenumber][?] % completely
empty left page: \definepagebreak[leftempty][yes,header,footer,right]
\setuphead[chapter][ page=leftempty,
before={\setupheadertexts[chapter][pagenumber][pagenumber][?]},
aftersection={\setupheadertexts[END][pagenumber][pagenumber][END]}, ]
\starttext \dorecurse{5}{ \startchapter[title={\fakewords{2}{5}}]
\dorecurse{7}{\fakewords{50}{300}\par} \stopchapter } \stoptext
"""
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist :[email protected]
/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
___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] /
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
___________________________________________________________________________________