Am 20.02.2014 um 23:09 schrieb Pablo Rodriguez <oi...@gmx.es>: > On 02/20/2014 09:39 PM, Wolfgang Schuster wrote: >> Am 20.02.2014 um 21:12 schrieb Pablo Rodriguez: >>> [...] >>> How can I make the first conditional work? >> >> You can’t, markings are only reliable when you use them in the >> header of footer of the page. >> >> To access the values of a heading you can use the \structurevariable >> and \namedstructurevariable commands. > > Many thanks for your reply, Wolfgang. > > My question was about headers, but I didn’t mention it to make a shorter > sample.
In this case this was a important part for the solution because it makes a difference when you use \getmarking in \setupheadertexts or in the text. > The code now is the following: > > \setupheadertexts[\hfill\namedstructurevariable{chapter}{title}\hfill] > [] [] > [\hfill\doifsomethingelse{\namedstructurevariable{section}{title}} > {\namedstructurevariable{section}{title}} > {\namedstructurevariable{chapter}{title}}\hfill] > > > Only a minor detail: is there a more proper way to center both headings? You can use the simple version of \setupheadertexts and use \doifoddpageelse to check whether you’re on a left or right page. When you make a test for content of a \getmarking command you have to use \doiftext because the \doifempty etc. checks don’t work in this case. \startsetups[header] \doifoddpageelse { \getmarking[chapter] } { \doiftextelse { \getmarking[section] } { \getmarking[section] } { \getmarking[chapter] } } \stopsetups \setupheadertexts[\directsetup{header}] \setupfootertexts[pagenumber] \starttext \chapter{Chapter A} \page \chapter{Chapter B} \page \dorecurse{5} {\chapter{Chapter #1} \dorecurse{10} {\section{Section #1.##1} \dorecurse{3}{\input knuth\par}}} \stoptext Wolfgang ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________