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

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

Hi,

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 ;)

Hraban

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

\setupinteraction[state=start]
\placebookmarks[chapter,title]

\starttext

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

\input knuth

\stopchapter

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

\input tufte

\stopchapter

\completecontent[criterium=all]

\stoptext