[latex3-commits] [latex3/hyperref] develop, main: check if target has realy destinations (1fb204a)

github at latex-project.org github at latex-project.org
Fri May 26 17:08:40 CEST 2023


Repository : https://github.com/latex3/hyperref
On branches: develop,main
Link       : https://github.com/latex3/hyperref/commit/1fb204accd79618ac1b2e42e96703b44ef2f6257

>---------------------------------------------------------------

commit 1fb204accd79618ac1b2e42e96703b44ef2f6257
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Fri May 26 17:08:40 2023 +0200

    check if target has realy destinations


>---------------------------------------------------------------

1fb204accd79618ac1b2e42e96703b44ef2f6257
 testfiles/xr-newlabel-1.etex.tlg   | 20 +---------
 testfiles/xr-newlabel-1.luatex.tlg | 26 +++----------
 testfiles/xr-newlabel-1.tlg        | 20 +---------
 testfiles/xr-newlabel-2.etex.tlg   |  4 +-
 testfiles/xr-newlabel-2.luatex.tlg |  4 +-
 testfiles/xr-newlabel-2.tlg        |  4 +-
 testfiles/xr-newlabel-3.etex.tlg   |  4 +-
 testfiles/xr-newlabel-3.luatex.tlg |  4 +-
 testfiles/xr-newlabel-3.tlg        |  4 +-
 testfiles/xr-newlabel-4.etex.tlg   |  4 +-
 testfiles/xr-newlabel-4.luatex.tlg |  4 +-
 testfiles/xr-newlabel-4.tlg        |  4 +-
 testfiles/xr-newlabel-5.etex.tlg   | 63 ++++++++++++++++++++++++++++++++
 testfiles/xr-newlabel-5.luatex.tlg | 75 ++++++++++++++++++++++++++++++++++++++
 testfiles/xr-newlabel-5.lvt        | 36 ++++++++++++++++++
 testfiles/xr-newlabel-5.tlg        | 61 +++++++++++++++++++++++++++++++
 xr-hyper.sty                       | 10 ++++-
 17 files changed, 271 insertions(+), 76 deletions(-)

diff --git a/testfiles/xr-newlabel-1.etex.tlg b/testfiles/xr-newlabel-1.etex.tlg
index 8fdab64..f0cf0b2 100644
--- a/testfiles/xr-newlabel-1.etex.tlg
+++ b/testfiles/xr-newlabel-1.etex.tlg
@@ -27,7 +27,7 @@ l. ... \show\r at IIa \show\r at IIb \show\r at IIbspecial
 ->{1.3}{1}{}{}{}.
 l. ......\show\r at IIb \show\r at IIbspecial \show\r at IIc
 > \r at IIIa=macro:
-->{1.1}{1}{title}{section.title}{test-aux3.pdf}.
+->{1.1}{1}{title}{section.title}{}.
 l. ... \show\r at IIIa
 Completed box being shipped out [1]
 \vbox(627.36243+0.0)x380.0
@@ -45,7 +45,7 @@ Completed box being shipped out [1]
 ..\vbox(550.0+0.0)x345.0, glue set 540.0fil
 ...\write-{}
 ...\glue(\topskip) 3.05556
-...\hbox(6.94444+1.94444)x345.0, glue set 191.27745fil
+...\hbox(6.94444+0.0)x345.0, glue set 248.83316fil
 ....\hbox(0.0+0.0)x15.0
 ....\OT1/cmr/m/n/10 1
 ....\OT1/cmr/m/n/10 .
@@ -68,26 +68,10 @@ Completed box being shipped out [1]
 ....\OT1/cmr/m/n/10 t
 ....\OT1/cmr/m/n/10 l
 ....\OT1/cmr/m/n/10 e
-....\OT1/cmr/m/n/10 t
-....\OT1/cmr/m/n/10 e
-....\OT1/cmr/m/n/10 s
-....\OT1/cmr/m/n/10 t
-....\OT1/cmr/m/n/10 -
-....\discretionary
-....\OT1/cmr/m/n/10 a
-....\OT1/cmr/m/n/10 u
-....\OT1/cmr/m/n/10 x
-....\OT1/cmr/m/n/10 3
-....\OT1/cmr/m/n/10 .
-....\OT1/cmr/m/n/10 p
-....\kern0.27779
-....\OT1/cmr/m/n/10 d
-....\OT1/cmr/m/n/10 f
 ....\hbox(0.0+0.0)x0.0
 ....\penalty 10000
 ....\glue(\parfillskip) 0.0 plus 1.0fil
 ....\glue(\rightskip) 0.0
