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.


7 Answers 7


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

  • 1
    Are there any drawbacks to folding? E.g. does it ever hide anything that might be better left unhidden? Commented Apr 17, 2012 at 21:12
  • @QuinnCulver I have not encountered any obvious drawbacks in using it. As mentioned, folded items unfold as the cursor is placed on them. Also, I think the folded look is clear enough to show its meaning. Finally, it is easy to switch between folded and unfolded items for the whole buffer and parts of it, e.g. use C-c C-o b to unfold the whole buffer.
    – N.N.
    Commented Apr 18, 2012 at 6:08
  • @N.N. for me folding the buffer is actived via C-c C-o C-b. C-o C-s C-b didn't work.
    – maetra
    Commented Apr 19, 2012 at 9:48

Org-mode's radio tables are an easy, simple and fast way to create tables within Emacs/AUCTeX. They offer all of the calculation capabilities of the org-mode spreadsheets, which can be very convenient if need simple, auto-updating data.

The source org-table can be placed within a comment environment using the comment package, or after \end{document}. The radio table can be placed anywhere in the document by surrounding it with


The table will be automatically generated in LaTeX format within those two tags and will be updated every time the org-table is updated. Activating the orgtbl-mode (minor mode) will make it easier to edit the org-table within AUCTeX.

Radio Tables explanation

As requested, a brief explanation of what radio tables are and a link to where more info can be found:

Radio tables are a way of using Org-mode's tables in any mode within Emacs. The idea behind them is that one should be able to create a table in any mode (i.e. LaTeX-mode) while still using Org's syntax in a minor orgtbl-mode AND without generating errors with the major mode. This means that there will be a "source table" in Org syntax, a "target table" in the required syntax (i.e. LaTeX syntax) and a translator function to convert from one to the other and to place the table in the proper place. In a sense, the table is sent to its final place via the translator function, much like a radio signals are sent from the transmitter to the receptor.

In the case of radio tables, the "receptor" is defined by two lines that are comments in the major mode that we are working in. For LaTeX mode, those two lines take the form written above. Then, the source table is created elsewhere, with a special line atop of it, in the form of

#+ORGTBL: SEND table_name translation_function arguments....

Now, if the source table in Org syntax will definitely cause errors if placed as-is within the LaTeX document, so two ways to deal with this are to either send it past the \end{document} line, grouping all the source tables towards the end of the document and separating them from their target tables, or wrapping them in a comment environment, defined by the comment package, which would allow to keep the source tables close to the targets.

As for the translator function, Org-mode provides a very basic generic translator function that will give good enough tables. This translator function can be modified to fit the user's need.

Here's a link to the official documentation: http://www.gnu.org/software/emacs/manual/html_node/org/Radio-tables.html#Radio-tables

  • This is incredible, seems we have a table calculation inside orgmode, which can produce LaTeX-Tables. For the record: the documentation is in the annex of the manual. I never read that.
    – Keks Dose
    Commented Apr 17, 2012 at 16:07
  • 1
    Here's a quick link to a step-by-step example: gnu.org/software/emacs/manual/html_node/org/….
    – Ricardo
    Commented Apr 17, 2012 at 16:58
  • 2
    @Ricardo You might want to include or link to an explanation of what radio tables are for those who do not know.
    – N.N.
    Commented Apr 19, 2012 at 12:08
  • @N.N. Done and done! Let me know if I should go into more detail or if the explanation reads clearly enough.
    – Ricardo
    Commented Apr 20, 2012 at 21:52

This is a very sensible question! You know, there are many tricks to discover, which make live easier. My top 3 list:

  1. M-q: Justify the current paragraph (or region if set), with respect to the fill-column variable [Couldn't do without, but it took me weeks to discover]
  2. C-l: Recenter the cursor (one hit puts the current line in the center of the screen, next hit will put it on the top of the screen, next it at the bottom). [learned it in the tutorial; nice, don't want to write on the bottom of screen]
  3. M-x align-current: Emacs aligns the table, mostly it becomes better, if not, use C-x u to undo.

Besides that: When I'm writing complicated stuff while thinking about it, I'm using org-mode.

  • 5
    Could you perhaps explain what these commands do?
    – Seamus
    Commented Apr 21, 2012 at 10:45

M-x LaTeX-fill-environment and M-x LaTeX-fill-buffer are very useful when editing other peoples code (generalisations of M-q, been using AUCTeX for years and did not know about it).

I love (C-u) C-c C-e and never understood why it hasn't been copied by others.

M-x reftex-change-label and the other refTeX global actions has also proved very handy.

I recently learned how to reconfigure refTeX such that it can provide environment dependent label prefixes, very handy when editing a document that did not use labels, and you would like to use fancyref.

I've also started writing my own macros in order to make editing easier. It is actually a lot of fun (frustrating at times, but fun)

One thing I'd like to have added to the LaTeX-fill-X macroes is that it should make sure all \\ (inclusing *, *[..] or [...]) stood on lines of their own, and the same thing for \begin/end{env} (+plus envs). That would make other peoples code a lot easier to read.

BTW: does anyone know of a set of paren matching macros where one can define what a matching pair of parens are? I'm currently using mic-paren.el, but it is not particularly good at getting matched sets of \{\} or \lbrace\rbrace


I used the customize interface, M-x customize-variable RET reftex-label-alist, then say for proposition I have: proposition, P, prop:, \Fref{%s}, meaning that for only showing propositions when refering I type P, that the prefix will be prop: and that a reference will be of the form \Fref{...}. Remember to also edit reftex-insert-label-flags, there I have s, and sftTCEXLPiD

  • Note that you may want to avoid M-x LaTeX-fill-buffer since there are things common in LaTeX files that Emacs indent poorly, such as TikZ code. Have you got a link for how to configure RefTeX to use environment dependent label prefixes? Does tex.stackexchange.com/questions/15310/… cover the general idea? Finally, it might be better to post your question as a question rather than including it in the answer.
    – N.N.
    Commented Apr 17, 2012 at 11:09
  • I know about the LaTeX-fill-buffer problem, it also messes things up if there is a preamble in the file.
    – daleif
    Commented Apr 17, 2012 at 15:45
  • 2
    Just found the answer to the LaTeX-fill-bufffer and tikz problem. Customize the LaTeX-indent-environment-list and add tikzpicture and scope, very handy
    – daleif
    Commented Jul 4, 2012 at 9:31
  • Note that by default, LaTeX-fill-paragraph and LaTeX-fill-region functions are bound to M-q in AUCTeX-mode. See gnu.org/software/auctex/manual/auctex/Filling.html
    – T. Verron
    Commented Apr 24, 2013 at 8:58

I just found this: C-c = makes a buffer with the TOC of the document appear which allows you select and navigate through your document.

  • 1
    C-c + or C-c =? Actually, this is a RefTeX feature, not an AUCTeX one.
    – giordano
    Commented Apr 23, 2014 at 8:54
  • thx. just edited my post. hf with it.
    – Vincent
    Commented Apr 23, 2014 at 8:55

I recommend the very intuitive (at least for me) CDLaTeX minor mode with AUCTeX if you input a lot of math.

Most of its functionality is achievable with any snippet mode, but it is convenient to have a package geared especially towards LaTeX which requires almost zero setup.


My init file is set up to save a lot of typing when typing mathematics; see my answer to How can I optimize the keyboard for frequent LaTeX input?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .