[Tex/LaTex] Renaming a word in multiple files

texstudio

I have a number of files:

  • main.tex
  • chapter1.tex
  • chapter2.tex
  • chapter3.tex
  • chapter4.tex

The chapter files are linked in main.tex with the \input command.

In main.tex I define a named listing called sampletext that is also used throughout the chapters. I would like to rename this to examplecode in the main.tex and all the chapter files. How can I do this? I am using TexStudio 2.1.1.0 on Windows.

Best Answer

You can replace in multiple files in TeXstudio using the extended search:

  1. Search for the string to replace.
  2. Open the extended search using the [+] button in the search panel.
  3. Switch the scope from "Current Doc" to "Project".
  4. The search results list will be updated and show all matches.
  5. Type the new text in the field "Replace By" and press "Replace All"

enter image description here

Note: You can also deselect individual occurences using the checkboxes if you want to replace only a subset of all occurences.