LoginSignup
1
0

More than 5 years have passed since last update.

Emacs 上で LaTeX 文書中から命令を正規表現置換で除去

Last updated at Posted at 2016-02-29

たとえば \red{...} というコマンドを取り除きたいとします。
C-M-% を押下して Query replace regexp に

\\red{\([^{]*?\)}

と打鍵して Query replace regexp \red{([^{]*?)} with に

\1

と打鍵します。候補が強調表示されるので置き換えをするか指示をします。

ポイント

  • [^{] という正規表現を用いることで誤った置き換えを防ぎます。例. \red{\textbf{太字}普通} → \textbf{太字普通}
  • *? という正規表現で貪欲照合にします。次の例が起きないようにします。例. \textbf{\red{ここ}続き} → \textbf{ここ}続き

参考ページ

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0