GNU bug report logs - #19624
RefTeX TOC should not scan words in verbatim environments

Previous Next

Package: auctex;

Reported by: Zengxu Yang <moonlight.yang <at> gmail.com>

Date: Mon, 19 Jan 2015 01:20:02 UTC

Severity: normal

Tags: wontfix

Done: Arash Esbati <arash <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19624 in the body.
You can then email your comments to 19624 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-auctex <at> gnu.org:
bug#19624; Package auctex. (Mon, 19 Jan 2015 01:20:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Zengxu Yang <moonlight.yang <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Mon, 19 Jan 2015 01:20:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Zengxu Yang <moonlight.yang <at> gmail.com>
To: bug-auctex <at> gnu.org
Subject: RefTeX TOC should not scan words in verbatim environments
Date: Sun, 18 Jan 2015 20:16:27 -0500
[Message part 1 (text/plain, inline)]
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).
[Message part 2 (text/html, inline)]

Information forwarded to bug-auctex <at> gnu.org:
bug#19624; Package auctex. (Mon, 04 Mar 2024 13:45:02 GMT) Full text and rfc822 format available.

Message #8 received at 19624 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Zengxu Yang <moonlight.yang <at> gmail.com>
Cc: 19624 <at> debbugs.gnu.org
Subject: Re: bug#19624: RefTeX TOC should not scan words in verbatim
 environments
Date: Mon, 04 Mar 2024 14:43:50 +0100
Zengxu Yang <moonlight.yang <at> 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




Added tag(s) wontfix. Request was from Arash Esbati <arash <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 04 Mar 2024 13:45:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 19624 <at> debbugs.gnu.org and Zengxu Yang <moonlight.yang <at> gmail.com> Request was from Arash Esbati <arash <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 04 Mar 2024 13:45:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 02 Apr 2024 11:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 38 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.