3

今日は簡単な質問です。答えも同様に簡単であることを願っています。

TextMate から、現在の環境またはコマンドをスター付きバージョンに変更するキーボード ショートカットに慣れています。Emacs/AUCTeX に似たようなものはありますか?

4

2 に答える 2

2

Kilian Fothが指摘したように、次のような方法で環境を変更する関数を作成できます。

(defun LaTeX-star-environment ()
  "Convert the current environment to its starred version."
  (interactive)
  ;; Add a star to the current environment.
  (LaTeX-modify-environment (concat (LaTeX-current-environment) "*")))

*この関数は、コマンドを繰り返すと、現在の環境に星 ( ) を追加し続けます。

代わりに、現在の環境がまだスターが付いていない場合はスターを付け、既にスターが付いている場合はスターを外す関数が必要な場合は、次の関数を使用できます。

(defun LaTeX-star-environment-dwim ()
  "Convert between the starred and the not starred version of the current environment."
  (interactive)
  ;; If the current environment is starred.
  (if (string-match "\*$" (LaTeX-current-environment))
      ;; Remove the star from the current environment.
      (LaTeX-modify-environment (substring (LaTeX-current-environment) 0 -1))
    ;; Else add a star to the current environment.
    (LaTeX-modify-environment (concat (LaTeX-current-environment) "*"))))

どちらの関数も、.emacs に含めてM-x LaTeX-star-environmentorを実行LaTeX-star-environment-dwimするか、関数をキーにバインドすることで使用できます。

于 2012-05-10T10:44:11.083 に答える
1

LaTeX-current-environment明らかにそうではありませんが、 andを使用してそれを行う小さな関数を書くのは簡単でしょうLaTeX-modify-environment。(私は今、emacs を持っていません。申し訳ありません。)

于 2012-05-10T09:36:24.520 に答える