J. Xu <x...@stat.wisc.edu> 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.:


I haven't tested this.  Is LaTeX's behavior in this regard documented

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.

Best, Arash

Reply via email to