noib3 via ntg-context schrieb am 17.08.2021 um 16:43:
I'm trying to create a new lecture environment starting from the base
section.
I'd like its title to be `Lecture <number>: <title>` if a title is
provided, and `Lecture <number>` if it isn't. This title should also be
reported in the left footer and in the table of contents.
This is the code I have so far:
[...]
Unfortunately none of them are reported correctly. The title in the body
is formatted simply as `Lecture`, the one in the left footer is
formatted as `Lecture<number><title>`, and the one in the table of
contents isn't affected at all.
Why do you need Lua to format the list entries and section titles?
\definehead
[lecture]
[section]
\define[1]\LectureTextCommand
{\doiftext{#1}{: #1}}
\setuphead
[lecture]
[bodypartlabel=lecture,
distance=0pt,
textcommand=\LectureTextCommand,
style=\bfc]
\setuplabeltext
[en]
[lecture={Lecture }]
\setupcombinedlist
[content]
[list={lecture}]
\define[3]\LectureListCommand
{\labeltext{lecture}#1\doiftext{#2}{: #2}\filler[dotfill]#3\par}
\setuplist
[lecture]
[alternative=command,
command=\LectureListCommand]
\startsetups [footer:left]
\labeltext{lecture} \getmarking[lecturenumber]
\doiftext{\getmarking[lecture]}{: \getmarking[lecture]}
\stopsetups
\setupfootertexts
[\directsetup{footer:left}] []
\starttext
\completecontent
\startlecture [title={Foo}]
Foo bar baz
\stoplecture
\page
\startlecture
Foo bar baz
\stoplecture
\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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________