A latex environment looks like this:
\begin{envName}
body
\end{envName}
Is there a command to jump back-and-forth between matching \begin
and \end
commands? (One cannot simply use a regex search because environments can be nested)
LaTeX-find-matching-begin
and LaTeX-find-matching-end
functions do this.
AUCTeX offers keyboard shortcuts for moving point to the beginning
and to the end of the current environment.
-- Command: LaTeX-find-matching-begin
('C-M-a') Move point to the '\begin' of the current environment.
-- Command: LaTeX-find-matching-end
('C-M-e') Move point to the '\end' of the current environment.
C-M-a
and C-M-e
are bound to beginning-of-defun
and end-of-defun
resp. in most modes and they are available in every mode, not just LaTeX-mode. They are supposed to do the "right" thing in each case: e.g. C-M-a
moves to the beginning of the environment in LaTeX-mode, the beginning of a function in C mode, the beginning of a defun (doh!) in emacs-lisp-mode and so on.