>>> "AE" == Arash Esbati writes: > Hi Tassilo, > Tassilo Horn writes: >> I'd call it a feature. I mean, when you have commented out sections, >> you'll most probably intend to uncomment them again. Otherwise, you >> could just delete them, no? Not really. Sometimes these constructions are the product of certain converters. So \section{Theorem 1: Global existence} instead of \begin{thm}[Global existence] \end{thm} I end up quicker commenting this stuff out..... > This feature was introduced with commit 1e8bb313ea in reftex.el. The > change was good to make RefTeX recognize sectioning macros in .dtx file, > but I'd consider the behavior in regular .tex files as wrong. What do > you think about this change: > diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el > index e72576cdc7..c72dd5fa07 100644 > --- a/lisp/textmodes/reftex.el > +++ b/lisp/textmodes/reftex.el > @@ -1005,9 +1005,13 @@ reftex-compile-variables > ;; Calculate the regular expressions > (let* ( > -; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*") > - (wbol "\\(^\\)%?[ \t]*") ; Need to keep the empty group because > - ; match numbers are hard coded > + ;; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*") > + ;; Need to keep the empty group because match numbers are > + ;; hard coded > + (wbol (concat "\\(^\\)" > + (when (string-suffix-p ".dtx" (buffer-file-name) t) > + "%") > + "[ \t]*")) > (label-re (concat "\\(?:" > (mapconcat #'identity reftex-label-regexps "\\|") > "\\)")) I can try to test this later > @Uwe: Meanwhile, you can try to comment out your sections like this: > %% \section{foo} > and you should get a correct TOC. Confirmed thanks Uwe -- Warning: Content may be disturbing to some audiences I strongly condemn Putin's war of aggression against the Ukraine. I support to deliver weapons to Ukraine's military. I support the ban of Russia from SWIFT. I support the EU membership of the Ukraine. https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/