[Tex/LaTex] Search for word and italicize

formattingitalic

I'm using LaTeX to format my books now. When I transitioned one of my books from Word to LaTeX, the italicized words didn't carry over, so I used the command \textit{word}. But after sending it to my editor, I see that one group of words needs to be italicized every time.

I need to make the words "South Park" italicized in the entire document. I found one suggestion that I could put in the preamble:

\newcommand*{\southpark}{\textit{South Park}}

But this wasn't quite what I was looking for. I'm looking for a command that can search my document for "South Park" and italicize every instance of it. Is this possible?

Best Answer

It is not exactly what you want, but very close, I hope. You can use your editor to change every occurence of the word South (with the word Park after it) into \South (backslash added). Then the definition as in the following example does the rest.

\documentclass{article}

\def\South Park{\textit{South Park}}

\begin{document}

This is \South Park, this is \South Park, this is \South Park, this is \South Park, this is \South Park, but beware: this is also \South 
Park.

\end{document}

enter image description here

Limitations: The word Park must appear after \South. Otherwise TeX will stop with an error message.

Related Question