I couldn't even get it to work by just copy'n'pasting it. /Lars Madsen Institut for Matematik / Department of Mathematics Aarhus Universitet / Aarhus University Mere info: http://au.dk/daleif@imf / More information: http://au.dk/en/daleif@imf
________________________________________ From: Tamas Papp [[email protected]] Sent: 02 December 2014 14:01 To: Lars Madsen Cc: auctex Subject: Re: [AUCTeX] toggle environments with and without * In the current version, it toggles between \begin{equation*} a^2 + b^2 = c^2 \end{equation*} and \begin{equation} a^2 + b^2 = c^2 \end{equation} In the "deluxe" version I am trying to write, it would toggle between \begin{equation*} % my fancy equation % \label{eq:mylabel} a^2 + b^2 = c^2 \end{equation*} and \begin{equation} % my fancy equation \label{eq:mylabel} a^2 + b^2 = c^2 \end{equation} too (note the commented out label, and that only the comments before a \label are toggled). I don't know enough about Emacs Lisp/AUCTeX internals to write this. Also, help with making the current implementation more idiomatic is welcome (currently it looks like an entry for the "you can write CL in any language" contest). Best, Tamas On Tue, Dec 02 2014, Lars Madsen <[email protected]> wrote: > 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: http://au.dk/daleif@imf / More information: > http://au.dk/en/daleif@imf > > > ________________________________________ > From: [email protected] > [[email protected]] on behalf of Tamas Papp > [[email protected]] > Sent: 01 December 2014 19:06 > To: auctex > Subject: [AUCTeX] toggle environments with and without * > > Hi, > > 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 > end." > (interactive) > (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)) > environment))) > (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 > bare-environment > (concat bare-environment "*")))))))) > --8<---------------cut here---------------end--------------->8--- > > Best, > > Tamas > > _______________________________________________ > auctex mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/auctex _______________________________________________ auctex mailing list [email protected] https://lists.gnu.org/mailman/listinfo/auctex
