# Closing Environments in TeXstudio

Is there any command and/or hotkey in TeXstudio to close open environments? I know this feature from HTML or programming editors. For the editor almost no language knowledge is necessary for this. TeXstudio simply has to look for the latest \begin with no \end and include the command to end it.

I think that writing the same stuff over and over again is annoying work that can be easily saved with such a feature...

And if there is not such a thing, where can I propose it?

• TeXStudio and TeXMaker are quite rudimentary in what they can do. You might want to have to look at Emacs+AucTeX if you want something that can really edit LaTeX. But Emacs is not easy to work with. On the other hand adding refTeX and you will also have multiple file parsing and reference handling, which ius missing in TM and TS. – daleif Oct 16 '13 at 11:46
• Emacs+AucTeX is definitely a nice thing. I had this before and thus I am missing some cool features ;) However, it had some disadvantages that made me change to TeXstudio. I don't know, haven't really found my final tool yet... – monoceros84 Oct 16 '13 at 13:04
• which disadvantages? – daleif Oct 16 '13 at 17:44
• Well, the line breaking within a paragraph to display all the text in the window was realized by adding hard line breaks. Copying this text into other programs always made me removing the line breaks manually. Another issue: master files had to be mentioned by a comment in each file of the project. A real project management was missing. This was an annoying fact when sharing documents with colleagues. And last but not least: the keyboard control was not always faster than using a mouse. Sometimes it was really cumbersome what would have been solved with a little mouse click. – monoceros84 Oct 17 '13 at 8:22
• Well, most people I know dislike those online paragraphs. In a LaTeX context with synctex, sorter lines are better. But AFAIK it is just a configuration issue. I like the fact that the master is set in the files them selfs, no need for external files in some arcane format. The only (latex) editor I know of that has a project manager is TeXnicCenter. TeXMaker and TeXStudio has very basic project features. Do you mind explaining the last comment? – daleif Oct 17 '13 at 11:43

Just move the cursor somewhere after the opened environment and press alt+return and then the last opened environment will be closed.

This option can be found on Idefix > Complete menu.

Another option is to use the autocompletition to always write the \end-part when typing the \begin. Try to type doc in your editor window and then click Idefix > Complete > \begin complete (or something similar I got the german version only). You can assign a shortcut to this feature in the editor’s preferences. This will start the environment completition

and then press Enter to get

\begin{document}
Content...
\end{document}

• Thanks! You can even avoid the "\begin{". Just type "doc" and hit Ctrl-Alt-Space. ;) However, sometimes I need exactly to case mentioned above. But we got an answer for this as well... – monoceros84 Oct 16 '13 at 13:02
• I said, that doc is enough I just didn’t wrote the short cut ;-) – Tobi Oct 16 '13 at 14:53
• Oh, right. Sorry :) – monoceros84 Oct 17 '13 at 8:14