[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] toggle environments with and without *

From: Lars Madsen
Subject: Re: [AUCTeX] toggle environments with and without *
Date: Tue, 2 Dec 2014 11:32:27 +0000

what are the requirements for this macro?

(still using 11.87)

/Lars Madsen
Institut for Matematik / Department of Mathematics
Aarhus Universitet / Aarhus University
Mere info: / More information:

From: address@hidden address@hidden on behalf of Tamas Papp address@hidden
Sent: 01 December 2014 19:06
To: auctex
Subject: [AUCTeX] toggle environments with and without *


I was trying to come up with a way to quickly switch between environment
pairs with and without an asterisk (eg equation and equation*). My
attempt is below, it works, but I was wondering if I am overcomplicating
this and maybe there is a simpler way.

Also, can someone suggest a way to comment and uncomment lines which
start with \label?

--8<---------------cut here---------------start------------->8---
(defun LaTeX-toggle-* ()
  "Toggle between forms of the current environment with or without * at the 
  (let* ((environment (LaTeX-current-environment)))
    (when environment
      (let* ((l (length environment))
             (*-p (and (cl-plusp l)
                       (eql (aref environment (1- l)) ?*)))
             (bare-environment (if *-p
                                   (subseq environment 0 (1- l))
        (cl-assert (cl-plusp (length bare-environment)) ()
                   "Empty environment ~S" bare-environment)
        (when (or (not LaTeX-toggle-*-environments)
                  (cl-find bare-environment font-latex-math-environments
                           :test #'equal))
          (LaTeX-modify-environment (if *-p
                                      (concat bare-environment "*"))))))))
--8<---------------cut here---------------end--------------->8---



auctex mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]