auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] change: documents with $$ to \begin{documents}


From: Nicolas Richard
Subject: Re: [AUCTeX-devel] change: documents with $$ to \begin{documents}
Date: Sun, 04 Jan 2015 21:15:21 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Uwe Brauer <address@hidden> writes:
> (defun  my-LaTeX-swap-dollars () 
>   (interactive)
>   (while (re-search-forward  "\\$\\$\\(\\(.\\|\n\\)*?\\)\\$\\$" nil t)
>       (replace-match "\\\\begin{equation*}\\1\\\\end{equation*}" nil nil)))

fwiw, I use this:
(query-replace-regexp "\\$\\$\n?\\([^$]*?\\)\n?\\$\\$" 
"\\\\begin{equation*}\n\\1\n\\\\end{equation*}")
not fool proof (main caveat : it doesn't dtrt when it replaces equations
that are commented out) but good enough for me.

The \n? trickery is the make sure that the begin{} and end{} lines are on
their own line. It sort of works but could be better.

-- 
Nicolas Richard




reply via email to

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