-...\glue -1.94444
 ...\glue 0.0 plus 1.0fil
 ...\glue 0.0
 ..\glue(\baselineskip) 25.29494
diff --git a/testfiles/xr-newlabel-1.luatex.tlg b/testfiles/xr-newlabel-1.luatex.tlg
index c7ea0e6..9717eef 100644
--- a/testfiles/xr-newlabel-1.luatex.tlg
+++ b/testfiles/xr-newlabel-1.luatex.tlg
@@ -27,7 +27,7 @@ l. ... \show\r at IIa \show\r at IIb \show\r at IIbspecial
 ->{1.3}{1}{}{}{}.
 l. ......a \show\r at IIb \show\r at IIbspecial \show\r at IIc
 > \r at IIIa=macro:
-->{1.1}{1}{title}{section.title}{test-aux3.pdf}.
+->{1.1}{1}{title}{section.title}{}.
 l. ... \show\r at IIIa
 Completed box being shipped out [1]
 \vbox(627.36243+0.0)x380.0, direction TLT
@@ -43,8 +43,8 @@ Completed box being shipped out [1]
 ..\glue(\lineskip) 0.0
 ..\vbox(550.0+0.0)x345.0, glue set 540.0fil, direction TLT
 ...\write-{}
-...\glue(\topskip) 2.95
-...\hbox(7.05+1.94)x345.0, glue set 191.26001fil, direction TLT
+...\glue(\topskip) 3.06
+...\hbox(6.94+0.11)x345.0, glue set 248.83fil, direction TLT
 ....\localpar
 .....\localinterlinepenalty=0
 .....\localbrokenpenalty=0
@@ -75,30 +75,16 @@ Completed box being shipped out [1]
 ....\TU/lmr/m/n/10 .
 ....\TU/lmr/m/n/10 t
 ....\TU/lmr/m/n/10 i
+....\discretionary (penalty 50)
+.....< \TU/lmr/m/n/10 -
 ....\TU/lmr/m/n/10 t
 ....\TU/lmr/m/n/10 l
 ....\TU/lmr/m/n/10 e
-....\TU/lmr/m/n/10 t
-....\TU/lmr/m/n/10 e
-....\TU/lmr/m/n/10 s
-....\TU/lmr/m/n/10 t
-....\discretionary (penalty 50)
-.....< \TU/lmr/m/n/10 -
-.....= \TU/lmr/m/n/10 -
-....\TU/lmr/m/n/10 a
-....\TU/lmr/m/n/10 u
-....\TU/lmr/m/n/10 x
-....\TU/lmr/m/n/10 3
-....\TU/lmr/m/n/10 .
-....\TU/lmr/m/n/10 p
-....\kern0.28 (font)
-....\TU/lmr/m/n/10 d
-....\TU/lmr/m/n/10 f
 ....\hbox(0.0+0.0)x0.0, direction TLT
 ....\penalty 10000
 ....\glue(\parfillskip) 0.0 plus 1.0fil
 ....\glue(\rightskip) 0.0
-...\glue -1.94
+...\glue -0.11
 ...\glue 0.0 plus 1.0fil
 ...\glue 0.0
 ..\glue(\baselineskip) 25.29494
diff --git a/testfiles/xr-newlabel-1.tlg b/testfiles/xr-newlabel-1.tlg
index 7720a99..0d79bda 100644
--- a/testfiles/xr-newlabel-1.tlg
+++ b/testfiles/xr-newlabel-1.tlg
@@ -27,7 +27,7 @@ l. ... \show\r at IIa \show\r at IIb \show\r at IIbspecial
 ->{1.3}{1}{}{}{}.
 l. ......\show\r at IIb \show\r at IIbspecial \show\r at IIc
 > \r at IIIa=macro:
-->{1.1}{1}{title}{section.title}{test-aux3.pdf}.
+->{1.1}{1}{title}{section.title}{}.
 l. ... \show\r at IIIa
 Completed box being shipped out [1]
 \vbox(627.36243+0.0)x380.0
@@ -44,7 +44,7 @@ Completed box being shipped out [1]
 ..\vbox(550.0+0.0)x345.0, glue set 540.0fil
 ...\write-{}
 ...\glue(\topskip) 3.05556
-...\hbox(6.94444+1.94444)x345.0, glue set 191.27745fil
+...\hbox(6.94444+0.0)x345.0, glue set 248.83316fil
 ....\hbox(0.0+0.0)x15.0
 ....\OT1/cmr/m/n/10 1
 ....\OT1/cmr/m/n/10 .
@@ -67,26 +67,10 @@ Completed box being shipped out [1]
 ....\OT1/cmr/m/n/10 t
 ....\OT1/cmr/m/n/10 l
 ....\OT1/cmr/m/n/10 e
