emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Depreciating TeX-style LaTeX fragments


From: Anthony Cowley
Subject: Re: Depreciating TeX-style LaTeX fragments
Date: Sun, 16 Jan 2022 09:30:12 -0500


> On Jan 16, 2022, at 7:13 AM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
> 
> On Sunday, 16 Jan 2022 at 00:36, Timothy wrote:
>>        Hmm. Not sure about this. Keystroke wise we’re comparing $$
>>        to \(. The latter can be completed by smartparens, but since
>>        single dollars are reasonable Org content the former can’t.
>>        At this point the only argument is muscle memory, and if
> 
> As an aside, I will suggest including the following code in your Emacs
> customization:
> 
> #+begin_src emacs-lisp :tangle "esf-org.el"
>  ;; from Nicolas Richard <theonewiththeevillook@yahoo.fr>
>  ;; Date: Fri, 8 Mar 2013 16:23:02 +0100
>  ;; Message-ID: <87vc913oh5.fsf@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
> 
> I've been using this for years now and it works very well: I also had
> $...$ in my muscle memory.

This is a really helpful snippet, but I tried it out for a while a previous 
time this issue came up and found the readability of equations took too much of 
a hit. The “backslash city” really is tough to visually parse. Backslash 
density is already an unfortunate bit of the LaTeX experience, and I didn’t get 
used to the extra slashed characters as bookends over a two week trial.

I still wanted to express my appreciation for you sharing this!

Anthony


reply via email to

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