bug#41841: 26.3; reftex and tikz's labels

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#41841: 26.3; reftex and tikz's labels

Tassilo Horn-6
phs <[hidden email]> writes:

> It seems reftex mistakes labels in tikz nodes with genuine \label 's
> in LaTeX source.
>
> To reproduce:
>
> 1) open a buffer foo.tex in LaTeX mode
>
> 2) insert (via cut&paste) the following text
>
> \begin{figure}
> \begin{tikzpicture}
> \node at (0,0) [label={node 0}] % not a LaTeX label
> \end{tikzpicture}
> \caption{Figure that!}
> \label{myfigure} % only genuine label
> \end{figure}

Does adding "tikzpicture" to
reftex-label-ignored-macros-and-environments work?

--8<---------------cut here---------------start------------->8---
reftex-label-ignored-macros-and-environments is a variable defined in ‘reftex-vars.el’.
Its value is nil

  You can customize this variable.
  This variable was introduced, or its default value was changed, in
  version 24.4 of Emacs.

Documentation:
List of macros and environments to be ignored when searching for labels.
The purpose is to ignore environments and macros that use keyval
style label=foo arguments, but the label has a different meaning
than a \label{foo}.  Standard \label{...} definitions are never
ignored.

E.g., TikZ defines several macros/environments where [label=foo]
defines the label to be printed at some node or edge, but it’s
not a label used for referencing.

Note that this feature is only supported if you are using AUCTeX
and the functions ‘TeX-current-macro’ and
‘LaTeX-current-environment’ are bound.  Also note that this
feature might slow down the reftex parsing process for large TeX
files.
--8<---------------cut here---------------end--------------->8---

In what's going to become Emacs 27.1, we are a bit more conservative and
have a whitelist of environments in which we look for label=foo options.
There, the bug doesn't happen anymore, so I'm closing this bug.

Thanks,
Tassilo



Reply | Threaded
Open this post in threaded view
|

bug#41841: 26.3; reftex and tikz's labels

phs-2
On 2020/06/14 22:17, Tassilo Horn wrote:

> Does adding "tikzpicture" to
> reftex-label-ignored-macros-and-environments work?

Yes, it works perfectly, even in my setup where I don't use AucTeX. Thanks!

Emacs is so full of options, it can do everything if you just know how
to use it properly.

I feel full of shame for posting a bug report about that. Sorry...

--phs



Reply | Threaded
Open this post in threaded view
|

bug#41841: 26.3; reftex and tikz's labels

Tassilo Horn-6
phs <[hidden email]> writes:

>> Does adding "tikzpicture" to
>> reftex-label-ignored-macros-and-environments work?
>
> Yes, it works perfectly, even in my setup where I don't use
> AucTeX. Thanks!
>
> Emacs is so full of options, it can do everything if you just know how
> to use it properly.
>
> I feel full of shame for posting a bug report about that. Sorry...

No need to feel ashamed!  I think I've implemented that feature but
still I had to check the code in order to be sure.

Bye,
Tassilo