GNU bug report logs - #32442
26.1; reftex: TOC problems with section titles containing double quotes

Previous Next

Package: auctex;

Reported by: pichler <at> ieee.org

Date: Tue, 14 Aug 2018 21:08:01 UTC

Severity: normal

Found in version 26.1

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Arash Esbati <arash <at> gnu.org>
To: Peter Pichler <dr.peter.pichler <at> t-online.de>
Cc: pichler <at> ieee.org, 32442 <at> debbugs.gnu.org
Subject: bug#32442: 26.1; reftex: TOC problems with section titles containing double quotes
Date: Sun, 19 Aug 2018 20:34:51 +0200
Peter Pichler <dr.peter.pichler <at> t-online.de> writes:

> Am 15.08.2018 um 21:49 schrieb Arash Esbati:
>> Hi Peter,
>> I think this is RefTeX's subtle way to say: "Please also update your TeX
>> distro to latest TeXlive or MikTeX, change your file to this and use
>> UTF8 encoding with `C-x RET f prefer-utf-8 RET'":
>>
>>      \documentclass{article}
>>      \usepackage[ngerman]{babel}
>>
>>      \usepackage[T1]{fontenc}
>>      \usepackage{lmodern}
>>
>>      \begin{document}
>>
>>      \tableofcontents
>>
>>      \section{Könige}
>>      \label{sec:konige}
>>      Könige sind selten.
>>
>>      \end{document}
>>
>> Yes, this seems to be a bug, thanks for the report.  But I can't tell
>> why.  Will try to investigate, someday :-)

Hi Peter,

please keep 32442 <at> debbugs.gnu.org in CC, thanks.

> actually, it is the other way round ;-) Because I had to update my
> MikTeX version, I also had to update to a more recent emacs/auctex
> installation. I am aware that I could use the äöüß instead of "a
> etc. but the last time this resulted in serious problems with
> spellchecking which I could not resolve within reasonable time.

Then I suggest you give it a new try and fix this issue.

> In the meanwhile, I tried to find find out what happened. It appears
> that the problem occurs in the function reftex-context-substring
> called in line 19 of the function reftex-section-info which is called
> in turn in line 73 of the function reftex-parse-from-file. Without
> double quotes, the (up-list 1) in line 23 of the function
> reftex-parse-from-file works normally and the argument of the section
> command is extracted correctly. If the argument of the section command
> contains double quotes, the (up-list 1) results in an error and
> reftex-parse-from-file takes the 150 characters (or until eof)
> beginning with the argument of the section command. Strangely enough,
> up-list called interactively or out of an interactive function (even
> within the condition-case) causes no problems at all. Unfortunately,
> this erratic behavior exceeds my experiences with emacs-lisp by far
> and I hope, you have more luck.

You were on the right track here.  This behavior isn't erratic when you
look at the definition of `reftex-parse-from-file'.  There you see that
the actual parsing is done inside a `reftex-with-special-syntax'.  This
macro saves the current syntax table, activates the one called
`reftex-syntax-table', does the job and restores the saved one.

`reftex-syntax-table' is defined like this:

    (setq reftex-syntax-table (copy-syntax-table))
     (modify-syntax-entry ?\( "." reftex-syntax-table)
     (modify-syntax-entry ?\) "." reftex-syntax-table)

Here you see that it doesn't touch the syntax for `"' which is used to
delimit string constants.  With this setup, `K"onig' seems to `up-list'
like a string `onig' which doesn't end, hence it doesn't work.  You can
easily fix this by writing `K\"onig', i.e., escaping the quote and it
works as expected.

But then again, I recommend you let OT1-encoded fonts and \"-constructs
go and try to fix the other issue.

Here the file I tested with:

    \documentclass{article}
    \usepackage[ngerman]{babel}

    \usepackage[T1]{fontenc}
    \usepackage{lmodern}

    \makeatletter
    \let\Gobble\@gobble
    \makeatother

    \begin{document}
    \tableofcontents

    \section{Könige}
    \label{sec:konige}
    Könige sind selten.

    \section{K"onig}
    \label{sec:konige-1}
    K"onige sind selten.

    \section{K\"onig}
    \label{sec:konige-2}
    K"onige sind selten.

    \section{K"onige\expandafter\Gobble\string"}
    \label{sec:konige-3}
    K"onige sind selten.
    \end{document}

Best, Arash




This bug report was last modified 6 years and 207 days ago.

Previous Next


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