Subject: bug#36111: Support cleveref labels in AUCTeX and RefTeX

From: Arash Esbati <[email-masked]>
Date: Mon, 10 Jun 2019 21:40:18 +0200

Ryan Kavanagh <[email-masked]> writes:

Hi Ryan,

thanks for your response.  Please keep [email-masked] in Cc, thanks.

> I saved the attached file to
>
>     /home/rak/.emacs.d/tex-styles/cleveref.el
>
> I added
>
>     (setq TeX-style-private '("/home/rak/.emacs.d/tex-styles"))
>
> to my ~/.emacs and after restarting, describe-variable shows that this
> change took effect. The file also seems to be loaded:
>
>     TeX-active-styles is a variable defined in ‘tex.el’.
>     Its value is ("cleveref" "plain10" "plain" "latex2e" "f" "LATEX")

I don't have complete TeXlive installed, but is there a plain.cls
available somewhere?  It doesn't make a difference for this case, was
just curious.

> Unfortunately, it does not seem to work. Moving my cursor to "HERE" and
> calling reftex-label inserts "\label{eq:1}" instead of "\label{eq:2}".
> Here is my test file.
>
> ------8<------
> \documentclass{plain}
> \usepackage{cleveref}
> \crefname{test}{test}{test}
> \begin{document}
> \begin{equation}
>   \label[test]{eq:1}
> \end{equation}
> \begin{equation}
>   HERE
> \end{equation}
> \end{document}
> ------8<------

Your example above works for me.  I suspect that AUCTeX is still loading
the old style.  Can you please restart Emacs, load your test .tex file
and hit `C-h e', and check from which directory the file cleveref.el is
loaded?

> On the off-chance it was due to interference from the bundled copies of
> cleveref.el, the following changes of permissions didn't help:
> mode of '/home/rak/.emacs.d/elpa/auctex-12.1.2/style/cleveref.el' changed from 0644 (rw-r--r--) to 0000 (---------)
> mode of '/home/rak/.emacs.d/elpa/auctex-12.1.2/style/cleveref.elc' changed from 0644 (rw-r--r--) to 0000 (---------)

See above, I don't think permissions are relevant here (besides
reading).

Best, Arash