-....\OT1/cmr/m/n/10 t
-....\OT1/cmr/m/n/10 e
-....\OT1/cmr/m/n/10 s
-....\OT1/cmr/m/n/10 t
-....\OT1/cmr/m/n/10 -
-....\discretionary
-....\OT1/cmr/m/n/10 a
-....\OT1/cmr/m/n/10 u
-....\OT1/cmr/m/n/10 x
-....\OT1/cmr/m/n/10 3
-....\OT1/cmr/m/n/10 .
-....\OT1/cmr/m/n/10 p
-....\kern0.27779
-....\OT1/cmr/m/n/10 d
-....\OT1/cmr/m/n/10 f
 ....\hbox(0.0+0.0)x0.0
 ....\penalty 10000
 ....\glue(\parfillskip) 0.0 plus 1.0fil
 ....\glue(\rightskip) 0.0
-...\glue -1.94444
 ...\glue 0.0 plus 1.0fil
 ...\glue 0.0
 ..\glue(\baselineskip) 25.29494
diff --git a/testfiles/xr-newlabel-2.etex.tlg b/testfiles/xr-newlabel-2.etex.tlg
index 04badbf..d07532e 100644
--- a/testfiles/xr-newlabel-2.etex.tlg
+++ b/testfiles/xr-newlabel-2.etex.tlg
@@ -27,7 +27,7 @@ l. ... \show\r at IIa \show\r at IIb \show\r at IIbspecial
 ->{1.3}{1}{}{}{}.
 l. ......\show\r at IIb \show\r at IIbspecial \show\r at IIc
 > \r at IIIa=macro:
-->{1.1}{1}{title}{section.title}{test-aux3.pdf}.
+->{1.1}{1}{title}{section.title}{}.
 l. ... \show\r at IIIa
 Completed box being shipped out [1]
 \vbox(627.36243+0.0)x380.0
@@ -79,7 +79,7 @@ Completed box being shipped out [1]
 ......\OT1/cmr/m/n/10 1
 .....\hbox(0.0+0.0)x0.0, shifted -6.44444
 ......\special{ps:SDict begin H.R end}
