On Friday, 12 May 2017 at 18:06, Joe Corneli wrote:
> On Fri, May 12, 2017 at 4:37 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr> 
> wrote:
>
>
>> I'm not convinced it is worth changing the syntax class of "'" or even
>> making a special case for "'". You can get rid of this problem using
>> \(P\) instead.
>
> Thanks for suggesting this work around, I didn't know that bit of syntax!

And if typing $...$ is hardwired, as it is for me, or because it's
easier to type than the alternative, you can use this code snippet to
change a $ when typed on the fly to \(..\):

#+begin_src emacs-lisp
  ;; from Nicolas Richard <theonewiththeevill...@yahoo.fr>
  ;; Date: Fri, 8 Mar 2013 16:23:02 +0100
  ;; Message-ID: <87vc913oh5....@yahoo.fr>
  (defun yf/org-electric-dollar nil
    "When called once, insert \\(\\) and leave point in between.
  When called twice, replace the previously inserted \\(\\) by one $."
    (interactive)
    (if (and (looking-at "\\\\)") (looking-back "\\\\("))
        (progn (delete-char 2)
               (delete-char -2)
               (insert "$"))
      (insert "\\(\\)")
      (backward-char 2)))
  (define-key org-mode-map (kbd "$") 'yf/org-electric-dollar)
#+end_src

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.6-425-gf4fca1

Attachment: signature.asc
Description: PGP signature

Reply via email to