From: Henning Hraban Ramm <texml@fiee.net>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: conditional formatting, checking the context (SOLVED)
Date: Fri, 5 Mar 2021 12:06:34 +0100 [thread overview]
Message-ID: <1244DBFA-05FD-4C98-B93F-77BF1AB2005C@fiee.net> (raw)
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
___________________________________________________________________________________
next reply other threads:[~2021-03-05 11:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-05 11:06 Henning Hraban Ramm [this message]
2021-03-06 12:46 ` Pablo Rodriguez
2021-03-06 13:35 ` Henning Hraban Ramm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1244DBFA-05FD-4C98-B93F-77BF1AB2005C@fiee.net \
--to=texml@fiee.net \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).