Subject: bug#25853: [Reftex] Using the keyword label in a tikzpicture enviornment shows up incorrectly in reftex

From: Arash Esbati <[email-masked]>
Date: Fri, 24 Feb 2017 08:19:24 +0100

Nishan Singh Mann <[email-masked]> writes:

> When using a tikzpicture enviornment as follows
>   \begin{tikzpicture}
>     \matrix[]{
>                       % First row
>       \node[scale=1.3,label=below:(a)]
> {\input{./latex/CH4/dishole_schematic}}; &
>       \node[label=below:(b)~$20$~nm]
> {\includegraphics[scale=0.6]{./figures/CH4/hole_gen_dis_20}}; &
>       \node[label=below:(c)~$40$~nm]
> {\includegraphics[scale=0.6]{./figures/CH4/hole_gen_dis_41}}; \\ % end of
> row
>       \node[label=below:(d)~$160$~nm]
> {\includegraphics[scale=0.6]{./figures/CH4/hole_gen_dis_160}}; &
>       \node[label=below:(e)~$400$~nm]
> {\includegraphics[scale=0.6]{./figures/CH4/hole_gen_dis_400}}; &
>       \node[label=below:(f)~$800$~nm]
> {\includegraphics[scale=0.6]{./figures/CH4/hole_gen_dis_800}};\\
>             };
>   \end{tikzpicture}
>
> The label keyword used to label the node is picked up by Reftex as a
> valid label when the ref command is invoked. Perhaps one can avoid
> scanning for a 'label' keyword within a tikzpicture environment?

RefTeX provides a variable for this purpose:

,----[ C-h v reftex-label-ignored-macros-and-environments RET ]
| reftex-label-ignored-macros-and-environments is a variable defined in ‘reftex-vars.el’.
| Its value is nil
| 
| 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.
| 
| You can customize this variable.
| 
| This variable was introduced, or its default value was changed, in
| version 24.4 of Emacs.
`----

You can customize this variable and add "node" if you want to ignore the
macro or "tikzpicture" for the entire environment.

Best, Arash