Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8977011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:16:36+00:00 2026-06-15T19:16:36+00:00

In my latex file, I defined \newcommand{\replace}[2]{\textcolor{red}{\sout{#1} }\textcolor{blue}{{#2}}} Just to highlight changes. So in

  • 0

In my latex file, I defined

\newcommand{\replace}[2]{\textcolor{red}{\sout{#1} }\textcolor{blue}{{#2}}}

Just to highlight changes. So in my paper draft, there are many occurrences of

\replace{old text}{new text}

Now the paper is accepted, and I want to get a clean version. How can I use emacs Regex replacement to change all of them to

new text
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:16:37+00:00Added an answer on June 15, 2026 at 7:16 pm

    A very simple way to do this is to modify your replace command so that it only prints the new text:

    \newcommand{\replace}[2]{#2}
    

    Otherwise, I would do this with a keyboard macro such as the following:

    C-s           ;; isearch-forward
    \             ;; self-insert-command
    replace{      ;; self-insert-command * 8
    RET           ;; newline
    <left>        ;; backward-char
    ESC <C-right> ;; forward-sexp
    C-SPC         ;; set-mark-command
    C-r           ;; isearch-backward
    \             ;; self-insert-command
    replace       ;; self-insert-command * 7
    RET           ;; newline
    C-w           ;; kill-region
    2*C-SPC       ;; set-mark-command
    ESC <C-right> ;; forward-sexp
    DEL           ;; delete-backward-char
    C-u C-SPC     ;; set-mark-command
    C-d           ;; delete-char
    

    The logic behind this keyboard macro is that you search for \replace{ commands, then use forward-sexp and backward-sexp to move around balanced pairs of `curly brackets.

    Edit: note that the binding for forward-sexp is traditionally written as C-M-<right>, but such a key press might be intercepted by your window manager (a very frequent behaviour for Linux boxes at least). It is therefore often easier to type ESCC-<right> instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am compiling a latex file on a server and download from there the
The latex file is giving the following error: ! LaTeX Error: File `datetime.sty' not
In my english thesis latex file, how to mention the following non English words:
Input: I have a LaTeX file, with plain text & math formulas. Desired output:
I am including chapters in my latex file one by one by using the
Does LaTeX handle situation when a .bib file has different encoding than .tex file?
In the latex-mode, we can make a tex file to fill it with all
I've hit an annoying problem in LaTeX. I've got a tex file of about
My latex file is: \title{\large\textbf{Optimizarea rela\c tiei dintre structur\u a \c si comportament \^in
Possible Duplicate: Derived class defined later in the same file “does not exist”? Does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.