smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

escaped $ in math mode

Open slyfr opened this issue 5 years ago • 4 comments

Expected behavior

When in a math environment typing \$ should insert \$.

Actual behavior

  • When in a math environment of the form $ ... $ typing \$ only \ is inserted. The symbol $ is omitted.
  • When in a math environment of the form \( ... \) typing \$ inserts \$$. A redundant $ is inserted.

Steps to reproduce the problem

Enter in latex-mode create the math environments en type \$

Backtraces if necessary (M-x toggle-debug-on-error)

Environment & version information

In recent enough smartparens you can call M-x sp-describe-system to generate this report. Please fill manually what we could not detect automatically. Edit the output as you see fit to protect your privacy.

  • smartparens version: 20201217.1033
  • Active major-mode: latex-mode
  • Smartparens strict mode: nil
  • Emacs version (M-x emacs-version): GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2020-09-19
  • Starterkit/Distribution: Spacemacs
  • OS: gnu/linux

slyfr avatar Jan 02 '21 12:01 slyfr

For me in both cases \$$ is inserted.

Fuco1 avatar Jan 10 '21 17:01 Fuco1

I tried to modify

(sp-local-pair "$" "$")

into

(sp-local-pair "$" "$" 
                      :unless '(sp-latex-point-after-backslash ))

but it does not work... I do not see how to modify the code to obtain the right behaviour.

slyfr avatar Jan 14 '21 07:01 slyfr

Yea it's probably a regression caused by some changes in latex-mode.

Fuco1 avatar Jan 17 '21 12:01 Fuco1

I guess so.

Do you have any idea on how to observe what happens en inputing '$' after '\'?

slyfr avatar Jan 18 '21 09:01 slyfr