0

I wish to replace all instances of Bezier and bezier with B\'{e}zier in my LaTeX document. It's in a masters thesis of 30 pages.

Two questions. How could one achieve the above with a new command or similar approach? And, is it going to be worth the amount of time i save or will it likely cause some issues further down the line?

  • 4
    Surely it's much much easier to do this with the editor. Simple find and replace – Au101 Dec 29 '16 at 3:44
  • i would agree @Au101 but i have probably used the following about 150 times throughout the paper, so just tying to find a time effiecient possibility – Sam Harper Dec 29 '16 at 3:47
  • 1
    Repetitive tasks are better left to a computer than a human, but that doesn't mean TeX is always the way to do it. In this case, things like sed or awk (or etc.) are the better choice. (And, off-topic, but, in 2016, use UTF-8 and input an é directly rather than \'{e}.) – jon Dec 29 '16 at 6:01
3

In Texmaker, you can use Replace All. You use hot key Ctrl + R. enter image description here

2

If you're willing and able to use LuaLaTeX, one could write a Lua function that performs the string replacement job "on the fly".

That said, I'd say it must be easier to do this replacement once and for all in one's text editor.

% !TeX program = lualatex
\documentclass{article}
\usepackage{luacode}
\begin{luacode}
   function bezier ( s ) 
      return ( string.gsub ( s , "[Bb]ezier", "B\\'ezier" ) )   
   end
\end{luacode}
\AtBeginDocument{\directlua{luatexbase.add_to_callback( 
   "process_input_buffer", bezier, "bezier" )}}

\begin{document}
aaa bezier bbb Bezier ccc
\end{document}

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.