Function: LaTeX-insert-corresponding-right-macro-and-brace
LaTeX-insert-corresponding-right-macro-and-brace is a byte-compiled
function defined in latex.el.
Signature
(LaTeX-insert-corresponding-right-macro-and-brace LMACRO LBRACE &optional OPTIONAL PROMPT)
Documentation
Insert right macro and brace correspoinding to LMACRO and LBRACE.
Left-right association is determined through
LaTeX-left-right-macros-association and TeX-braces-association.
If brace association can't be determined or TeX-arg-right-insert-p
is nil, consult user which brace should be used.
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defun LaTeX-insert-corresponding-right-macro-and-brace
(lmacro lbrace &optional optional prompt)
"Insert right macro and brace correspoinding to LMACRO and LBRACE.
Left-right association is determined through
`LaTeX-left-right-macros-association' and `TeX-braces-association'.
If brace association can't be determined or `TeX-arg-right-insert-p'
is nil, consult user which brace should be used."
;; This function is called with LMACRO being one of the following
;; possibilities.
;; (1) nil, which means LBRACE is isolated.
;; (2) null string, which means LBRACE follows right after "\" to
;; form "\(" or "\[".
;; (3) a string in CARs of `LaTeX-left-right-macros-association'.
(let ((rmacro (cdr (assoc lmacro LaTeX-left-right-macros-association)))
(rbrace (cdr (assoc lbrace TeX-braces-association))))
;; Since braces like "\(" and "\)" should be paired, RMACRO
;; should be considered as null string in the case (2).
(if (string= lmacro "")
(setq rmacro ""))
;; Insert right macros such as "\right", "\bigr" etc., if necessary.
;; Even single "\" will be inserted so that "\)" or "\]" is
;; inserted after "\(", "\[".
(if rmacro
(insert TeX-esc rmacro))
(cond
((and TeX-arg-right-insert-p rbrace)
(insert rbrace))
(rmacro
(insert (completing-read
(TeX-argument-prompt
optional prompt
(format "Which brace (default %s)"
(or rbrace ".")))
TeX-left-right-braces
nil nil nil nil (or rbrace ".")))))))