0

This feels very much like a problem that should have already been discussed somewhere, and I am probably only too stupid to find it :(

I have defined myself a function \jf{} and want to delete all of it in the whole buffer at once. For example:

bla bla bla \jf{colourful text} bla bla bla bla bla \jf{more colourful text} bla bla
bla bla \jf{colour is great} bla bla bla bla bla \jf{so great} bla bla

Should become this by some shortcut:

bla bla bla colourful text bla bla bla bla bla more colourful text bla bla bla
bla bla colour is great bla bla bla bla bla so great text bla bla bla

Is there a way in AUCTeX to do so? Thanks for you help.

panuffel
  • 624
  • 1
  • 8
  • 15
  • There are a few tex code strippers out there on the net that need some modifications to work properly -- made from bash and from perl. Nothing is perfect, but that would be a place to start if you are doing this on a regular occasion. Then you can post the finished product when your done: :) http://tex.stackexchange.com/questions/102397/most-efficient-method-to-strip-all-of-the-latex-code-from-a-document – lawlist May 06 '13 at 04:54

1 Answers1

0

The quickest way to do this is probably with regular expressions (regexp). Use

M-x replace-regexp <RET> \\jf{\(.?\)} <RET> \1

This will make emacs replace anything that matches the pattern \jf{some text} with some text.

Yossarian
  • 5,226
  • 1
  • 37
  • 59
  • Thank you for your answer, @Yossarian, but it this does not work properly for me. If there are two font calls in the same line, the opening bracket of the first and the closing bracket of the second are removed. But a friend of mine found a solution: `M-x query-replace-regexp \\jf{\([^}]*\)} \1 ` It seems to work fine. Thank you anyway for pushing me in the right direction. – panuffel May 14 '13 at 12:40