Skip to content

smartparens breaks LaTeX quotation marks mechanism for language styles #1100

@vitaminace33

Description

@vitaminace33

Expected behavior

Press ["] once to get «.», twice for "." (or vice-versa if TeX-quote-after-quote is non-nil).

Notes

  • Brackets indicate a key.
  • Dot indicates the point or cursor position.
  • Double angular brackets are the hypothetical current value of TeX-quote-open and TeX-quote-close but could be different depending on the applied language style, e.g. "< and ">, respectively.
  • Check AUCTeX's reference manual for regular (non-electric) behavior.

Actual behavior

Press ["] once, depending on the value of TeX-quote-after-quote and if TeX-quote-open and TeX-quote-close are single or double characters, different behavior are present. Worst case scenario is that only part of the quote string is inserted, moreover partly in the previous line and partly in the current, while deleting a previous character. Refer to syl20bnr/spacemacs#15003 for specific "experiments".

Steps to reproduce the problem

  1. On vanilla Emacs, install auctex and smartparens.
  2. Open a .tex file including \usepackage[german]{babel} (parsing on load must be activated to successfully load the language style).
  3. Write any quote. Again, refer to [WORKAROUND] LaTeX quotation mechanism is broken syl20bnr/spacemacs#15003 for specific "experiments".

I leave here my .emacs for reference.

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(require 'smartparens-config)
(setq TeX-parse-self t) ; Enable parse on load.
(setq TeX-auto-save t)  ; Enable parse on save.
(custom-set-variables
 '(package-selected-packages '(smartparens auctex)))

Workaround

A workaround has been documented in syl20bnr/spacemacs#15003 that allows the use smartparens.

Environment & version information

  • smartparens version: 20210817.1912
  • 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: Vanilla
  • OS: gnu/linux (Ubuntu 20.04)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions