Zengxu Yang <moonlight.y...@gmail.com> writes: > RefTeX TOC scans words in verbatim environments, too. And this makes TOC > incorrect. For example, > > \documentclass{article} > > \begin{document} > \section{First} > \label{sec:first} > > \section{Second} > \label{sec:second} > > \begin{verbatim} > \section{Third} > \end{verbatim} > > \section{Last} > \label{sec:last} > > \end{document} > > Section "Third" is in a verbatim environment and should not be shown > in RefTeX TOC. But the RefTeX TOC buffer is shown as: > > TABLE-OF-CONTENTS on ~/Documents/test/emacs/reftextest.tex > SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help > ------------------------------------------------------------------------------ > 1 First > 2 Second > 3 Third > 4 Last > > Verified using Emacs 24.4 with AucTeX 11.87 on Debian 8. > > The best solution is skipping scanning all predefined and user defined > verbatim environments in AucTeX(for example, verbatim, Verbatim, > minted).
(I'm going through old bug reports that unfortunately weren't resolved at the time.) I can confirm what you describe. But I'm not sure if hacking RefTeX to ignore the verbatim environments is worth the effort. You can easily achieve this by using a package like fancyvrb and use its "gooble" key for the environment in question where you comment out the \section, e.g.: --8<---------------cut here---------------start------------->8--- \documentclass{article} \usepackage{fancyvrb} \begin{document} \section{First} \label{sec:first} \section{Second} \label{sec:second} \begin{Verbatim}[gobble=2] % \section{Third} \end{Verbatim} \section{Last} \label{sec:last} \end{document} %%% Local Variables: %%% mode: latex %%% TeX-master: t %%% End: --8<---------------cut here---------------end--------------->8--- and you get the following RefTeX TOC: --8<---------------cut here---------------start------------->8--- TABLE-OF-CONTENTS on ~/path/to/file.tex SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help ------------------------------------------------------------------------------ 1 First 2 Second 3 Last --8<---------------cut here---------------end--------------->8--- So I think this is a "wontfix", therefore I'm closing this report. Best, Arash _______________________________________________ bug-auctex mailing list bug-auctex@gnu.org https://lists.gnu.org/mailman/listinfo/bug-auctex