-.....\special{ps:SDict begin [/Subtype /Link/H /I/Border [0 0 1]BorderArrayPatch/Color [0 .5 .5]/Action <</S/GoToR/F(test-aux3.pdf)/D(section.title)cvn>> H.B /ANN pdfmark end}
+.....\special{ps:SDict begin [/Color [1 0 0]/H /I/Border [0 0 1]BorderArrayPatch/Subtype /Link/Dest (section.title) cvn H.B /ANN pdfmark end}
 .....\penalty 10000
 .....\glue(\parfillskip) 0.0 plus 1.0fil
 .....\glue(\rightskip) 0.0
diff --git a/testfiles/xr-newlabel-2.luatex.tlg b/testfiles/xr-newlabel-2.luatex.tlg
index 0029a4d..d261913 100644
--- a/testfiles/xr-newlabel-2.luatex.tlg
+++ b/testfiles/xr-newlabel-2.luatex.tlg
@@ -27,7 +27,7 @@ l. ... \show\r at IIa \show\r at IIb \show\r at IIbspecial
 ->{1.3}{1}{}{}{}.
 l. ......a \show\r at IIb \show\r at IIbspecial \show\r at IIc
 > \r at IIIa=macro:
-->{1.1}{1}{title}{section.title}{test-aux3.pdf}.
+->{1.1}{1}{title}{section.title}{}.
 l. ... \show\r at IIIa
 Completed box being shipped out [1]
 \vbox(627.36243+0.0)x380.0, direction TLT
@@ -67,7 +67,7 @@ Completed box being shipped out [1]
 ......\localleftbox=null
 ......\localrightbox=null
 .....\hbox(0.0+0.0)x15.0, direction TLT
-.....\pdfstartlink(*+*)x* attr{/Border[0 0 1]/H/I/C[0 .5 .5]} action user{/Subtype/Link/A<</F(test-aux3.pdf)/S/GoToR/D(section.title)>>}
+.....\pdfstartlink(*+*)x* attr{/Border[0 0 1]/H/I/C[1 0 0]} action goto name{section.title}
 .....\TU/lmr/m/n/10 1
 .....\TU/lmr/m/n/10 .
 .....\TU/lmr/m/n/10 1
diff --git a/testfiles/xr-newlabel-2.tlg b/testfiles/xr-newlabel-2.tlg
index edf2d2e..0d17f69 100644
--- a/testfiles/xr-newlabel-2.tlg
+++ b/testfiles/xr-newlabel-2.tlg
@@ -27,7 +27,7 @@ l. ... \show\r at IIa \show\r at IIb \show\r at IIbspecial
 ->{1.3}{1}{}{}{}.
 l. ......\show\r at IIb \show\r at IIbspecial \show\r at IIc
 > \r at IIIa=macro:
-->{1.1}{1}{title}{section.title}{test-aux3.pdf}.
+->{1.1}{1}{title}{section.title}{}.
 l. ... \show\r at IIIa
 Completed box being shipped out [1]
 \vbox(627.36243+0.0)x380.0
@@ -62,7 +62,7 @@ Completed box being shipped out [1]
 ....\glue(\topskip) 3.55556
 ....\hbox(6.44444+0.0)x345.0, glue set 317.22218fil
 .....\hbox(0.0+0.0)x15.0
-.....\pdfstartlink(*+*)x* attr{/Border[0 0 1]/H/I/C[0 .5 .5]} action user{/Subtype/Link/A<</F(test-aux3.pdf)/S/GoToR/D(section.title)>>}
+.....\pdfstartlink(*+*)x* attr{/Border[0 0 1]/H/I/C[1 0 0]} action goto name{section.title}
 .....\OT1/cmr/m/n/10 1
 .....\OT1/cmr/m/n/10 .
 .....\OT1/cmr/m/n/10 1
diff --git a/testfiles/xr-newlabel-3.etex.tlg b/testfiles/xr-newlabel-3.etex.tlg
index e88dfe9..ddb7aea 100644
--- a/testfiles/xr-newlabel-3.etex.tlg
+++ b/testfiles/xr-newlabel-3.etex.tlg
@@ -27,7 +27,7 @@ l. ... \show\r at IIa \show\r at IIb \show\r at IIbspecial
 ->{1.3}{1}{}{}{}.
 l. ......\show\r at IIb \show\r at IIbspecial \show\r at IIc
 > \r at IIIa=macro:
-->{1.1}{1}{title}{section.title}{test-aux3.pdf}.
+->{1.1}{1}{title}{section.title}{}.
 l. ... \show\r at IIIa
 Completed box being shipped out [1]
 \vbox(627.36243+0.0)x380.0
@@ -79,7 +79,7 @@ Completed box being shipped out [1]
 ......\OT1/cmr/m/n/10 1
 .....\hbox(0.0+0.0)x0.0, shifted -6.44444
 ......\special{ps:SDict begin H.R end}
-.....\special{ps:SDict begin [/Subtype /Link/H /I/Border [0 0 1]BorderArrayPatch/Color [0 .5 .5]/Action <</S/GoToR/F(test-aux3.pdf)/D(section.title)cvn>> H.B /ANN pdfmark end}
+.....\special{ps:SDict begin [/Color [1 0 0]/H /I/Border [0 0 1]BorderArrayPatch/Subtype /Link/Dest (section.title) cvn H.B /ANN pdfmark end}
 .....\penalty 10000
 .....\glue(\parfillskip) 0.0 plus 1.0fil
 .....\glue(\rightskip) 0.0
diff --git a/testfiles/xr-newlabel-3.luatex.tlg b/testfiles/xr-newlabel-3.luatex.tlg
index 8a103de..3b3d961 100644
--- a/testfiles/xr-newlabel-3.luatex.tlg
+++ b/testfiles/xr-newlabel-3.luatex.tlg
@@ -27,7 +27,7 @@ l. ... \show\r at IIa \show\r at IIb \show\r at IIbspecial
 ->{1.3}{1}{}{}{}.
 l. ......a \show\r at IIb \show\r at IIbspecial \show\r at IIc
 > \r at IIIa=macro:
-->{1.1}{1}{title}{section.title}{test-aux3.pdf}.
+->{1.1}{1}{title}{section.title}{}.
 l. ... \show\r at IIIa
 Completed box being shipped out [1]
 \vbox(627.36243+0.0)x380.0, direction TLT
@@ -67,7 +67,7 @@ Completed box being shipped out [1]
 ......\localleftbox=null
 ......\localrightbox=null
 .....\hbox(0.0+0.0)x15.0, direction TLT
-.....\pdfstartlink(*+*)x* attr{/Border[0 0 1]/H/I/C[0 .5 .5]} action user{/Subtype/Link/A<</F(test-aux3.pdf)/S/GoToR/D(section.title)>>}
+.....\pdfstartlink(*+*)x* attr{/Border[0 0 1]/H/I/C[1 0 0]} action goto name{section.title}
 .....\TU/lmr/m/n/10 1
 .....\TU/lmr/m/n/10 .
 .....\TU/lmr/m/n/10 1
diff --git a/testfiles/xr-newlabel-3.tlg b/testfiles/xr-newlabel-3.tlg
index 7b7eb6b..ad4ed38 100644
--- a/testfiles/xr-newlabel-3.tlg
+++ b/testfiles/xr-newlabel-3.tlg
@@ -27,7 +27,7 @@ l. ... \show\r at IIa \show\r at IIb \show\r at IIbspecial
 ->{1.3}{1}{}{}{}.
 l. ......\show\r at IIb \show\r at IIbspecial \show\r at IIc
 > \r at IIIa=macro:
-->{1.1}{1}{title}{section.title}{test-aux3.pdf}.
+->{1.1}{1}{title}{section.title}{}.
 l. ... \show\r at IIIa
 Completed box being shipped out [1]
 \vbox(627.36243+0.0)x380.0
@@ -62,7 +62,7 @@ Completed box being shipped out [1]
 ....\glue(\topskip) 3.55556
 ....\hbox(6.44444+0.0)x345.0, glue set 317.22218fil
 .....\hbox(0.0+0.0)x15.0
-.....\pdfstartlink(*+*)x* attr{/Border[0 0 1]/H/I/C[0 .5 .5]} action user{/Subtype/Link/A<</F(test-aux3.pdf)/S/GoToR/D(section.title)>>}
+.....\pdfstartlink(*+*)x* attr{/Border[0 0 1]/H/I/C[1 0 0]} action goto name{section.title}
 .....\OT1/cmr/m/n/10 1
 .....\OT1/cmr/m/n/10 .
 .....\OT1/cmr/m/n/10 1
diff --git a/testfiles/xr-newlabel-4.etex.tlg b/testfiles/xr-newlabel-4.etex.tlg
index b872245..96a867f 100644
--- a/testfiles/xr-newlabel-4.etex.tlg
+++ b/testfiles/xr-newlabel-4.etex.tlg
@@ -27,7 +27,7 @@ l. ... \show\r at IIa \show\r at IIb \show\r at IIbspecial
 ->{1.3}{1}{}{}{}.
 l. ......\show\r at IIb \show\r at IIbspecial \show\r at IIc
 > \r at IIIa=macro:
-->{1.1}{1}{title}{section.title}{test-aux3.pdf}.
+->{1.1}{1}{title}{section.title}{}.
 l. ... \show\r at IIIa
 Completed box being shipped out [1]
 \vbox(627.36243+0.0)x380.0
@@ -79,7 +79,7 @@ Completed box being shipped out [1]
 ......\OT1/cmr/m/n/10 1
 .....\hbox(0.0+0.0)x0.0, shifted -6.44444
 ......\special{ps:SDict begin H.R end}
-.....\special{ps:SDict begin [/Subtype /Link/H /I/Border [0 0 1]BorderArrayPatch/Color [0 .5 .5]/Action <</S/GoToR/F(test-aux3.pdf)/D(section.title)cvn>> H.B /ANN pdfmark end}
+.....\special{ps:SDict begin [/Color [1 0 0]/H /I/Border [0 0 1]BorderArrayPatch/Subtype /Link/Dest (section.title) cvn H.B /ANN pdfmark end}
 .....\penalty 10000
 .....\glue(\parfillskip) 0.0 plus 1.0fil
 .....\glue(\rightskip) 0.0
diff --git a/testfiles/xr-newlabel-4.luatex.tlg b/testfiles/xr-newlabel-4.luatex.tlg
index 545ea73..bdfd3b2 100644
--- a/testfiles/xr-newlabel-4.luatex.tlg
+++ b/testfiles/xr-newlabel-4.luatex.tlg
@@ -27,7 +27,7 @@ l. ... \show\r at IIa \show\r at IIb \show\r at IIbspecial
 ->{1.3}{1}{}{}{}.
 l. ......a \show\r at IIb \show\r at IIbspecial \show\r at IIc
 > \r at IIIa=macro:
-->{1.1}{1}{title}{section.title}{test-aux3.pdf}.
+->{1.1}{1}{title}{section.title}{}.
 l. ... \show\r at IIIa
 Completed box being shipped out [1]
 \vbox(627.36243+0.0)x380.0, direction TLT
@@ -67,7 +67,7 @@ Completed box being shipped out [1]
 ......\localleftbox=null
 ......\localrightbox=null
 .....\hbox(0.0+0.0)x15.0, direction TLT
-.....\pdfstartlink(*+*)x* attr{/Border[0 0 1]/H/I/C[0 .5 .5]} action user{/Subtype/Link/A<</F(test-aux3.pdf)/S/GoToR/D(section.title)>>}
+.....\pdfstartlink(*+*)x* attr{/Border[0 0 1]/H/I/C[1 0 0]} action goto name{section.title}
 .....\TU/lmr/m/n/10 1
 .....\TU/lmr/m/n/10 .
 .....\TU/lmr/m/n/10 1
diff --git a/testfiles/xr-newlabel-4.tlg b/testfiles/xr-newlabel-4.tlg
index 6619d2f..c4727fa 100644
--- a/testfiles/xr-newlabel-4.tlg
+++ b/testfiles/xr-newlabel-4.tlg
@@ -27,7 +27,7 @@ l. ... \show\r at IIa \show\r at IIb \show\r at IIbspecial
 ->{1.3}{1}{}{}{}.
 l. ......\show\r at IIb \show\r at IIbspecial \show\r at IIc
 > \r at IIIa=macro:
-->{1.1}{1}{title}{section.title}{test-aux3.pdf}.
+->{1.1}{1}{title}{section.title}{}.
 l. ... \show\r at IIIa
 Completed box being shipped out [1]
 \vbox(627.36243+0.0)x380.0
@@ -62,7 +62,7 @@ Completed box being shipped out [1]
 ....\glue(\topskip) 3.55556
 ....\hbox(6.44444+0.0)x345.0, glue set 317.22218fil
 .....\hbox(0.0+0.0)x15.0
-.....\pdfstartlink(*+*)x* attr{/Border[0 0 1]/H/I/C[0 .5 .5]} action user{/Subtype/Link/A<</F(test-aux3.pdf)/S/GoToR/D(section.title)>>}
+.....\pdfstartlink(*+*)x* attr{/Border[0 0 1]/H/I/C[1 0 0]} action goto name{section.title}
 .....\OT1/cmr/m/n/10 1
 .....\OT1/cmr/m/n/10 .
 .....\OT1/cmr/m/n/10 1
diff --git a/testfiles/xr-newlabel-5.etex.tlg b/testfiles/xr-newlabel-5.etex.tlg
new file mode 100644
index 0000000..4b1c684
--- /dev/null
+++ b/testfiles/xr-newlabel-5.etex.tlg
@@ -0,0 +1,63 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+> \r at IIIa=macro:
+->{1.1}{1}{title}{section.title}{}.
+l. ... \show\r at IIIa
+                    \show\r at IVa  \show\r at Va
+> \r at IVa=macro:
+->{1.1}{1}{title}{section.title}{test-aux4.pdf}.
+l. ... \show\r at IIIa  \show\r at IVa
+                                 \show\r at Va
+> \r at Va=macro:
+->{1.1}{1}{title}{section.title}{}.
+l. ... \show\r at IIIa  \show\r at IVa  \show\r at Va
+Completed box being shipped out [1]
+\vbox(627.36243+0.0)x380.0
+.\hbox(0.0+0.0)x0.0
+.\glue 22.0
+.\vbox(605.36243+0.0)x345.0, shifted 35.0
+..\vbox(12.0+0.0)x345.0, glue set 5.55556fil
+...\glue 0.0 plus 1.0fil
+...\hbox(6.44444+0.0)x345.0
+....\hbox(6.44444+0.0)x345.0, glue set 339.99998fil
+.....\glue 0.0 plus 1.0fil
+.....\OT1/cmr/m/n/10 1
+..\glue 18.06749
+..\glue(\lineskip) 0.0
+..\vbox(550.0+0.0)x345.0, glue set 540.0fil
+...\write-{}
+...\glue(\topskip) 3.05556
+...\hbox(6.94444+0.0)x345.0, glue set 248.83316fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/cmr/m/n/10 1
+....\OT1/cmr/m/n/10 .
+....\OT1/cmr/m/n/10 1
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 i
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 l
+....\OT1/cmr/m/n/10 e
+....\OT1/cmr/m/n/10 s
+....\OT1/cmr/m/n/10 e
+....\OT1/cmr/m/n/10 c
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 i
+....\OT1/cmr/m/n/10 o
+....\OT1/cmr/m/n/10 n
+....\OT1/cmr/m/n/10 .
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 i
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 l
+....\OT1/cmr/m/n/10 e
+....\hbox(0.0+0.0)x0.0
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue 0.0 plus 1.0fil
+...\glue 0.0
+..\glue(\baselineskip) 25.29494
+..\hbox(0.0+0.0)x345.0
+...\hbox(0.0+0.0)x345.0
+.\kern 0.0
+(xr-newlabel-5.aux)
diff --git a/testfiles/xr-newlabel-5.luatex.tlg b/testfiles/xr-newlabel-5.luatex.tlg
new file mode 100644
index 0000000..c989d56
--- /dev/null
+++ b/testfiles/xr-newlabel-5.luatex.tlg
@@ -0,0 +1,75 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+> \r at IIIa=macro:
+->{1.1}{1}{title}{section.title}{}.
+l. ... \show\r at IIIa
+                  \show\r at IVa  \show\r at Va
+> \r at IVa=macro:
+->{1.1}{1}{title}{section.title}{test-aux4.pdf}.
+l. ... \show\r at IIIa  \show\r at IVa
+                               \show\r at Va
+> \r at Va=macro:
+->{1.1}{1}{title}{section.title}{}.
+l. ... \show\r at IIIa  \show\r at IVa  \show\r at Va
+Completed box being shipped out [1]
+\vbox(627.36243+0.0)x380.0, direction TLT
+.\glue 22.0
+.\vbox(605.36243+0.0)x345.0, shifted 35.0, direction TLT
+..\vbox(12.0+0.0)x345.0, glue set 5.34fil, direction TLT
+...\glue 0.0 plus 1.0fil
+...\hbox(6.66+0.0)x345.0, direction TLT
+....\hbox(6.66+0.0)x345.0, glue set 340.0fil, direction TLT
+.....\glue 0.0 plus 1.0fil
+.....\TU/lmr/m/n/10 1
+..\glue 18.06749
+..\glue(\lineskip) 0.0
+..\vbox(550.0+0.0)x345.0, glue set 540.0fil, direction TLT
+...\write-{}
+...\glue(\topskip) 3.06
+...\hbox(6.94+0.11)x345.0, glue set 248.83fil, direction TLT
+....\localpar
+.....\localinterlinepenalty=0
+.....\localbrokenpenalty=0
+.....\localleftbox=null
+.....\localrightbox=null
+....\hbox(0.0+0.0)x15.0, direction TLT
+....\TU/lmr/m/n/10 1
+....\TU/lmr/m/n/10 .
+....\TU/lmr/m/n/10 1
+....\TU/lmr/m/n/10 t
+....\TU/lmr/m/n/10 i
+....\discretionary (penalty 50)
+.....< \TU/lmr/m/n/10 -
+....\TU/lmr/m/n/10 t
+....\TU/lmr/m/n/10 l
+....\TU/lmr/m/n/10 e
+....\discretionary (penalty 50)
+.....< \TU/lmr/m/n/10 -
+....\TU/lmr/m/n/10 s
+....\TU/lmr/m/n/10 e
+....\TU/lmr/m/n/10 c
+....\discretionary (penalty 50)
+.....< \TU/lmr/m/n/10 -
+....\TU/lmr/m/n/10 t
+....\TU/lmr/m/n/10 i
+....\TU/lmr/m/n/10 o
+....\TU/lmr/m/n/10 n
+....\TU/lmr/m/n/10 .
+....\TU/lmr/m/n/10 t
+....\TU/lmr/m/n/10 i
+....\discretionary (penalty 50)
+.....< \TU/lmr/m/n/10 -
+....\TU/lmr/m/n/10 t
+....\TU/lmr/m/n/10 l
+....\TU/lmr/m/n/10 e
+....\hbox(0.0+0.0)x0.0, direction TLT
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue -0.11
+...\glue 0.0 plus 1.0fil
+...\glue 0.0
+..\glue(\baselineskip) 25.29494
+..\hbox(0.0+0.0)x345.0, direction TLT
+...\hbox(0.0+0.0)x345.0, direction TLT
+(xr-newlabel-5.aux)
diff --git a/testfiles/xr-newlabel-5.lvt b/testfiles/xr-newlabel-5.lvt
new file mode 100644
index 0000000..fb7f920
--- /dev/null
+++ b/testfiles/xr-newlabel-5.lvt
@@ -0,0 +1,36 @@
+\documentclass{book}
+\input{regression-test}
+\begin{filecontents}[force]{test-aux3.aux}
+% aux-file with five arguments and destinations
+% but no hyperref
+\newlabel{IIIa}{{1.1}{1}{title}{section.title}{}}
+\end{filecontents}
+
+\begin{filecontents}[force]{test-aux4.aux}
+% aux-file with five arguments and destinations
+% from a document with hyperref
+\providecommand\HyperFirstAtBeginDocument{}
+\HyperFirstAtBeginDocument{}
+\newlabel{IVa}{{1.1}{1}{title}{section.title}{}}
+\end{filecontents}
+
+\begin{filecontents}[force]{test-aux5.aux}
+% aux-file with five arguments and destinations
+\newlabel{Va}{{1.1}{1}{title}{section.title}{}}
+\end{filecontents}
+
+\usepackage{xr-hyper}
+
+\externaldocument{test-aux3}
+\externaldocument{test-aux4}
+\externaldocument{test-aux5}
+\begin{document}
+\START \showoutput
+
+\makeatletter 
+
+ \show\r at IIIa  \show\r at IVa  \show\r at Va 
+
+%This prints the fourth and fifth argument in older LaTeX but works in newer
+\ref{IIIa}
+\end{document}
diff --git a/testfiles/xr-newlabel-5.tlg b/testfiles/xr-newlabel-5.tlg
new file mode 100644
index 0000000..65d50dd
--- /dev/null
+++ b/testfiles/xr-newlabel-5.tlg
@@ -0,0 +1,61 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+> \r at IIIa=macro:
+->{1.1}{1}{title}{section.title}{}.
+l. ... \show\r at IIIa
+                    \show\r at IVa  \show\r at Va
+> \r at IVa=macro:
+->{1.1}{1}{title}{section.title}{test-aux4.pdf}.
+l. ... \show\r at IIIa  \show\r at IVa
+                                 \show\r at Va
+> \r at Va=macro:
+->{1.1}{1}{title}{section.title}{}.
+l. ... \show\r at IIIa  \show\r at IVa  \show\r at Va
+Completed box being shipped out [1]
+\vbox(627.36243+0.0)x380.0
+.\glue 22.0
+.\vbox(605.36243+0.0)x345.0, shifted 35.0
+..\vbox(12.0+0.0)x345.0, glue set 5.55556fil
+...\glue 0.0 plus 1.0fil
+...\hbox(6.44444+0.0)x345.0
+....\hbox(6.44444+0.0)x345.0, glue set 339.99998fil
+.....\glue 0.0 plus 1.0fil
+.....\OT1/cmr/m/n/10 1
+..\glue 18.06749
+..\glue(\lineskip) 0.0
+..\vbox(550.0+0.0)x345.0, glue set 540.0fil
+...\write-{}
+...\glue(\topskip) 3.05556
+...\hbox(6.94444+0.0)x345.0, glue set 248.83316fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/cmr/m/n/10 1
+....\OT1/cmr/m/n/10 .
+....\OT1/cmr/m/n/10 1
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 i
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 l
+....\OT1/cmr/m/n/10 e
+....\OT1/cmr/m/n/10 s
+....\OT1/cmr/m/n/10 e
+....\OT1/cmr/m/n/10 c
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 i
+....\OT1/cmr/m/n/10 o
+....\OT1/cmr/m/n/10 n
+....\OT1/cmr/m/n/10 .
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 i
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 l
+....\OT1/cmr/m/n/10 e
+....\hbox(0.0+0.0)x0.0
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue 0.0 plus 1.0fil
+...\glue 0.0
+..\glue(\baselineskip) 25.29494
+..\hbox(0.0+0.0)x345.0
+...\hbox(0.0+0.0)x345.0
+(xr-newlabel-5.aux)
diff --git a/xr-hyper.sty b/xr-hyper.sty
index 0866c79..6235a94 100644
--- a/xr-hyper.sty
+++ b/xr-hyper.sty
@@ -73,6 +73,7 @@
    \else
      \let\XR at bibcite\bibcite
    \fi
+  \def\XR at useURL{}%  
   \def\XR at URL{#4}%
   \filename at parse{#3}%
   \XR at next#3.aux\relax\\}}
@@ -97,7 +98,7 @@
      \if!#4!%
       {#3}{#4}{}% new perhaps this could use \XR at URL too?
      \else
-      {#3}{#4}{\XR at URL}%
+      {#3}{#4}{\XR at useURL}%
     \fi
   }%
 
@@ -117,6 +118,11 @@
 % 2019 update to match xr
 \long\def\XR at test#1#2#3#4\XR@{%
   \let\XR at tempa\@gobblethree
+% we set the file name only if the target has actually destinations.
+% for this we test if hyperref has been used.  
+  \ifx#1\HyperFirstAtBeginDocument
+    \let\XR at useURL\XR at URL
+  \fi
   \ifx#1\newlabel
     \let\XR at tempa\@firstofthree
   \else\ifx#1\XR at bibcite
@@ -125,7 +131,7 @@
      \let\XR at tempa\@thirdofthree
   \fi\fi\fi
    \XR at tempa
-    {%\XR at testnewlabel{#3}%
+    {%
      \expandafter\protected at xdef\csname r@\XR at prefix#2\endcsname{\XR at addURL{#3}}%     
     }%
     {\expandafter\bibcite\expandafter{\XR at prefix#2}{#3}}%





More information about the latex3-commits mailing list.