Paste starry medium or team in AUCTeX

A simple question today - I hope the answer is equally simple.

From TextMate I'm used to a keyboard shortcut that changes the current environment or command to its star version. Is there something similar in Emacs / AUCTeX?

+3
source share
2 answers

As noted by Kilian Foth , you can write a function to change the environment this way:

(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) "*")))

This function will continue to add stars ( *) to the current environment if you repeat the command.

If instead you want the function to display the current environment if it has not already been removed, and to stop it if it has already been removed, you can use the following function:

(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-environment LaTeX-star-environment-dwim .

+2

-, , , LaTeX-current-environment LaTeX-modify-environment. ( emacs , .)

+1

All Articles