[texhax] boldfacing words from a list

John R. Culleton john at wexfordpress.com
Fri Sep 29 18:35:00 CEST 2006


On Thursday 28 September 2006 10:05, Christopher W. Ryan wrote:
> As I was typing my daughter's school essay the other night, I began
> wondering whether there is a latex package that would cause all words
> from a particular list, when appearing in a document, to be boldfaced.
>
> She had to write a story with an economics theme, like opening a
> business (her's was about a sandwich shop.)  She had to use the
> vocabulary words (like capital, competition, labor, wages, management,
> profit, and so on).  Those words, when appearing in the story, had to be
> boldface.
>
> Anyone know of a package that would take something like
>
> \listofwords{blah foo bar}
>
> in the preamble
>
> and then whenever blah or foo or bar appeared in the source file, the
> output would be as if the source file had contained \textbf{blah},
> \textbf{foo}, and \textbf{bar}
>
> Just wishful thinking.
>
> Thanks.
>
> --Chris

TeX is not a text entry program. For that you use an editor like
GVim and mass changes like 
:%s/ foo /{\\bf & }/g
which says: "throughout the document wherever you encounter
'foo' with spaces on either side then enclose "foo"  with
braces and insert the typeface command '\bf'.

This covers most cases. Separate statements would handle all the
"foo"s at the beginning or end of source lines. With Vim or other
competent editors this could all be boiled down to a script. Hit
an F key and you're done. 

You don't use a hammer for every task. Sometimes you use a file
or a saw.
-- 
John Culleton
Able Indexing and Typesetting
Precision typesetting (tm) at reasonable cost.
Satisfaction guaranteed. 
http://wexfordpress.com




More information about the texhax mailing list