Subject: bug#59638: 13.0.9; reftex-toc counts incorrectly if section is commented out

From: Tassilo Horn <[email-masked]>
Date: Mon, 28 Nov 2022 07:00:22 +0100

Uwe Brauer <[email-masked]> writes:

Hi Uwe,

> \section{First}
> %\section{Second}
> \section{Third}
>
> \end{document}
>
> reftex-toc
>
> Results in 
>
>      1 First
>      3 Third
>
> Which is wrong, the counting should give 
>
> 1 First
> 2 Third
>
> It gets worse if the document contains a lot of commented out sections.
> Any idea what to do?

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?

Anyway, you could also try to change reftex-section-pre-regexp from
"\\\\" to "[^%]+[ \t]*\\\\" which might do the trick.

Bye,
Tassilo