Text FormattingAutomatic formating of certain words

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
div
Posts: 6
Joined: Tue Aug 24, 2010 6:15 pm

Automatic formating of certain words

Post by div »

Hi there,

I'm quite new to TeX and I'm wondering if there is a package or any other way to achieve the following:
I want to format certain words (could be up to 150) automatically in my TeX project.

I imagined something like this:
I define a "wordlist" and a format somewhere (in the main tex document?):
\blacklist{word1;word2;word3;word4;word5;...}
\blacklist_format{\color{red}}

The result should be that after compiling the document every word which was listed in the blacklist is automatically rendered in red.

Is something like this possible? I searched quite a while on the net but haven't found anything.

Thanks and regards,
div
Last edited by div on Mon Aug 30, 2010 7:10 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
johnjamessmith0
Posts: 37
Joined: Sun Mar 29, 2009 1:41 am

Re: Automatic formating of certain words

Post by johnjamessmith0 »

The following is probably not very helpful. Sorry.

To my knowledge, most of the time it's impossible to touch anything that's not in a command without using very low level TeX stuff... maybe someone here can help you do that. But personally, I can't think of any situation in which I would want to universally change the formatting of certain words; perhaps if you told us what you're trying to accomplish we might be able to help more.

If you're really desperate, you can always write a quick script in any programming language to take in a .tex file and color all occurrences of those words.
div
Posts: 6
Joined: Tue Aug 24, 2010 6:15 pm

Re: Automatic formating of certain words

Post by div »

Thanks for your reply.

I think you're right, I think I'll write a small console application to parse the tex files.
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Automatic formating of certain words

Post by localghost »

You may provide this script here for the case that others are also interested. In case the problem is solved this would also be a good opportunity to mark the topic accordingly as described in Section 3 of the Board Rules.


Best regards
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
Post Reply