[NTG-context] conditional formatting, checking the context (SOLVED)

Henning Hraban Ramm texml at fiee.net
Fri Mar 5 12:06:34 CET 2021


in the example below I’m using a custom highlighting macro in titles.

Now I don’t want this highlighting in the ToC or in bookmarks (in my real world example the changes affect bookmarks, not in the MWE).

I know I can use the list= and bookmark= keys of \startchapter, but since the text is always the same for all, I’d like to check within the \SPECIAL macro if we’re within the chapter title or within a list or bookmarks.

In preparing the MWE and this message I found a solution with the *chapter system mode.

Wanted to share anyway ;)


\define[1]\SPECIAL{\doifmodeelse{*chapter}{{\bf #1}}{#1}}



\startchapter[title={This \SPECIAL{and} That}]

\input knuth


\startchapter[title={Something \SPECIAL{Other}}]

\input tufte




More information about the ntg-context mailing list