Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

1 Answer 1

up vote 7 down vote accepted

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

\startsetups testheader
\expanded{\doifsomethingelse{\fetchmark[section][first]}}
  {\getmarking[sectionnumber]\ \getmarking[section]}
  {\getmarking[chapternumber]\ \getmarking[chapter]}
\stopsetups

\setupheadertexts[][\setups{testheader}]
share|improve this answer
    
thanks! Not elegant, but it works great –  urso Jun 2 '11 at 15:29

Your Answer

 
discard

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.