I use imenu in auctex. For beamer slides, it only offers me the \section-commands as entry points. How can I teach imenu to also offer all frames? (Which is an environment: \begin{frame}....\end{frame}?

You need to make AUCTeX aware of the frame environment, i.e., \frametitle:

(add-to-list 'TeX-outline-extra '("\\\\frametitle\\b" 4))


From the documentation on Tex-outline-extra:

List of extra TeX outline levels.

Each element is a list with two entries. The first entry is the regular expression matching a header, and the second is the level of the header. See ‘LaTeX-section-list’ for existing header levels.

Similarly, you need to explicitely tell reftex to show \frametitle in its TOC:

(setq reftex-section-levels '(("part" . 0)
("chapter" . 1)
("section" . 2)
("subsection" . 3)
("subsubsection" . 4)
("frametitle" . -3)
("paragraph" . 5)
("subparagraph" . 6)

• This is great, thank you! But I use frame environments. I tried: (add-to-list 'TeX-outline-extra '("\\\\begin{frame}{\$$.*?\$$}" 4)). The result is a list with items all named 'frame', and they all point to the first frame. So how can I tell imenu which part of the regexp contains the header name? And how do I teach imenu to jump to the corrseponding line? Nov 13 '17 at 8:04
• If you instead use (add-to-list 'TeX-outline-extra '("\\\\begin{frame}\$$\$.*\$\$$?" 4)) the entries in imenu will point to different frames. Still their title doesn't show up there.
– Timm
Nov 13 '17 at 9:02
• Thanks, I'll accept that answer. The solution still is not perfect, maybe someone finds out how to add the frame title to the imenu listing. Nov 14 '17 at 9:42

I use some dummy commands to mark my outline. The solution is not perfect, but it is usable.

I configure TeX-outline-extra this way:

(add-to-list 'TeX-outline-extra '("imenu" 1))


In my tex file I add:

\newcommand{\imenu}[1]{#1}


Now I can add an outline level anywhere, like this:

\begin{homeworkProblem}[\imenu{The first problem}]


I know this question is more than 2 years old, but I had the same question myself, and none of the above answers worked for me. Here's the workaround I used.

I think auctex sets imenu-create-index-function to LaTeX-imenu-create-index-function. In my LaTeX-mode-hook, I reset it as shown below and use a variant of the regexps given in the answers above.

(setq-local imenu-create-index-function
"^\\\\begin{frame}\$$\$[a-z,]+\$\$$?{\$$.+\$$}"