For all my pairing needs I use the great package smartparenthesis. To include the pairs you require, do as follows:
First, install (using Melpa or whatever) smartparenthesis and then load it. I use usepackage for that, but the way suggested by the package's author is to simply run this:
(require 'smartparens-config)
The important code comes now:
(sp-with-modes '(tex-mode plain-tex-mode latex-mode)
(sp-local-pair "\\\(" "\\\)"))
Note that you first escape the initial \, thus: \\, and then the opening parenthesis, thus: \(, which results in the complete sequence: \\\(. Ditto with the closing ones.
You can add all your beloved LaTeX pairs. This is my own full config (partially copied from someone else's):
(sp-with-modes '(tex-mode
plain-tex-mode
latex-mode
)
;; math modes, yay. The :actions are provided automatically if
; these pairs do not have global definition.
(sp-local-pair "$" "$")
(sp-local-pair "\[" "\]")
(sp-local-pair "\{" "\}")
(sp-local-pair "‘" "’")
(sp-local-pair "“" "”")
(sp-local-pair "\\begin" "\\end")
;;; tex-mode latex-mode
(sp-local-tag "i" "\"<" "\">")
(sp-local-pair "\\[" nil :unless '(sp-point-before-word-p))
(sp-local-pair "$" nil :unless '(sp-point-before-word-p))
)
C-cC-e mathwhich is the same thing but I just type\(then type the math then type\)that's only 4 keystrokes, it's hard to see how you would get a key combination to enter\( \)and then step past the\)at the end in less than 4 keystrokes. Actually I'd do$math$which is only two keystrokes. – David Carlisle Jul 12 '17 at 20:17https://tex.stackexchange.com/questions/27921/how-can-i-optimize-the-keyboard-for-frequent-latex-input/27923#27923– Phil Hirschhorn Jul 13 '17 at 04:35(setq LaTeX-electric-left-right-brace t)in your init file. When you are in a math environment typing\(results in what you want. – Name Jul 16 '17 at 12:34