Commit 4602553a authored by Holzfeind, Daniel Georg 's avatar Holzfeind, Daniel Georg 💬

auto bracket in LaTeX mode

parent cd5fcd65
;; Provides _{} and ^{} via _-_ and ^-^ in LaTeX Mode
;; source:
;; https://emacs.stackexchange.com/questions/7862/inserting-electric-braces-in-auctex
(add-hook 'LaTeX-mode-hook 'fix-auto-bracket)
(defun fix-auto-bracket ()
(require 'tex-site)
(define-key LaTeX-mode-map "^"
(lambda ()
(interactive)
(if (equal (preceding-char) ?^)
(progn (insert "{}")(backward-char))
(insert "^"))))
(require 'tex-site)
(define-key LaTeX-mode-map "_"
(lambda ()
(interactive)
(if (equal (preceding-char) ?_)
(progn (insert "{}")(backward-char))
(insert "_")))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment