From unknown Sat Jun 21 10:28:18 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#36111 <36111@debbugs.gnu.org> To: bug#36111 <36111@debbugs.gnu.org> Subject: Status: Support cleveref labels in AUCTeX and RefTeX Reply-To: bug#36111 <36111@debbugs.gnu.org> Date: Sat, 21 Jun 2025 17:28:18 +0000 retitle 36111 Support cleveref labels in AUCTeX and RefTeX reassign 36111 auctex submitter 36111 Ryan Kavanagh severity 36111 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 05 22:32:52 2019 Received: (at submit) by debbugs.gnu.org; 6 Jun 2019 02:32:52 +0000 Received: from localhost ([127.0.0.1]:48591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hYiCx-0007al-Tf for submit@debbugs.gnu.org; Wed, 05 Jun 2019 22:32:52 -0400 Received: from mail-qk1-f172.google.com ([209.85.222.172]:44409) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hYgHM-0000QO-1m for submit@debbugs.gnu.org; Wed, 05 Jun 2019 20:29:16 -0400 Received: by mail-qk1-f172.google.com with SMTP id w187so405392qkb.11 for ; Wed, 05 Jun 2019 17:29:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=DHzkjWZs3SDCcfY5rbEXeUuRfJ80Feq3lJ/MMXh5SqE=; b=pRqdsXyyb6i/idnosMRKGCZp8wyS0bzG0o6bLsW4xaXZEMza521SL2tWonsOHfJV+v W6hTuubnHonySpfsNGwT7Ui6lTJlf3kH9L5QDrFam5GJWn046RcnBZmr7MEQaRaSFhtj O3t1Jmrg/GZ/GJrMAM12FBNDf61H/UZHY1FfpDMgDBLybwvMtG4AZJC3JKxPj6Fv94I6 tKJOe9Rx7MSjoQ1/y4E6UORRQnh0lN5jNL4pXfb07j8R4ON7koCz+OJfPdcjgH+KbGV3 4q1GDJbnP4X1pX++WPeuMxtj7pCXgmtC28QWItuwEE0R7IUoanAh3GJo4eqiSIN8JY/V lPfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:subject:message-id :mime-version:content-disposition:user-agent; bh=DHzkjWZs3SDCcfY5rbEXeUuRfJ80Feq3lJ/MMXh5SqE=; b=ttMOlHGkO6CnCPUkMlbB2UgMngymVe+wWhCSrkeBPDwaDZGycaRijNUSKQxKTtO9Mz fzJ17bXkxD7FMtfBz1icqlFAS6XHID0tx0koDF5fkhQe1Kx7mbEuromhgSJwWmeZoU+U AaqFGwCnxKuYjaFbKJBd6UkqnUb+UXzAOmWScGADGQ0xbId0n0IWzXhTeijPLADgsGr1 tSUhJr0Gef9hLv2mD5ylmh/KXCDyBLuN/JCjJC7fhVdl0f5WaoLSAKmfnbgoN1z9TgM9 enwtmpfUKJrZTBu5F43YUGEL+lYSVgjdLd11gysW/paw4TFtq5/77dr8mmv7f8Bf5uZj s2dg== X-Gm-Message-State: APjAAAXjq/wdICh2jy6wuKfaIo0KBsR3axq48jM9hSJ3GQJxYUSxY5sA 0Qk6YzupnkPAapl30A4pFW+CwXCx X-Google-Smtp-Source: APXvYqyYj5GRWFldVH0wu5LNen7qjdQRI8F5+hE6gXuShiafIB77pZk6cxo/MNEwtNkZND0DRiiV/A== X-Received: by 2002:a37:7847:: with SMTP id t68mr32683339qkc.128.1559780949999; Wed, 05 Jun 2019 17:29:09 -0700 (PDT) Received: from zeta.rak.ac (c-98-239-128-52.hsd1.pa.comcast.net. [98.239.128.52]) by smtp.gmail.com with ESMTPSA id q29sm97890qkq.77.2019.06.05.17.29.08 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Jun 2019 17:29:08 -0700 (PDT) Date: Wed, 5 Jun 2019 20:29:08 -0400 From: Ryan Kavanagh To: submit@debbugs.gnu.org Subject: Support cleveref labels in AUCTeX and RefTeX Message-ID: <20190606002908.u74zvkvayshbhba2@zeta.ryanak.ca> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="wr2m2xdhqoz76pr2" Content-Disposition: inline X-message-flag: Please do NOT send HTML e-mail or MS Word attachments - use plain text instead X-GPG-ID: 0x8F7BF8FC4A11C97A X-GPG-Fingerprint: 4E46 9519 ED67 7734 268F BD95 8F7B F8FC 4A11 C97A User-Agent: NeoMutt/20180716 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 05 Jun 2019 22:32:50 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --wr2m2xdhqoz76pr2 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Package: auctex Severity: wishlist I use the cleveref package, which allows annotating \label commands with an optional argument. Unfortunately, this prevents both AUCTeX and RefTeX from detecting those labels. To illustrate, here is some LaTeX code from which AUCTeX and RefTeX fail to extract the label "eq:23": \usepackage{cleveref} \crefname{diagram}{diagram}{diagrams} % ... \begin{equation} \label[diagram]{eq:23} 1 =3D 1 \end{equation} This is problematic, because the function reftex-label will reuse the label "eq:23". I am not sufficiently familiar with emacs lisp to submit a patch, but I think I have found some of the places that should be updated: * The variable LaTeX-auto-label-regexp-list in latex.el * The function reftex-parse-from-file hardcodes the prefix "\\label{". Perhaps this could be a customizable regexp? More details can be found in this question: https://tex.stackexchange.com/q/494337/6128 . Please add support for cleveref labels to AUCTeX and RefTeX. Best, Ryan --=20 |)|/ Ryan Kavanagh | GPG: 4E46 9519 ED67 7734 268F |\|\ https://rak.ac | BD95 8F7B F8FC 4A11 C97A --wr2m2xdhqoz76pr2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQUzBAABCgAdFiEETkaVGe1ndzQmj72Vj3v4/EoRyXoFAlz4XlAACgkQj3v4/EoR yXpqkCgAqCEQzUez1diBeOnOYf0Ge1jwZMNvIFHpwt7FjEo8KdJLwIILKRVwiGk4 BMMMqABRK9ZJIzjON3rFHMTV+Qxjfz0nQjdvkxJnD8Zj006qDEAJ+ftg3iKOuyBL zxkNxXzZe3rkfXmAreMSf5Ymzl5Qij6l4FXCzxJBFKl4xI+Y3ZvLRJV1PK7h4u3S ADtJbtKNnW1hAy5bpug1IpOtH+lu5+x0W/9wGCgY4Pv6J/LYXo8vXJNVijDMK3De FmaZzuro/L0yVajIN7Rl0xBWhqGV8qpsn7ndMhXfSh8us5a9WVO5eOq+nLWbaCqL 294EIBhJXX+JjUJiTIIj6QqF/m6JmD4lHB4JRAzhcKViDyjLwnJLr3wVcPDmZNew 5XqDSMGhtlmPw6qppgXlUY1WxyrHitxmT2VUF78f65jesZ093TltRIQ0zN0WkN4w /dVRn6AfIeoHYR4juWBC9B0k8GuRvdM/fGZDmHAXnZG/r6VQWYOBHX2ktaJPlfno CE0vUc5j0GKM0lSOoXaqUqYQbZ33Bm7crJAtrbkp0gTstsGc7EQ7CUUFkS4SYLAD ys+JhmYHjbMYswcR7BNImarMqpIAtIFo9RtIv0iTm0VIk085PQhbJgLxrJgkEtpV NMWlvbbhnNcVJjV2B49Gv5zDcjibhs70AZxZzspDapRJFDyWlHhpEhoCtKKcmjoY beYu9w7pSCVQjIBsl0xhb3qqgWKRpBJojs4UfW6ARdGFteIOGyFp4ZKEsq6nPfYC qEYPH0XsuQ54HH3w/RphHDe0Xyns4YB4zu/7NrWnprqoPog+AjR+cGmlIfOOSKI2 LFsd1l0r5UMB0MA4Gt0qI6Itrea3csLlvyM6Fm05NBThe4/ZeABxwddL2/SjcmU+ PiMWHrWZlERGu+gvprKHJOO5oVpcNlcjeZ23+8sZzJKyKuuzzd6LZR8ue9TC1cPa RTZAaX0rFCi54uQ0sXmQupnEZSiYrS9M245ZD837IvtiPzKnRufxlfK10qiz4/7W uykOtN6kDrCUQ5qeH43igR76d1iRZQIA13jfRmF8b/nEOZry3T3AgDlH3o9fKvLV SvsRlVsKP/vTAtcg7KRf7otGf4p9K8f9fGCTjKbrpiGgRytMjvkvy2ubAyWBfhhF m5B4rmyQTGopDLEQ7vmusMUTuvwJXHvymDUjsFTr7zRZFsBoY27RuI+iGaMdFZL6 Vr3CdF2VI0yVYQ8EYt5I5Qyirc88V2+hnRHxGH6YGKjWZAceEH+hNMpq4fBzTmxn R7CuQS7b6d5nSQKb3+GtQcAtHurbEjqPjOjyN6AoFMpyAnAHEQdEIVdRiTRATGYW 1appMio9ieYpkK+E8XxSCIPMdhJFANzRBqQvrFrACTcSH1QrupFeGfJTeQTx8oXt B7YEs/LMXEgRhXbOj9yU5INXrKEycYgdEgCcFTM4uX9l9etuuBOvJiH1ADYOWwyI iezDKCgc4K9ZTAOAH4OgD19G2kjtwoMzP3frQzGtW9MCqj/bNB6oF/sv8i/3jccg Pgm9D98+l6NuEoRNvqTaEcUy5doKN+nFr+/12rTc1meiAlRxnDx/ESrYSyZmRiJ+ 6rxBnxZkILq9OVQOT4dhs3UVZ0XPWNQ1Nnz+xZpKXPYrZVlv8KMywqN9VaiOPHCV tyZz+VNtVQO1IKUX7IMUcL+uWDD8HZ0Hc689+FkPecoDqpYYrHk= =5N1z -----END PGP SIGNATURE----- --wr2m2xdhqoz76pr2-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 06 19:10:06 2019 Received: (at 36111) by debbugs.gnu.org; 6 Jun 2019 23:10:06 +0000 Received: from localhost ([127.0.0.1]:50770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hZ1WI-00043r-8q for submit@debbugs.gnu.org; Thu, 06 Jun 2019 19:10:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37991) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hZ1WF-00043E-IZ for 36111@debbugs.gnu.org; Thu, 06 Jun 2019 19:10:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:53640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hZ1W8-0002zV-LO; Thu, 06 Jun 2019 19:09:56 -0400 Received: from p5b326213.dip0.t-ipconnect.de ([91.50.98.19]:62785 helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1hZ1W7-0002z4-4d; Thu, 06 Jun 2019 19:09:56 -0400 From: Arash Esbati To: Ryan Kavanagh Subject: Re: bug#36111: Support cleveref labels in AUCTeX and RefTeX References: <20190606002908.u74zvkvayshbhba2@zeta.ryanak.ca> Date: Fri, 07 Jun 2019 01:07:28 +0200 In-Reply-To: <20190606002908.u74zvkvayshbhba2@zeta.ryanak.ca> (Ryan Kavanagh's message of "Wed, 5 Jun 2019 20:29:08 -0400") Message-ID: <86wohyia8f.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 36111 Cc: 36111@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Ryan Kavanagh writes: > I use the cleveref package, which allows annotating \label commands with > an optional argument. Unfortunately, this prevents both AUCTeX and > RefTeX from detecting those labels. Hi Ryan, thanks for your report. Yes, AUCTeX and RefTeX both get confused with that optional argument. > I am not sufficiently familiar with emacs lisp to submit a patch, but I > think I have found some of the places that should be updated: > > * The variable LaTeX-auto-label-regexp-list in latex.el latex.el provides support for vanilla LaTeX. Additions by packages should go into AUCTeX styles. > * The function reftex-parse-from-file hardcodes the prefix "\\label{". > Perhaps this could be a customizable regexp? RefTeX provides a customizable variable for this purpose called `reftex-label-regexps'. > Please add support for cleveref labels to AUCTeX and RefTeX. This can be done within cleveref.el. A modified version is attached. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=cleveref.el Content-Transfer-Encoding: quoted-printable ;;; cleveref.el --- Style hook for the `cleveref.sty' package. ;; Copyright (C) 2014--2019 Free Software Foundation, Inc. ;; Author: Matthew Leach ;; Maintainer: auctex-devel@gnu.org ;; Created: 13/10/2014 ;; This file is part of AUCTeX. ;; AUCTeX is free software; you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) ;; any later version. ;; AUCTeX is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with AUCTeX; see the file COPYING. If not, write to the Free ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ;; 02110-1301, USA. ;;; Code ;; Silence the compiler: (declare-function font-latex-add-keywords "font-latex" (keywords class)) (defun TeX-arg-cleveref-multiple-labels (optional &optional prompt) "Prompt for a series of labels completing with known labels. If OPTIONAL is non-nil, insert the resulting value as an optional argument, otherwise as a mandatory one. Use PROMPT as the prompt string." (if (and (fboundp 'reftex-arg-label) (fboundp 'reftex-plug-flag) (reftex-plug-flag 2)) ;; Use RefTeX when enabled (TeX-arg-ref optional) ;; Use AUCTeX interface (let* ((labels (TeX-completing-read-multiple (TeX-argument-prompt optional prompt "Keys") (LaTeX-label-list))) (labels-string (mapconcat #'identity labels ","))) (TeX-argument-insert labels-string optional)))) (defun TeX-arg-cleveref-crossref-type (optional &optional prompt) "Insert the cross-reference type for macros of cleveref package. If OPTIONAL is non-nil, insert the resulting value in brackets. Use PROMPT as the prompt string." (let* ((type (mapcar #'list '("appendix" "subappendix" "subsubappendix" "subsubsubappendix" "subfigure" "subtable" "subequation"))) (types (append type (LaTeX-counter-list)))) (TeX-argument-insert (completing-read (TeX-argument-prompt optional prompt "Type") types) optional))) (defvar LaTeX-cleveref-label-regexp '("\\\\label\\[[^]]*\\]{\\([^\n\r%\\{}]+\\)}" 1 LaTeX-auto-label) "Regexp matching a \\label incl. an optional argument.") (TeX-add-style-hook "cleveref" (lambda () (TeX-add-symbols ;; 4 Typesetting Cross-References '("cref" TeX-arg-cleveref-multiple-labels) '("Cref" TeX-arg-cleveref-multiple-labels) '("crefrange" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)")) '("Crefrange" (TeX-arg-ref "key (first)") (TeX-arg-ref "Key (last)")) '("cref*" TeX-arg-cleveref-multiple-labels) '("Cref*" TeX-arg-cleveref-multiple-labels) '("crefrange*" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)")) '("Crefrange*" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)")) '("cpageref" TeX-arg-cleveref-multiple-labels) '("Cpageref" TeX-arg-cleveref-multiple-labels) '("cpagerefrange" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)"= )) '("Cpagerefrange" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)"= )) '("namecref" TeX-arg-ref) '("nameCref" TeX-arg-ref) '("lcnamecref" TeX-arg-ref) '("namecrefs" TeX-arg-ref) '("nameCrefs" TeX-arg-ref) '("lcnamecrefs" TeX-arg-ref) '("labelcref" TeX-arg-cleveref-multiple-labels) '("labelcpageref" TeX-arg-cleveref-multiple-labels) ;; 6 Overriding the Cross-Reference Type '("crefalias" TeX-arg-counter "Type") '("label" [ TeX-arg-cleveref-crossref-type ] TeX-arg-define-label) ;; 8.1.2 Customising Individual Cross-Reference Types '("crefname" TeX-arg-cleveref-crossref-type "Singular name" "Plural name") '("Crefname" TeX-arg-cleveref-crossref-type "Singular name" "Plural name") '("creflabelformat" TeX-arg-cleveref-crossref-type t) '("crefrangelabelformat" TeX-arg-cleveref-crossref-type t)) ;; These macros aren't used particularly often during the course of ;; normal referencing. (TeX-declare-expert-macros "cleveref" "namecref" "nameCref" "lcnamecref" "namecrefs" "nameCrefs" "lcnamecrefs" "labelcref" "labelcpageref") ;; Add \label[type]{label} to AUCTeX parser (TeX-auto-add-regexp LaTeX-cleveref-label-regexp) ;; Tell RefTeX. Check if `reftex-label-regexps' is bound and use a ;; local version of it. Check if the regexp is already added in ;; order not to run `reftex-compile-variables' every time the style ;; hook runs (when (boundp 'reftex-label-regexps) (unless (member "\\\\label\\[[^]]*\\]{\\(?1:[^\n\r%\\{}]+\\)}" reftex-label-regexps) (add-to-list (make-local-variable 'reftex-label-regexps) "\\\\label\\[[^]]*\\]{\\(?1:[^\n\r%\\{}]+\\)}" t) (reftex-compile-variables))) ;; Fontification (when (and (fboundp 'font-latex-add-keywords) (eq TeX-install-font-lock 'font-latex-setup)) (font-latex-add-keywords '(("cref" "*{") ("Cref" "*{") ("crefrange" "*{{") ("Crefrange" "*{{") ("cpageref" "{") ("Cpageref" "{") ("cpagerefrange" "{{") ("Cpagerefrange" "{{") ("namecref" "{") ("nameCref" "{") ("lcnamecref" "{") ("namecrefs" "{") ("nameCrefs" "{") ("lcnamecrefs" "{") ("labelcref" "{") ("labelcpageref" "{") ("label" "[{")) 'reference) (font-latex-add-keywords '(("crefalias" "{{") ("crefname" "{{{") ("Crefname" "{{{") ("creflabelformat" "{{") ("crefrangelabelformat" "{{")) 'function)) ;; Activate RefTeX reference style. (and LaTeX-reftex-ref-style-auto-activate (fboundp 'reftex-ref-style-activate) (reftex-ref-style-activate "Cleveref"))) LaTeX-dialect) (defvar LaTeX-cleveref-package-options '("capitalise" "nameinlink" "noabbrev" "poorman") "Package options for the cleveref package.") ;;; cleveref.el ends here. --=-=-= Content-Type: text/plain Can you please customize the variable `TeX-style-private' to a directory of your choice, save the file there, restart Emacs and open your test file and report back if it works? I will install the patch afterwards. In case you're interested in the changes: --8<---------------cut here---------------start------------->8--- diff --git a/style/cleveref.el b/style/cleveref.el index 2774dcbd..c241a1cc 100644 --- a/style/cleveref.el +++ b/style/cleveref.el @@ -1,6 +1,6 @@ ;;; cleveref.el --- Style hook for the `cleveref.sty' package. -;; Copyright (C) 2014--2016, 2018 Free Software Foundation, Inc. +;; Copyright (C) 2014--2019 Free Software Foundation, Inc. ;; Author: Matthew Leach ;; Maintainer: auctex-devel@gnu.org @@ -47,22 +47,41 @@ string." (labels-string (mapconcat #'identity labels ","))) (TeX-argument-insert labels-string optional)))) +(defun TeX-arg-cleveref-crossref-type (optional &optional prompt) + "Insert the cross-reference type for macros of cleveref package. +If OPTIONAL is non-nil, insert the resulting value in brackets. +Use PROMPT as the prompt string." + (let* ((type (mapcar #'list + '("appendix" "subappendix" "subsubappendix" + "subsubsubappendix" "subfigure" "subtable" + "subequation"))) + (types (append type (LaTeX-counter-list)))) + (TeX-argument-insert + (completing-read (TeX-argument-prompt optional prompt "Type") types) + optional))) + +(defvar LaTeX-cleveref-label-regexp + '("\\\\label\\[[^]]*\\]{\\([^\n\r%\\{}]+\\)}" 1 LaTeX-auto-label) + "Regexp matching a \\label incl. an optional argument.") + (TeX-add-style-hook "cleveref" (lambda () + (TeX-add-symbols + ;; 4 Typesetting Cross-References '("cref" TeX-arg-cleveref-multiple-labels) '("Cref" TeX-arg-cleveref-multiple-labels) '("crefrange" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)")) '("Crefrange" (TeX-arg-ref "key (first)") (TeX-arg-ref "Key (last)")) - '("cpageref" TeX-arg-cleveref-multiple-labels) - '("Cpageref" TeX-arg-cleveref-multiple-labels) - '("cpagerefrange" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)")) - '("Cpagerefrange" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)")) '("cref*" TeX-arg-cleveref-multiple-labels) '("Cref*" TeX-arg-cleveref-multiple-labels) '("crefrange*" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)")) '("Crefrange*" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)")) + '("cpageref" TeX-arg-cleveref-multiple-labels) + '("Cpageref" TeX-arg-cleveref-multiple-labels) + '("cpagerefrange" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)")) + '("Cpagerefrange" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)")) '("namecref" TeX-arg-ref) '("nameCref" TeX-arg-ref) '("lcnamecref" TeX-arg-ref) @@ -70,7 +89,18 @@ string." '("nameCrefs" TeX-arg-ref) '("lcnamecrefs" TeX-arg-ref) '("labelcref" TeX-arg-cleveref-multiple-labels) - '("labelcpageref" TeX-arg-cleveref-multiple-labels)) + '("labelcpageref" TeX-arg-cleveref-multiple-labels) + ;; 6 Overriding the Cross-Reference Type + '("crefalias" TeX-arg-counter "Type") + '("label" [ TeX-arg-cleveref-crossref-type ] TeX-arg-define-label) + + ;; 8.1.2 Customising Individual Cross-Reference Types + '("crefname" TeX-arg-cleveref-crossref-type + "Singular name" "Plural name") + '("Crefname" TeX-arg-cleveref-crossref-type + "Singular name" "Plural name") + '("creflabelformat" TeX-arg-cleveref-crossref-type t) + '("crefrangelabelformat" TeX-arg-cleveref-crossref-type t)) ;; These macros aren't used particularly often during the course of ;; normal referencing. @@ -79,26 +109,48 @@ string." "namecref" "nameCref" "lcnamecref" "namecrefs" "nameCrefs" "lcnamecrefs" "labelcref" "labelcpageref") + ;; Add \label[type]{label} to AUCTeX parser + (TeX-auto-add-regexp LaTeX-cleveref-label-regexp) + + ;; Tell RefTeX. Check if `reftex-label-regexps' is bound and use a + ;; local version of it. Check if the regexp is already added in + ;; order not to run `reftex-compile-variables' every time the style + ;; hook runs + (when (boundp 'reftex-label-regexps) + (unless (member "\\\\label\\[[^]]*\\]{\\(?1:[^\n\r%\\{}]+\\)}" + reftex-label-regexps) + (add-to-list (make-local-variable 'reftex-label-regexps) + "\\\\label\\[[^]]*\\]{\\(?1:[^\n\r%\\{}]+\\)}" + t) + (reftex-compile-variables))) + ;; Fontification (when (and (fboundp 'font-latex-add-keywords) (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("cref" "*{") - ("Cref" "*{") - ("crefrange" "*{{") - ("Crefrange" "*{{") - ("cpageref" "{") - ("Cpageref" "{") - ("cpagerefrange" "{{") - ("Cpagerefrange" "{{") - ("namecref" "{") - ("nameCref" "{") - ("lcnamecref" "{") - ("namecrefs" "{") - ("nameCrefs" "{") - ("lcnamecrefs" "{") - ("labelcref" "{") - ("labelcpageref" "{")) - 'reference)) + (font-latex-add-keywords '(("cref" "*{") + ("Cref" "*{") + ("crefrange" "*{{") + ("Crefrange" "*{{") + ("cpageref" "{") + ("Cpageref" "{") + ("cpagerefrange" "{{") + ("Cpagerefrange" "{{") + ("namecref" "{") + ("nameCref" "{") + ("lcnamecref" "{") + ("namecrefs" "{") + ("nameCrefs" "{") + ("lcnamecrefs" "{") + ("labelcref" "{") + ("labelcpageref" "{") + ("label" "[{")) + 'reference) + (font-latex-add-keywords '(("crefalias" "{{") + ("crefname" "{{{") + ("Crefname" "{{{") + ("creflabelformat" "{{") + ("crefrangelabelformat" "{{")) + 'function)) ;; Activate RefTeX reference style. (and LaTeX-reftex-ref-style-auto-activate --8<---------------cut here---------------end--------------->8--- Best, Arash --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 11 13:40:41 2019 Received: (at 36111) by debbugs.gnu.org; 11 Jun 2019 17:40:41 +0000 Received: from localhost ([127.0.0.1]:60137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1haklE-0002TR-V8 for submit@debbugs.gnu.org; Tue, 11 Jun 2019 13:40:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1haklE-0002TC-1e for 36111@debbugs.gnu.org; Tue, 11 Jun 2019 13:40:40 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hakl4-0000VW-DO; Tue, 11 Jun 2019 13:40:34 -0400 Received: from p5b326c16.dip0.t-ipconnect.de ([91.50.108.22]:65064 helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1hakl2-0002m9-Fk; Tue, 11 Jun 2019 13:40:30 -0400 From: Arash Esbati To: Ryan Kavanagh Subject: Re: bug#36111: Support cleveref labels in AUCTeX and RefTeX References: <20190606002908.u74zvkvayshbhba2@zeta.ryanak.ca> <86wohyia8f.fsf@gnu.org> <20190607035851.x3khehoisoutplxo@zeta.ryanak.ca> Date: Mon, 10 Jun 2019 21:40:18 +0200 In-Reply-To: <20190607035851.x3khehoisoutplxo@zeta.ryanak.ca> (Ryan Kavanagh's message of "Thu, 6 Jun 2019 23:58:51 -0400") Message-ID: <8636khfcv1.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -1.5 (-) X-Debbugs-Envelope-To: 36111 Cc: 36111@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.5 (--) Ryan Kavanagh writes: Hi Ryan, thanks for your response. Please keep 36111@debbugs.gnu.org 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 =E2=80=98tex.el=E2=80=99. > 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' change= d from 0644 (rw-r--r--) to 0000 (---------) See above, I don't think permissions are relevant here (besides reading). Best, Arash From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 12 09:51:24 2019 Received: (at 36111) by debbugs.gnu.org; 12 Jun 2019 13:51:24 +0000 Received: from localhost ([127.0.0.1]:60913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hb3eu-0001k9-5L for submit@debbugs.gnu.org; Wed, 12 Jun 2019 09:51:24 -0400 Received: from mail-qk1-f173.google.com ([209.85.222.173]:34215) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hb3es-0001jy-UR for 36111@debbugs.gnu.org; Wed, 12 Jun 2019 09:51:23 -0400 Received: by mail-qk1-f173.google.com with SMTP id t8so6557646qkt.1 for <36111@debbugs.gnu.org>; Wed, 12 Jun 2019 06:51:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=PZh5HlJ26NJm1+dgFXqfsaHF3HH4vIcsWDyeC7kv9co=; b=Ny48v4RwDSKK1mVVTezGBOb1AlXH0PxCjTqy/KS+lvvFVccKl5ZTkZCyRUB5zoZ7uP j6jEQvAbt7fHTvuEoHUxtSO0b16JSCwbbCCKUOHCPlp371kbQ0krjn9dMkE1v8H3ByFY Po0tEUJOxvlFDcoUXomfkYPmNvKNDLNkSa0Zq/DEDiObjkibF2ODjPu/fi7u+Y7SSPQo ySGTFQwmqukmh4kaubbUYLk25Sf3Fz4FL7T/+FPSxgPL9/8keOJq5OO36eZMcXmN0EAe WwhY5OGKmTPrw4Qjj3+UTWK4IXQAexpoWPzHijKK2s2Eg/Wrud7qqdpOSUGzRlbOcYfv w9/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=PZh5HlJ26NJm1+dgFXqfsaHF3HH4vIcsWDyeC7kv9co=; b=trLtobbZ7eZ78pNBT84SKmh2UTcABuUU8vDkfUZbe6mjLNLrn90np3u1fvFxqM7/mt nl4wZvxFeBSG8HO9I4ObaZu/oWq9Z14V2DoDQR+VO/cjb61okSxsbtzaFJkPdPo1WvhT zhP5O7IBuFaZCyeW7UUG69rtJpuvmvicuVduZEf+gUlrc9dD9xe/TipNSNFrAQsmxMTu 71rR/p9Vpkh3xAla+2wCGx2zB3OyMeg+yMzIyconSQTODINbgyv+SiKpAeztFCBxsNZ9 2AqZ+2mcsgOx6ue1lvch80LB8ZdOAsf9i+j0Zh9wzfN9WE/zYzDqLh5fk5jPN7PLqFCT xs8A== X-Gm-Message-State: APjAAAXD4p329HrHCPbhez0C4EqNGL5jMqR2kc9lyw0sH4CeE1OymAY0 DEJk3KXWAxtmZqGQwi5EEDtIDNFv X-Google-Smtp-Source: APXvYqzjXP7/HIXqfQFT1XIdW0CySZCgVK65cwTHxiwU3g1vJNzmR3pm7OuGCORaOsOFbeYHMrOdag== X-Received: by 2002:a37:a5c3:: with SMTP id o186mr6067955qke.108.1560347477261; Wed, 12 Jun 2019 06:51:17 -0700 (PDT) Received: from zeta.rak.ac (c-98-239-128-52.hsd1.pa.comcast.net. [98.239.128.52]) by smtp.gmail.com with ESMTPSA id a21sm8056879qkg.47.2019.06.12.06.51.15 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 12 Jun 2019 06:51:15 -0700 (PDT) Date: Wed, 12 Jun 2019 09:51:16 -0400 From: Ryan Kavanagh To: Arash Esbati Subject: Re: bug#36111: Support cleveref labels in AUCTeX and RefTeX Message-ID: <20190612135116.3bk4yiat3t3a4ngx@zeta.rak.ac> References: <20190606002908.u74zvkvayshbhba2@zeta.ryanak.ca> <86wohyia8f.fsf@gnu.org> <20190607035851.x3khehoisoutplxo@zeta.ryanak.ca> <8636khfcv1.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="2sukohx5sw7xepus" Content-Disposition: inline In-Reply-To: <8636khfcv1.fsf@gnu.org> X-message-flag: Please do NOT send HTML e-mail or MS Word attachments - use plain text instead X-GPG-ID: 0x8F7BF8FC4A11C97A X-GPG-Fingerprint: 4E46 9519 ED67 7734 268F BD95 8F7B F8FC 4A11 C97A User-Agent: NeoMutt/20180716 X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 36111 Cc: 36111@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) --2sukohx5sw7xepus Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 10, 2019 at 09:40:18PM +0200, Arash Esbati wrote: > I don't have complete TeXlive installed, but is there a plain.cls > available somewhere? Sorry, I hadn't actually run LaTeX on that test file, and was just using it for AUCTeX debugging. I somehow remembered the "minimal" class as being called "plain". Replacing \documentclass{plain} by \documentclass{minimal} will get it compiling. > 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? Aha, that's the problem (and thanks for teaching me about `C-h e'): Loading /home/rak/.emacs.d/elpa/auctex-12.1.2/style/cleveref.elc...done The problem seems to be that I was setting TeX-style-private at the bottom of my .emacs, after the stuff loading AUCTeX. Moving the setting to the start of my ~/.emacs resulted in: Loading /home/rak/.emacs.d/elpa/auctex-12.1.2/style/cleveref.elc...done The new cleveref.el you provided fixes the bug. Thanks! Best, Ryan --=20 |)|/ Ryan Kavanagh | GPG: 4E46 9519 ED67 7734 268F |\|\ https://rak.ac | BD95 8F7B F8FC 4A11 C97A --2sukohx5sw7xepus Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQUzBAABCgAdFiEETkaVGe1ndzQmj72Vj3v4/EoRyXoFAl0BA1AACgkQj3v4/EoR yXoIMif9Gm2K2c+2q9YV7agBnaQg7I3L46WHnh4pENVLJ//jb76eVN6QO2jjvV1u gFN8a5smhjNN5766l4J1QX6eAlc6Nz3IJ/prRCQA7RAD6cyse+bGlj1K1r1aC7I1 NPDLEH5ZHKFDhfQ5GIAITbQTRWzKQrl8l3DVXH7kWEW2VfCdIXWHtjujGt/+mJgZ 1li+jm0iS9fuLCdsegt3KELuWrUnFo9nRFIJkeB/yJbT5TnbaxX8MMU6RupNbnln UixmBMsAH+y5CiNejN4fQGgKKKIT87v2TEttt7Q5/UrN3KrAGI33s12lFq48uq// HWhsei0ZkUVVh/smaGw3gQPPbpsFId1FnuKzUoxhiJ+N1qwzOw9q0Lo2+3OJiudd KQ98eibwRtNg9uH5r39tpw2ufjW7WReTuBqnh+nyqGvIxtzZ24weyaSXYB+VqACJ BfP8gOAZ5bACPR4MBpn1DooiopECrwZCDEkKHNBCmH4C503TtWwAkOZLiGnFReWy X7AUfDhlH5UUhRCtV8Ok2feGAd0Q1/1AHB1oER0p1LdQuh2eMXN/mYU72B7Odhxx 3eNnrhgs0u49qxsNppZSMwla2bspOSOP5pW3b2ke97rhpdm+4pfbzGR/Z+i79ZJM EgC/90Vdeh6GhGs51uVAO8PvbC7PNVXexN/L+gpMxEnSnz5N7r+dvgqjqI+N5kSu 76R9VH2NgqCd7dQyeH5Vhjshwo+aernD7zR22weFst8gH8kJwY8eri9sbnC0jVxL OxZRRRfBUc4jlF0JRy4o/sUPReRK0YTbUbJjz2o1mPuvJoxnh1okZJXqhEQ16EoR hUvbbaly3pELO786HSARMNsqi1rFmMIHrPtVqWkO/qw+I2fsiZa6ZqA2102I0vDP UDIfCJ8k7+vdoWyvlKDn2wyQDpp3uQ+mF5GX7+08xp70G41cSPVYXAUONp3K8Atw BDXeuYwr/yIyENzKQwHPQy2u5vpAHmgiQK5HA3qKRgpdTBfFMbq7dJI3uw/Ii9m3 HlGboLJK9zKU7cLoNrlPHyx/RCVhwao4lbU0rhQnmT6Se4Rz+UojGyg9N3A7xCC8 HkchZkq9DDvve4OzBogyVFefooEzjjwYGN+2WfjQfJrvZHJTvETXC0As0LYmFDRF Kcea/ZyZqaJHmjvz58jy7Yhu+Hm/u8Qb/mXW8mMRREV53TObXAEn8Zhj0PjWx2ku qeYIXSZfsjNUmPlzwr7vuj74zNsB9Ko8S/q7exfMXZn3jYkKoUYcy20RR5fR86K7 mF31nN7z6NBASJEmLGx1roHkFq7fsWG4tA+HU5FMkEs6aKS6ZDX3ASweTx2sF6Ma VdIO/iRl6v7TIGK0RcyvGHAzY8/0OdGoUT0xivteC8MQD79fl6tSKFcd7maI7L3W LvHOdTaCwuWFJ0nTalqM3ryZX0HK0qNz7IuEdWUoO5koII3AGoF43Uc0iwwLHKJQ w/BWdXjz4pWkzFOolmCf/6RtpsyNn6ZzrpfPT8cNEQDj61sfAiwvsMdIJV0RkzcO VOROGMgNld37GF+DT7Btu3WWCDS4gVVHOswL0jmllfQwMeIkB2hrWtSQmHvLr6wK nPknVgeTf/bwt7YIDDnoQjRGJ9oBY9Z9yVDzMx7xMCYa/QczTQgGGOQHkNOn/Dss s6QGqS2c5HTy459DTKsPnCCwegc3ZjXibmhsz6zLbFpI6Gh92AM= =mdsD -----END PGP SIGNATURE----- --2sukohx5sw7xepus-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 15 16:01:56 2019 Received: (at 36111-done) by debbugs.gnu.org; 15 Jun 2019 20:01:56 +0000 Received: from localhost ([127.0.0.1]:39243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hcEs8-0004VN-0Q for submit@debbugs.gnu.org; Sat, 15 Jun 2019 16:01:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54878) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hcEs5-0004V1-Qd for 36111-done@debbugs.gnu.org; Sat, 15 Jun 2019 16:01:54 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:42550) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hcErz-0005px-DP; Sat, 15 Jun 2019 16:01:47 -0400 Received: from p5b326fe9.dip0.t-ipconnect.de ([91.50.111.233]:53402 helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1hcErx-0002ai-Pz; Sat, 15 Jun 2019 16:01:47 -0400 From: Arash Esbati To: Ryan Kavanagh Subject: Re: bug#36111: Support cleveref labels in AUCTeX and RefTeX References: <20190606002908.u74zvkvayshbhba2@zeta.ryanak.ca> <86wohyia8f.fsf@gnu.org> <20190607035851.x3khehoisoutplxo@zeta.ryanak.ca> <8636khfcv1.fsf@gnu.org> <20190612135116.3bk4yiat3t3a4ngx@zeta.rak.ac> Date: Sat, 15 Jun 2019 22:01:30 +0200 In-Reply-To: <20190612135116.3bk4yiat3t3a4ngx@zeta.rak.ac> (Ryan Kavanagh's message of "Wed, 12 Jun 2019 09:51:16 -0400") Message-ID: <86blyyehyd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 36111-done Cc: 36111-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ryan Kavanagh writes: > The new cleveref.el you provided fixes the bug. Thanks! Thanks for reporting this bug and testing the fix. I've pushed a change to AUCTeX repo -- closing this one. Best, Arash From unknown Sat Jun 21 10:28:18 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 14 Jul 2019 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator