[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting frame title in imenu
From: |
Ikumi Keita |
Subject: |
Re: Getting frame title in imenu |
Date: |
Fri, 21 Aug 2020 20:22:48 +0900 |
Hi Mandar,
>>>>> Mandar Mitra <mandar.mitra@gmail.com> writes:
> When preparing a presentation using Beamer, I'd like the frame
> titles to be listed in imenu, along with section names. I use
> the \begin{frame}[optionals]{Frame title here} form, rather than
> a separate \frametitle (and would rather not change that habit
> if I can help it).
> So I customised TeX-outline-extra to
> '(("^\\\\begin{frame}\\(\\[[a-z,]+\\]\\)?" 3))
> As far as I can tell, LaTeX-outline-name (called from
> LaTeX-imenu-create-index-function to "Guess a name for the
> current header line.") starts from the beginning of the
> match and skips forward to the first "{". It thus ends up
> picking "frame" as the header line which is not useful.
> I suppose I could use imenu-generic-expression with
> imenu-default-create-index-function -- that allows me to
> explicitly say which part of the match I want to pick out
> as the header -- but then I'd have to convert
> latex-outline-regexp to the structure used by
> imenu-generic-expression.
> Is there any other easy workaround that I'm missing?
> Grateful for any help, thanks!
Considerting bug#32062 [1] as well, it might be nice if AUCTeX offers a
way to customize `LaTeX-outline-name'.
I incorporated the idea of Omar, the reporter of bug#32062, to make up
the attached patch. With this change, you can prepare your own function
to extract titles of \section etc. or \begin{frame} depending on the
context, and use it for `LaTeX-outline-name-function' like this:
(defun my-LaTeX-section-or-frame-title ()
...
SOME FUNCTION TO EXTRACT TITLES OF section OR frame
...
)
(setq LaTeX-outline-name-function #'my-LaTeX-section-or-frame-title)
I didn't test my patch. I'm sorry if it doesn't work.
Regards,
Ikumi Keita
[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32062
patch
Description: patch for latex.el