auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: \hyperref macro seems to confuse paren matching


From: Arash Esbati
Subject: Re: \hyperref macro seems to confuse paren matching
Date: Wed, 08 Jun 2022 10:54:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50

Hi Keita,

Ikumi Keita <ikumi@ikumi.que.jp> writes:

>> It is unfortunate that \hyperref can be used like this:
>
>>   \hyperref{URL}{category}{name}{text}
>
>> or
>
>>   \hyperref[label]{text}
>
>> AUCTeX currently caters for the former syntax and ignores the latter.
>> Maybe we should change this?  I think the latter will be more common.
>
> Hmm, I didn't know that \hyperref accepts these two different usage.
> It's rather unordinary, isn't it?

I have seen some macros like this, but fortunately, there are not many
of them around.  As an example, take the kernel macro:

    \DeclareOption{<option>}{<code>} and
    \DeclareOption*{<code>}

\@ifnextchar makes this possible :-)

> If AUCTeX is to support both usage, I suppose that we have to
> implement it as a highly exceptional case.

What do you think about this change:

--8<---------------cut here---------------start------------->8---
diff --git a/style/hyperref.el b/style/hyperref.el
index 81a0533c..356da3ce 100644
--- a/style/hyperref.el
+++ b/style/hyperref.el
@@ -239,7 +239,10 @@
     '("hyperbaseurl" t)
     '("hyperimage" "Image URL" "Text")
     '("hyperdef" "Category" "Name" "Text")
-    '("hyperref" "URL" "Category" "Name" "Text")
+    '("hyperref"
+      (TeX-arg-conditional (y-or-n-p "Insert a label and text? ")
+                           ([TeX-arg-ref] "Text")
+                           ("URL" "Category" "Name" "Text")))
     '("hyperlink" "Name" "Text")
     '("hypertarget" "Name" "Text")
     '("phantomsection" 0)
@@ -291,7 +294,7 @@
    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "nolinkurl")
    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperbaseurl")
    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperimage")
-   (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperref")
+   ;; (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperref")
    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "href")

    ;; In hyperref package, \url macro is redefined and \url|...| can't be used,
@@ -307,7 +310,7 @@
                                 ("hyperbaseurl" "{")
                                 ("hyperimage" "{{")
                                 ("hyperdef" "{{{")
-                                ("hyperref" "{{{{")
+                                ("hyperref" "[{")
                                 ("hyperlink" "{{")
                                 ("hypertarget" "{{")
                                 ("autoref" "*{")
--8<---------------cut here---------------end--------------->8---

Best, Arash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]