conditional formatting, checking the context (SOLVED)
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
On 3/5/21 12:06 PM, Henning Hraban Ramm wrote:
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). Sorry for the delayed reply, Hraban.
If only bookmarks are affected, you only have to preroll them: \enabledirectives[references.bookmarks.preroll] \setupinteraction[state=start] \placebookmarks[chapter,title] \starttext \chapter{This {\bf and} That} \stoptext And this is only required in MkIV, LMTX does it automagically. Just in case it helps, Pablo -- http://www.ousia.tk
Am 06.03.2021 um 13:46 schrieb Pablo Rodriguez
: Sorry for the delayed reply, Hraban.
Thank you, but there was no need to reply.
If only bookmarks are affected, you only have to preroll them:
\enabledirectives[references.bookmarks.preroll]
Thank you, I knew that. But my highlighting macro inserted some font stuff that messed up the bookmarks, so I really needed that conditional in my macro. Hraban
participants (2)
-
Henning Hraban Ramm
-
Pablo Rodriguez