10

When using web-mode, typing a </ will autocomplete with the highest level open tag name. For example, if I have an open <div>, </ will be autocompleted to </div>.

Is it possible to get the same thing in LaTeX? For example, if I have a \begin{foo} tag, how can I make emacs autocomplete an \end or \end{ to \end{foo}?

16

In the built-in latex-mode, C-c C-e runs latex-close-block, which closes the highest level open block. No need to type the \end first.

If you're using AUCTex, C-c ] does the same thing, or you can use C-c C-e to insert a matched \begin, \end pair.

  • 1
    What about the matching parenthesis or the matching \left( \right)? – Vivi Sep 13 '15 at 11:17
  • 1
    I don't know an out the box way to do this. Maybe something can be rigged up out of autopair or electric-pair-mode? This would make a good question. – erikstokes Sep 13 '15 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.