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

Adding \left\langle, \right\rangle breaks things in latex #1193

Open
ultronozm opened this issue Mar 20, 2024 · 3 comments
Open

Adding \left\langle, \right\rangle breaks things in latex #1193

ultronozm opened this issue Mar 20, 2024 · 3 comments

Comments

@ultronozm
Copy link

Expected behavior

Modify smartparens-latex.el to contain the following additional local pair definition:

(sp-local-pair "\\left\\langle" "\\right\\rangle"
                   :post-handlers '(sp-latex-insert-spaces-inside-pair))

Open a LaTeX-mode buffer containing $\left\langle \right\rangle$. Put the cursor in the middle of the brackets and do M-x sp-up-sexp. This should move the point to the rightmost $.

Actual behavior

The point does not move; we are dealt the message "Search failed: there is an unmatched expression somewhere or we are at the beginning/end of file."

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

No error.

Environment & version information

  • smartparens version: 1.11.0
  • Active major-mode: LaTeX-mode
  • Smartparens strict mode: nil
  • Emacs version (M-x emacs-version): GNU Emacs 30.0.50 (build 4, aarch64-apple-darwin23.2.0, NS appkit-2487.30 Version 14.2.1 (Build 23C71)) of 2024-02-06
  • Starterkit/Distribution: Vanilla
  • OS: darwin
@ultronozm
Copy link
Author

Sorry, I should have seen in the manual the rule about pairs having to be prefix-free, so please feel free to close this issue -- I'll just note that both \langle, \rangle and \left\langle, \right\rangle appear often for me, so it's a significant issue.

@Fuco1
Copy link
Owner

Fuco1 commented Mar 20, 2024

The prefix-free note is not entirely correct anymore. I should revise it.

You can in fact have two pairs, let's say \langle and \rangle and what you have. The pairs then highlight a bit weirdly, but somewhat work. The fact that the navigation doesn't work I would consider a bug, because at the least it should recognize the "inside" pair (langle rangle) and jump out of that. So I think this is a valid report.

image

image

image

@ultronozm
Copy link
Author

Just FYI, after submitting this report, I worked out some ad-hoc parenthesis-based navigation just for tex modes: https://github.com/ultronozm/tex-parens.el. I'm happy with this, so please feel free to deprioritize my report (at least as far as I'm concerned). I'd also be happy to try to incorporate my solution into smartparens if you thought that it made sense to do so, but it's not clear to me how feasible that would be. Anyway, thanks again for taking a look at this report and noting the issue.

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

2 participants