0

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?

  • If you wrap text in backticks like so it is displayed as inline code. If you indent it with four spaces it comes out as displayed code. – ChrisS Dec 5 '13 at 3:57
  • 7
    What LaTeX editor are you using? Most editors nowadays have the search-and-replace function. Just search all instances of South Park in your .tex file and replace them with \textit{South Park} using the editor – Herr K. Dec 5 '13 at 4:47
  • Thanks, Kevin. I didn't even think about that. I'll give it a try right now. – Brandon Simpson Dec 5 '13 at 8:11
  • I was about to answer the same thing as @Kevin C. – Jeroen Dec 5 '13 at 8:53
1

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.

|improve this answer|||||
  • 5
    why not just change South Park what's the advantage of only searching for half the string and then using a delimited argument? – David Carlisle Dec 5 '13 at 9:25
  • 1
    @DavidCarlisle Because OP wants TeX to do it. I know: it is probably too early to introduce definition with a structure, but OP seems to be a TeX enthusiast. – Przemysław Scherwentke Dec 5 '13 at 12:43
1

I am not quite sure of what exacly you are looking for, but I suggest that you use the replace function of your LaTeX editor (assuming that it has it).

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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