Is there a way to display something like table of content of my current latex file in separate buffer, where all sections, subsections, figures and tables are listed interactively? So I could instantly jump to the piece just by clicking on it's link.
1 Answer
Yes there is such a way, and it is called reftex
!
It should be included with your auctex installation. To start it, simply add the following in your .emacs
and restart emacs :
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
reftex
has many features, including easily insertion of labels, citations and references, AND an interactive table of contents. To access it, type C^c =
. In the table of contents, use Enter
to go to the selected section and close the ToC, Tab
to go there without closing the ToC.
There are several other keys available, to show for example labels and crossref, you can find a small list at the bottom of the ToC buffer, or a complete list by typing ?
.
-
Thank you, that is very nice and it will be very handy. Is it possible to include in ToC tables and figures even if they are not labeled?– BaranasCommented Nov 17, 2012 at 11:23
-
I doubt it would be easy, since reftex relies on the
\label
commands to find it. Anyway, what's the point of having unlabelled figures or tables? Commented Nov 17, 2012 at 12:04 -
I am working with other people latex documents and sometimes they leave floating objects unlabeled and refer to them with text. So if You say it is possible I will find a way. Again, thank you.– BaranasCommented Nov 17, 2012 at 22:41
-
@user21710 : That problem isn't really relevant to the present question, but if you want a starting point, I'd say the "easiest" way would be to write a short elisp macro searching e.g. for
\end{figure}
, checking if the environment contains a\label
, and add one if needed. Or to do this by hand if there aren't many figures involved. And don't forget to explain your coworkers why labelling figures is easy (even if I doubt they're using emacs) and good-practice. Commented Nov 17, 2012 at 22:55