If you use smart-paren, you can add the following so that \( \)
is added every time you press $ (not following a backslash).

(sp-with-modes '(latex-mode)
      (sp-local-pair "$" nil :actions :rem)
      (sp-local-pair "\\(" "\\)"
                     :unless '(sp-point-before-same-p
sp-latex-point-after-backslash)
                     :trigger-wrap "$"
                     :trigger "$"
                     :actions '(wrap insert autoskip navigate)))

On Sun, Jan 9, 2022 at 9:24 AM Uwe Brauer <[email protected]> wrote:
>
>
> Hi
>
> I just found in my add-ons lisp file the following functions.
>
> (defun my-change-dollar-to-displaymath ()
>   (interactive)
>   (replace-regexp "\\$\\$\\(\\(.\\|\n\\)*?\\)\\$\\$"
>                   "\\\\begin{displaymath}\\1\\\\end{displaymath}"))
>
>
> (defun my-change-dollar-to-equationstar ()
>   (interactive)
>   (replace-regexp "\\$\\$\\(\\(.\\|\n\\)*?\\)\\$\\$"
>                   "\\\\begin{equation*}\\1\\\\end{equation*}"))
>
>
> Since I really don't master regexp, I presume somebody sent me this
> (Arash would be a natural candidate 😉)
>
> Since $$ are not really recommended in latex documents, but still widely
> used by users, shouldn't these functions, or some generalisation be
> included in auctex?
>
> Regards
>
> Uwe Brauer

Reply via email to