[NTG-context] conditional evaluation and section names

Daniel Lyons fusion at storytotell.org
Tue Feb 15 19:53:00 CET 2011


On Tue, Feb 15, 2011 at 07:12:51PM +0100, Wolfgang Schuster wrote:
> > 2. If I'm in a chapter that doesn't have sections, I'd like the chapter name to show up instead (without the §).
> > 
> > I'm not sure at all how to go about doing this. I suspect the answer is to use plain TeX but I don't understand TeX's conditional system well enough to figure out how to make it work (nor ConTeXt's marking system). If anyone can help, I'd greatly appreciate it!
> 
> Make a *complete* minimal example!

OK, for #2:


\startsetups[sectioninfo]
§ \getmarking[sectionnumber]
\stopsetups

\setupheadertexts[\setups{sectioninfo}]

\starttext
\chapter{One}
\input knuth
\stoptext


This will give me a § in the header even on the first page. I'd like
to conditionally not show the § if there's no content in
\getmarking[sectionnumber]. 

I realize this is probably a basic TeX programming thing, but I
haven't yet found a resource that explains TeX as a programming
language. If you know of one, please refer me to it; I'm not trying to
waste anyone's time.

I'll cook up a minimal example of the other thing later today. It's
probably a mistake in my environment, since using the code above does
not have the problem.

Thanks again,

-- 
Daniel


More information about the ntg-context mailing list