[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Behaviour of reftex-view-crossref

From: J . Xu
Subject: Re: Behaviour of reftex-view-crossref
Date: Fri, 22 Sep 2023 10:15:13 -0500
User-agent: mu4e 1.8.11; emacs 29.1

On Fri, 22 Sep 2023, Arash Esbati <> wrote:

> J. Xu <> writes:
>> reftex-view-crossref currently only finds reference to the current space
>> delineated word.  For example, if I'm at (* being the point)
>> \ref{foo *bar}
>> and run reftex-view-crossref, it would find the definition of "bar"
>> instead of "foo bar".
>> I wonder if this behaviour is intended?
> Yes, this is the intended behavior in terms of "this is what the code
> does": `reftex-view-crossref' starts like this:
> (defun reftex-view-crossref (&optional arg auto-how fail-quietly)
>   (interactive "P")
>   ;; See where we are.
>   (let* ((macro (car (reftex-what-macro-safe 1)))
>          (key (reftex-this-word "^{}%\n\r, \t"))
>     ...
> The label key is extracted by `reftex-this-word' which is asked to
> ignore spaces with "^{}%\n\r, \t".  I'm not sure if spaces were always
> allowed in labels, but they are by now (also other characters besides
> ASCII, IIRC).  So we probably should fix this and allow spaces.  But
> then we have to know what LaTeX does with linebreaks inside the \label
> argument, i.e.:
> \label{foo
>   bar}
> I haven't tested this.  Is LaTeX's behavior in this regard documented
> somewhere?

I couldn't find related documentation.  I did a quick test and it looks
like a linebreak, carriage return, or tab is essentially converted to a
space.  Specifically, the following pair works:

\ref{foo bar}

> And if we touch this, we should also change `reftex-label-illegal-re'.
> Personally, I recommend to use only this range [-a-zA-Z0-9_+=:;,.] for
> label names and be done with it.

Agreed.  This issue only came up because I'm working on someone else's
manuscript.  Oof, much pain.

> Best, Arash

reply via email to

[Prev in Thread] Current Thread [Next in Thread]