smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

Problem with some triggers in LaTeX mode

Open sdban opened this issue 8 years ago • 4 comments

I am using smartparens with AUCTeX in emacs. I was going through the smartparens-latex.el file and trying out some of the code in there. Let me consider code in lines 143- 150.

Expected behavior

So in LaTeX math mode if I press \l( or \l[ I should see \left (* \right ) and \left [ * \right ] where * is the point.

Actual behavior

Instead I get \left ((*) \right ) and \left [[* \right ].

Steps to reproduce the problem

Press \l( or \l[ inside LaTeX math mode with AUCTeX activated.

Environment & version information

  • smartparens version: 20170207.2239
  • Active major-mode: AUCTeX
  • Emacs version (M-x emacs-version):26.0.50
  • Spacemacs/Evil/Other starterkit (specify which)/Vanilla: Vanilla
  • OS: Linux

sdban avatar Jul 10 '17 01:07 sdban

Maybe the problem with double-quotes described at the end of https://emacs.stackexchange.com/a/34060/2370 is related?

For reference I cite here the relevant section:

As of 2017-07-09 (melpa-version 20170708.1326), https://github.com/Fuco1/smartparens/ seems to be broken.

If I press " in the middle between Testing and quotes of the following LaTeX text

\documentclass{article}
\usepackage[ngerman]{babel}
\begin{document}
Testing  quotes
\end{document}

I get the following strange auto-insertion:

\documentclass{article}
\usepackage[ngerman]{babel}
\begin{document}
Testing'' ` quotes
\end{document}

One can follow the execution of sp-insert-pair. The trigger character " is deleted. The open part of the pair is decomposed into its prefix " and its last character `. The last character is inserted. Then it skips backward one thing. Thereby, the thing is whatever sp-get-thing returns (here it is just space). There it inserts the closing part ''.

TobiasZawada avatar Jul 10 '17 03:07 TobiasZawada

@TobiasZawada What you describe is a different problem I think. I don't guard the case where the trigger is also a pair prefix :/ We should probably open a different issue for that.

Fuco1 avatar Jul 10 '17 09:07 Fuco1

@Fuco1 Done: #772

TobiasZawada avatar Jul 10 '17 10:07 TobiasZawada

This problem still persists as of 2019 It also exists when typing the full \left( command, then it creates \left(()\right).

rommeswi avatar Sep 03 '19 13:09 rommeswi