# Can emacs close open LaTeX tags automatically?

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}?

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.
• 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