2

Suppose I have a document like this, in ConTeXt:

\define[1]\mymacro{{\it #1}}
\starttext
    This is some text. There are some key words in this text,
    but I need the code to automatically find
    and treat it as if `\mymacro{}` was
    written around it.
\stoptext

Given a list of words, is there a way to have ConTeXt mark those words, such that \mymacro{} is treated as being around them?

E.g. if the list of words was: key, written, as if, then the output would make "key", "written", "as if" in italics.

This will be used for more complex functions, such as automatically placing in pictures with a filename matching those the key words, e.g.:

\define[1]\mymacro{
    #1 \externalfigure[#1][width=\paperwidth]
}

Is there any way to have ConTeXt automatically treat key words as having a macro on them, even if the macro isn't manually written in?

Village
  • 13,603
  • 23
  • 116
  • 219

0 Answers0