TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible and furthermore constructive to make LaTeX automatically format specific words in specific way? Let's say, for example, I'd like to have every occurrence of the word "hello" in a bold cyan monospaced serif font (whereas the rest of the document remains normal, sans serif and black).

How can I achieve that without having to do a search&replace to place "hello" into a custom command everytime before I compile the .tex file?

share|improve this question
You can, for example, run sed -i … by \write18 and modify text file before compiling it by latex. – Eddy_Em Apr 5 '13 at 12:17
Wouldn't it be easier, if possible, to do that type of formatting in advance in the input file itself, by defining a custom \hello macro? – Jubobs Apr 5 '13 at 12:25

Compile this with XeLaTeX



This is hello and this is hellow.

enter image description here

But don't use it. If you want to specially mark a word, use a macro.

Why? Relying on automatic procedures is always risky: if I have a choice, I prefer explicit mark up. Another reason is that xesearch is resource hungry and currently unmaintained.

There's nothing similar for pdflatex; something can possibly be done with LuaLaTeX. I tried chickenize but it doesn't seem to offer the feature.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.