TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've found this command:

\setupheadertexts[][{\getmarking[sectionnumber]\ \getmarking[section]}]

to show the current section in the header. But how can I show either the current chapter or the current section in the header depending on the fact the current page already belongs to a section or not?

share|improve this question
up vote 8 down vote accepted

I do not know an elegant solution, but this works ok (thanks to the wiki at contextgarden):

\startsetups testheader
  {\getmarking[sectionnumber]\ \getmarking[section]}
  {\getmarking[chapternumber]\ \getmarking[chapter]}

share|improve this answer
thanks! Not elegant, but it works great – urso Jun 2 '11 at 15:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.