ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* conditional formatting, checking the context (SOLVED)
@ 2021-03-05 11:06 Henning Hraban Ramm
  2021-03-06 12:46 ` Pablo Rodriguez
  0 siblings, 1 reply; 3+ messages in thread
From: Henning Hraban Ramm @ 2021-03-05 11:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-06 13:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 11:06 conditional formatting, checking the context (SOLVED) Henning Hraban Ramm
2021-03-06 12:46 ` Pablo Rodriguez
2021-03-06 13:35   ` Henning Hraban Ramm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).