[NTG-context] Placing a section ending depending on odd/even sectionnumber
Wolfgang Schuster
wolfgang.schuster.lists at gmail.com
Tue Aug 4 19:46:36 CEST 2020
Willi Egger schrieb am 04.08.2020 um 18:56:
> Hi,
>
> now I have another hurdle to be taken :-) — Depending on the odd or even number of the section I have to place an ornament at the end of the section.
>
> I have sofar the following setup:
>
> [...]
>
> However the the evaluation of the sectionnumber results always in “false”, having therefore always odd as a sectionending.
You have two problem:
1. To get the current value for \currentheadnumber you have use
\determineheadnumber[section] before you use it but the example below
shows a better method.
2. What you do with \doifelse{...}{even} is to compare the numeric value
of the section with the string "even" which is always false. To check
whether the value is odd or even you have to use the \ifodd command.
> What to change in order to get the desired result?
%%%% begin example
\startsetups [section:odd]
\vfill
\bold {End of odd numbered section}
\stopsetups
\startsetups [section:even]
\vfill
\bold {End of even numbered section}
\stopsetups
\startsetups [section:end]
\ifodd\namedheadnumber{section}
\directsetup{section:odd}
\else
\directsetup{section:even}
\fi
\stopsetups
\setuphead
[section]
[aftersection=\directsetup{section:end}]
\starttext
\startsection[title=Ward]
\input ward
\stopsection
\page
\startsection[title=Knuth]
\input knuth
\stopsection
\stoptext
%%%% end example
Wolfgang
More information about the ntg-context
mailing list