Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with insertion of double-quotes defined as trigger in smartparens-latex #772

Open
TobiasZawada opened this issue Jul 10, 2017 · 4 comments

Comments

@TobiasZawada
Copy link

TobiasZawada commented Jul 10, 2017

Expected behavior

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 expect to get

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

with point placed between ` and '.

Actual behavior

I get the following strange auto-insertion:

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

Steps to reproduce the problem

Run (require 'smartparens-latex) open the above text file, activate smartparens-mode and type " in the middle between Testing and quotes.

Environment & version information

  • smartparens version: melpa, 20170708.1326
  • Active major-mode: latex-mode from AucTeX
  • Emacs version (M-x emacs-version): 25.1 on linux and GNU Emacs 25.2.1 (x86_64-unknown-cygwin, GTK+ Version 3.22.10) of 2017-04-21
  • OS: independent (tested on Linux and cygwin)
@nidrissi
Copy link

nidrissi commented Nov 22, 2017

Perhaps related: in the following document

\documentclass{article}
\begin{document}
Insert quotes here:
$f' = 0$
\end{document}

typing " before the math formula inserts opening quotes at the point (which is okay) but also "closes" the pair by inserting an apostrophe ' right after the one already in the file, which is not okay.

@Fuco1
Copy link
Owner

Fuco1 commented Nov 22, 2017

@nidrissi Not sure if related but this bug is hilarious either way :D I think it would be better if you started a new issue, thanks!

The issue from OP actually seems to be already fixed on master, at least I can't reproduce it with the given setup.

@TobiasZawada could you please verify that this is fixed?

@Fuco1 Fuco1 added this to the Backlog milestone Dec 4, 2017
@ofenerci
Copy link

ofenerci commented Jul 2, 2019

I am getting the same problem.

@Janfel
Copy link

Janfel commented Oct 21, 2019

I had the same problem, but after some experimenting, I managed to fix it. Note that this only applies to german quotes, not to french ones. It seems this issue is caused by Smartparens and AUCTeX disagreeing over the type of quotes to be inserted. I configured AUCTeX to automatically expand " into the correct opening quote, which, in turn, triggers Smartparens to insert the correct closing quote. Now everything seems to work as expected.

I first registered german quote syntax as a new pair. Note the lack of a :trigger. (I'm not entirely sure what the function of the post-handler does, so I left it in)

(sp-with-modes '(tex-mode
                   plain-tex-mode
                   latex-mode
                   LaTeX-mode)
    (sp-local-pair "\"`" "\"'"
                   :unless '(sp-latex-point-after-backslash sp-in-math-p)
                   :post-handlers '(sp-latex-skip-double-quote)))

Then I configured AUCTeX to automatically insert the german opening quote, when " is pressed. The corresponding entry in my custom-set-variables looks like this:

'(TeX-quote-language-alist (quote (("ngerman" "\"`" "\"'" nil))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

5 participants