[OS X TeX] Replace \f{x} by \g{x}\h{x}

Luis Sequeira lfsequeira at gmail.com
Sat May 2 06:16:01 EDT 2015


Coming late to this, as I am on digest mode, I just would like to say that I am surprised nobody seemed to mention that you can do this same thing in TeXShop! Just use the OgreKit find panel (I wonder why anyone would chose not to), and tick the box to use regular expressions.

Luis Sequeira


> If you want to replace \f{stuff} with \g{stuff}\h{stuff} and \f{other stuff} with \g{other stuff}\h{other stuff} you could use find and replace in BBEdit or TextWrangler with Grep where the search string is a regex pattern:
> 
> \\f\{([^\}]*)\}
> 
> and the replacement is
> 
> \\g{\1}\\h{\1}
> 
> The pattern ([^\}]*) captures the content inside the curly braces and the \1 pastes it in your \g and \h commands.
> 
> Grep needs to be checked in the Find dialog for this to work.


More information about the MacOSX-TeX mailing list