For my amusement in using LaTeX3, the code below defines an environment boldwords
that accepts a comma separated list of words to be typeset in bold inside the environment. Running the MWE produces:
Note, in particular, that the log
in catalogue
is not made bold because it is not a complete word.
\documentclass{article}
\usepackage{environ}
\usepackage{expl3}
\ExplSyntaxOn
\clist_new:N \l_bold_word_clist
\tl_new:N \l_BODY_tl
\NewEnviron{boldwords}[1]{
\clist_set:Nn \l_bold_word_clist {#1}
\tl_set:No \l_BODY_tl {\BODY}
\clist_map_inline:Nn \l_bold_word_clist {
\regex_replace_all:nnN {\b##1\b} { \c{textbf}\cB\{##1\cE\} } \l_BODY_tl
}
\l_BODY_tl
}
\ExplSyntaxOff
\begin{document}
\begin{boldwords}{dog, log}
a dog, a cat, a frog a log and a catalogue
a dog, a cat, a frog a log and a catalogue
a dog, a cat, a frog a log and a catalogue
a dog, a cat, a frog a log and a catalogue
a dog, a cat, a frog a log and a catalogue
\end{boldwords}
\end{document}
sed -i …
by\write18
and modify text file before compiling it by latex.\hello
macro?