[Tex/LaTex] your favorite Emacs and/or AUCTeX command/trick


What is your favorite Emacs and/or AUCTeX command/trick?

The point here is that I don't know what I don't know. I'm an Emacs and AUCTeX user looking to improve my Emacs & AUCTeX use, especially regarding efficiency. I've been using the Emacs–AUCTeX combo for a while (4–5 years) and have a well-established routine at this point. I'm quite satisfied with this combo, but often wonder if I'm doing something in an inefficient way without even knowing it.

Thus I am I hoping to learn, for example, some ideas for things to add to my .emacs file or new shortcut keys (though I suspect I already know most of those). So if you have a tip you think I (and others) might benefit from, please share it.

Best Answer

Finding tips

It is hard to say what the best tips is for you. Especially if you do not give a more detailed description of your workflow. The best way to find this might be to read the manual from cover to cover. Also make sure to read the RefTeX manual since it is included in Emacs and you should use its commands for handling citations and cross-references. Other places to find tips is to peek at other peoples .emacs and go through , , and the equivalent tags on Stack Overflow and Super User.

Learning and configuring Emacs is a never-ending process as described in A simpleton's guide to (...)TeX workflow with emacs. Thus, you will learn more and more as you go. That you learn something new is not necessarily a sign of that you have been inefficient before that.

My tips

The following are some that tips I would like to share. They might be irrelevant for you and therefore the advice above might be the best.

  • Find the AUCTeX and RefTeX commands that are useful for you and learn them, see Useful shortcuts or key bindings or predefined commands for emacs+AUCTeX.

  • Use folding to fold macros and environments and it will be easier to focus on the content of your document. To use folding you have to activate TeX-fold-mode. This can be done by either activating it temporarily, by M-x TeX-fold-mode, or permanently, by placing the following in your .emacs

      (add-hook 'TeX-mode-hook #'TeX-fold-mode) ;; Automatically activate TeX-fold-mode.

In both cases you have to also do C-c C-o C-b to fold every item in the buffer (there are other commands to fold parts of buffers). Here follows a simple buffer without folding:

A simple LaTeX buffer with unfolded items

The following is the same buffer but with folding. If the cursor is placed on a folded item it is unfolded, e.g. if the cursor is placed on an emphasized part it unfolds to \emph{an emphasized part}.

A simple LaTeX buffer with folded items