As pointed out in this answer, using \( and \) in order to enter inline math mode in LaTeX is the recommended practice. However, this takes a bit longer if one compares it to $.

Is there a way to make it quicker when using emacs+auctex? What are you guys doing in order to type it in quicker?

4 Answers 4


I use yasnippet. awesome package for inserting snippets. there is latex snippet bundle you can use. Infact there is already a written snippet to insert exactly what you are asking for.

  • It looks like the one thing I was after. Does the LaTeX bundle include a snippet for \( \) or did you add one manually? I found only the one for \[ and \]...
    – Dror
    Commented Sep 5, 2011 at 5:43
  • Yes, its already included. I type math and hit TAB. thats it. its dead easy to write a new snippet for your needs.
    – kindahero
    Commented Sep 5, 2011 at 6:29
  • Thnx! math+TAB generates a \[ \] pair - but I managed to create the snippet I needed! Thnx again.
    – Dror
    Commented Sep 5, 2011 at 7:18
  • @kindahero I would use a simpler key, as in shorter, for inline math because it may be used very often.
    – N.N.
    Commented Dec 30, 2011 at 13:59
  • 1
    @kindahero Indeed. I just meant that you might use inline math several times per paragraph and then you will be more effective if you use a short key.
    – N.N.
    Commented Dec 30, 2011 at 15:30

As described in its documentation, AUCTeX provides the function TeX-insert-dollar which inserts the two strings of TeX-electric-math and adjusts point position to between those strings when "$" is typed.

The following elisp can be added to a hook on LaTeX-mode to insert "\(" and "\)" then place the point after the opening paren when an unmatched "$" (i.e., the "$" is not closing an existing math environment) is typed:

(add-hook 'LaTeX-mode-hook
          (lambda () (set (make-variable-buffer-local 'TeX-electric-math)
                  (cons "\\(" "\\)"))))
  • Welcome to TeX.SX. What is the difference of your answer to Tilo Wiklund ones? Commented Sep 18, 2017 at 18:06
  • 1
    @StefanPinnow My answer includes a link to the official documentation and includes code to actually implement the suggested solution. Commented Sep 18, 2017 at 18:08

You can setup a key binding in your .emacs file. This definition is based on the one for TeX-insert-braces (C-c{) from tex.el.

(add-hook 'LaTeX-mode-hook
  '(lambda ()
    (define-key TeX-mode-map "\C-cm" 'TeX-insert-inline-math)
    (defun TeX-insert-inline-math (arg)
      "Like TeX-insert-brackes but for \(...\)" (interactive "P")
      (if (TeX-active-mark)
          (if (< (point) (mark)) (exchange-point-and-mark))
          (insert "\\)")
          (save-excursion (goto-char (mark)) (insert "\\(")))
          (insert "\\(")
            (if arg (forward-sexp (prefix-numeric-value arg)))
            (insert "\\)"))))))

Pressing $ in AUCTeX runs TeX-insert-dollar, the behaviour of which is controlled by the variable TeX-electric-math which can be set to use any pair of symbols instead of the default pair of $.

  • Pressing the dollar sign does no such thing on mine. :(
    – user25665
    Commented Jul 15, 2017 at 19:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .