-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathhyperref-generic.dtx
5661 lines (5559 loc) · 177 KB
/
hyperref-generic.dtx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% \iffalse meta-comment
%
%% File: hyperref-generic.dtx
%
% Copyright (C) 2021-2024 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
% license or (at your option) any later version. The latest version
% of this license is in the file
%
% http://www.latex-project.org/lppl.txt
%
% This file is part of the "LaTeX PDF management testphase bundle" (The Work in LPPL)
% and all files in that bundle must be distributed together.
%
% The released version of this bundle is available from CTAN.
%
% -----------------------------------------------------------------------
%
% The development version of the bundle can be found at
%
% https://github.com/latex3/pdfresources
%
% for those people who are interested.
%
%<*driver>
\DocumentMetadata{pdfstandard=A-2b}
\documentclass{l3doc}
\usepackage{tabularx,array,booktabs}
\hypersetup{pdfauthor=The LaTeX Project,
pdftitle=generic hyperref driver (LaTeX PDF management testphase bundle)}
\premulticols=4cm
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
% \NewDocElement[
% idxgroup=hypersetup keys\actualchar\cs{hypersetup} keys,
% idxtype = {hypersetup key},
% printtype= \textit{setup key}
% ]{Hypkey}{xhypkey}
% \ExplSyntaxOn
% \NewDocumentEnvironment{hypkey}{m}
% {
% \clist_map_inline:nn {#1}{\begin{xhypkey}{##1}}
% }
% {
% \clist_map_inline:nn {#1}{\end{xhypkey}}
% }
% \ExplSyntaxOff
% \NewDocElement[
% idxgroup=color names,
% idxtype = {color name},
% printtype= \textit{color name}
% ]{HypColor}{xhypcolor}
% \ExplSyntaxOn
% \NewDocumentEnvironment{hypcolor}{m}
% {
% \clist_map_inline:nn {#1}{\begin{xhypcolor}{##1}}
% }
% {
% \clist_map_inline:nn {#1}{\end{xhypcolor}}
% }
% \ExplSyntaxOff
% \NewDocElement[
% idxgroup=Hooks,
% printtype= \textit{hook}
% ]{Hook}{hook}
%
% \title{^^A
% The \pkg{hyperref-generic} module \\ A generic driver for hyperref ^^A
% }
%
% \author{^^A
% The \LaTeX{} Project\thanks
% {^^A
% E-mail:
% \href{mailto:latex-team@latex-project.org}
% {latex-team@latex-project.org}^^A
% }^^A
% }
%
% \date{Version 0.96o, released 2024-12-20}
%
% \maketitle
% \begin{documentation}
% This module generates a generic driver for \pkg{hyperref} meant to be used
% with the new \LaTeX{} PDF management code. It is loaded automatically
% if the PDF management code is active. The name of the driver will change after
% the testphase.
%
% The generic driver can be used with pdflatex, lualatex, xelatex, latex with
% dvipdfmx, latex with dvips+ps2pdf. latex with dvips+distiller could work too
% but is untested. (x)dvipdfmx will probably soon support dvilualatex, then this
% combination should work too.
%
% The driver \emph{requires} the new PDF management code, so documents wanting to use it
% should start like this (this requires \LaTeX-2022-06-01 or newer):
% \begin{verbatim}
% \DocumentMetadata %loads the PDF management and activates it
% {
% %% options
% %% e.g. pdf version, backend:
% % pdfversion=1.7,
% % backend = dvipdfmx
% }
% \end{verbatim}
%
% The new driver tries to be compatible with the standard \pkg{hyperref} drivers
% but there are nevertheless differences. Some of them due to the still experimental
% status of the driver, others are design decisions: one part of the project is
% to clean up and modernize the code. The following sections try to describe
% the differences but also to document some of the rationales of the changes,
% and to add some details and comments about the existing options and so to
% extend the \pkg{hyperref} manual.
%
% \section{Avoiding transition problems}
% Some code will only work properly after other packages have been adapted to
% the new PDF management code and the changes in this driver.
% This will take some time. Until then it is recommended to follow
% the following rules
% \begin{itemize}
% \item Package options are processed at the end of the driver,
% Class options are ignored. But not every option already works as package options,
% in some cases \pkg{hyperref} interferes. So
% it is recommended for most options ---with the exception of a few mentioned below in
% section~\ref{sec:pkg-options}---to set them in \cs{hypersetup},
% not as package option.
% \item This driver uses the \pkg{l3color} module for the colors. All colors
% defined with \cs{color_set:nn} or \cs{color_set:nnn} will work.
% Colors defined with \pkg{xcolor} will work if they don't use one of
% the special color models not supported by \pkg{l3color} as
% \pkg{pdfmanagement-firstaid} contains a patch for xcolor.
% If the package \pkg{color} is used it is currently recommended to define
% colors after \pkg{hyperref}.
% \item Load a color package or graphicx to get the right page sizes.
% \item Report problems! Only known problem can be resolved.
% \end{itemize}
%
%
% \section{Bookmarks / outlines}
% The new driver doesn't contain code to handle bookmarks/outlines.
% Instead it forces the loading of the \pkg{bookmark} package
% unless the package option |bookmarks=false|
% has been used. Currently \pkg{bookmark} is loaded at the end of the preamble
% so if commands from \pkg{bookmark} are needed in the preamble the document
% should load it manually. This is subject to change at some time in the future.
%
% \section{\enquote{Metadata}}
%
% \enquote{Metadata}, information about the document, are stored in a PDF in two
% places: The |/Info| dictionary and the XMP-metadata. \pkg{hyperref} only handles the
% |/Info| dictionary. The XMP-metadata are added by code from \pkg{l3pdfmeta}.
% (without the pdfmanagement the XMP-metadata can be added with packages like \pkg{pdfx} and
% \pkg{hyperxmp}).
%
% The |/Info| dictionary can be filled with arbitrary keys, but the PDF viewer typically
% care only about a few, like |/Author|, |/Title| and |/Keywords|.
% A number of |/Info| keys, like dates and the producer, are added automatically
% by the engines and backends.
% Some of them can only be removed with special commands, some not at all.
% But---with the exception of |/Producer| when using the dvips backend---they
% can be overwritten.
%
% The current handling of the metadata is problematic:
% \begin{itemize}
% \item External package like \pkg{hyperxmp} wants to access them too and for
% this had to patch an number of internal \pkg{hyperref} commands---which is a problem
% if the internal commands change (as happens with this new driver)
% \item \pkg {hyperref} (and also \pkg{hyperxmp})
% tries to deduce some data from document commands like
% \cs{title} or \cs{author}---something that worked reasonably well when only
% some standard classes with well-known definitions of these command existed,
% but gets problematic with classes and packages which define
% more powerful commands knowing a variety of optional arguments to set authors and
% affiliations and title information.
% \end{itemize}
%
% To resolve some of this problem the driver will
% \begin{itemize}
% \item \emph{Not} try deduce author and title from documents. They have to be set in
% \cs{hypersetup} with |pdfauthor| and |pdftitle|. It is recommended to separate
% more than one author by commas, and to hide commas inside braces if needed:
%
% \begin{verbatim}
% pdfauthor = {Bär, Peter Anteater, {Riley, the sloth}}
% \end{verbatim}
%
% \item It is possible to store titles in more than one language. If the value begins with
% an \enquote{optional argument} which represents a language tag, the value is taken
% as a comma list and split. The first value is used for the Info dictionary,
% the others are used in the XMP-metadata. Commas in a title must then be
% protected with braces:
%
% \begin{verbatim}
% pdftitle = {[en]English Title,[de] Deutscher Titel,[fr]{titre français, avec comma}}
% \end{verbatim}
%
%
% \item All values of relevant keys (including keys from the hyperxmp package)
% will be stored in a Metadata container, and can be retrieved with
% \cs{GetDocumentProperties}.
%
% \begin{verbatim}
% \edef\my@pdfauthor{\GetDocumentProperties{hyperref/pdfauthor}}
% \end{verbatim}
% If the key hasn't be set, the result is empty. This gives external
% packages a public and reliable access to the data.
%
% \item |pdflang| is deprecated. Instead \cs{DocumentMetadata} should be used:
% \begin{verbatim}
% \DocumentMetadata{lang=de-DE}
% \end{verbatim}
%
% The value can be retrieved as |document/lang|.
%
% \end{itemize}
% \section{Dates}
% \pkg{hyperref} has a few keys to set dates. They typically expect the date
% in \enquote{PDF} format: |D:YYYYMMDDhhmmss+01'00'|.
%
%
% \section{PDF page size (mediabox)}
% The standard \pkg{hyperref} driver contain code to set the PDF page size.
% There is no real justification why this is done by \pkg{hyperref} apart from the
% fact that \LaTeX{} itself doesn't do it and that the needed special code could
% be added to the backend drivers.
%
% In the new driver this code is gone. The reason is not that it is
% difficult to set the MediaBox, actually it could be done with one line of code:
% \begin{verbatim}
% \pdfmanagement_add:nnn{Page}{MediaBox}
% {[0~0~\dim_to_decimal_in_bp:n{\paperwidth}~
% \dim_to_decimal_in_bp:n{\paperheight}]}
% \end{verbatim}
%
% The problem is to know which value to use (with the memoir class e.g.\cs{stockwidth}
% should be used instead of \cs{paperwidth}),
% and detecting this not a \pkg{hyperref} task. Instead the packages which change
% these values should also set the PDF page size. Also there are
% too many actors here: color/graphicx, geometry,the KOMA-classes, memoir,
% \ldots\ all try to set this.
%
% So if the PDF page size is wrong: load one of the other packages setting it
% e.g. the \pkg{color} or the \pkg{graphicx} package.
%
% \section{Commands to create \enquote{external} references}
% \pkg{hyperref} has three commands related to external references like
% URL and file: \cs{url},
% \cs{nolinkurl} and \cs{href}. The first two take one argument,
% while the last has two: the url and some free text.
%
%
% \cs{url} and \cs{href} create link annotations. \cs{url} creates always an URI
% type, \cs{href} creates URI, GoToR and Launch
% depending on the structure of the argument.
%
% \cs{href} has to create a (in the PDF) valid url or file name from its first argument.
% \cs{url} has to create a (in the PDF) valid url from its only argument and has also to print
% this argument as url. \cs{nolinkurl} only prints the url.
%
% For the printing \cs{url} and \cs{nolinkurl} rely on the url package and its \cs{Url} command.
%
% (Expandable) commands are expanded and special chars can also be input by commands but
% beside this no conversion is done: for all input \pkg{hyperref} basically assumes that
% the input is already a valid percent encoded url or a valid file name. \pkg{hyperref} also
% doesn't extend or add protocols.
%
% As nowadays everyone is used to copy and paste links with all sorts of unicode into a browser and
% they work the \pkg{hyperref} input is clearly rather restricted.
%
% So the new driver tries to extend the input and print options. Both \cs{href} and \cs{url}
% can now be told to accept non-ascii url's and to convert them internally to
% percent encoding. It is possible to define a standard protocol and so to avoid to
% have to type it all the time.
%
% But extending the \emph{print} options for \cs{url} and \cs{nolinkurl} while still
% using the url-package is hard to impossible in pdf\LaTeX{} due to the way the url package works.
% Some chars can be added with the help of \cs{UrlSpecial} (at the cost of warnings)
% but it doesn't work for every input and documenting and explaining all the edge cases is no joy.
% So instead the new driver offers here the option to use different commands to format
% the printed output. It must be noted that this disable the special \enquote{hyphenation} method of
% url's.
%
%
% \subsection{Special problem: links to files}
%
% When a file is linked with \cs{href} than normally it is added as URI link. The exceptions are PDF's:
% for them PDF has the special type GoToR which allows also to link to a destination or a special page.
%
% After a number of tests with various PDF viewer established that non-ascii files names don't
% work at all with a simple file name specification GoToR links now use a full
% filespec dictionary. This works better, but still no every PDF viewer support this correctly.
% on various system.
%
% The following can be used to test viewers. It assumes that a \texttt{test.pdf},
% a \texttt{grüßpdf.pdf} and a \texttt{grüße.txt} are in the current folder.
%
% \hrefpdf{test.pdf}{test-ascii}
%
% \hrefpdf{grüßpdf.pdf}{test grüßpdf.pdf}
%
% \hrefurl[urlencode]{grüße.txt}{test grüße.txt}
%
%
% \subsection{Splits}
%
% \cs{href} tries to be clever and to detect from the argument
% if a url or a file link or a launch command should be created.
%
% The rules are not trivial, and they make the code complicated.
% This detection also makes it more difficult to handle special cases
% like non-ascii input for the link types.
%
% For this reason three new commands have been create:
%
% \begin{itemize}
% \item \cs{hrefurl} for standard urls (and non-pdf files)
% \item \cs{hrefpdf} for references to pdf files
% \item \cs{hrefrun} for launch links
% \end{itemize}
%
% The new commands don't use prefixes like \cs{href}.
% Their argument should be the real content.
%
% \subsection{Options}
% All \cs{href} commands and \cs{url} have an option argument for keyval syntax.
% It accepts the following keys. Not all keys make sense for all keys, but they don't
% error, they are silently ignored. The optional argument can currently not be used together
% with the \cs{urldef} command.
%
% \begin{tabular}{llp{6cm}}
% key & applicable commands & note\\\hline
% urlencode & \cs{hrefurl} & if set the code will convert the argument to percent encoding. This allows non-ascii input.\\
% protocol & \cs{hrefurl}, \cs{url} & This sets a prefix/protocol that is added to the url, see below. \\
% format & \cs{url} & a command used to format the printed text. It replaces the standard \cs{Url}. This can improve non-ascii
% typesetting at the cost of losing the special line breaking.\\
% destination & \cs{href}, \cs{hrefpdf} & A destination name in the PDF\\
% page & \cs{href}, \cs{hrefpdf} & destination page, default: 1\\
% pdfremotestartview &\cs{href}, \cs{hrefpdf} & start view, default: Fit\\
% ismap & \cs{href}, \cs{hrefurl} & see PDF reference\\
% afrelationship & \cs{href}, \cs{hrefpdf} & Changes the /AFRelationship key of the filespec dictionary. The value should be a PDF name without the starting slash.\\
% run-parameter & \cs{hreflaunch} & run parameter (see the PDF reference)\\
% nextactionraw & various & puts a /Next entry in the action dictionary (see the PDF reference)\\
% \end{tabular}
%
%
% The first four keys can be set also in \cs{hypersetup} for all following commands in
% the current group through the keys
% \texttt{href/urlencode}, \texttt{href/protocol}, \texttt{href/destination}, \texttt{href/format}.
%
% It is possible to define own url commands with specific options e.g. with
%
% \begin{verbatim}
% \NewDocumentCommand\myurl{O{}}{\url[protocol=https://,format=\textsc,#1]}
% \end{verbatim}
%
% \section{Link decorations: border, color, OCG-color, \ldots}
% Some main changes are
% \begin{itemize}
% \item The default colors have been changed.
% \item Citations have by default no special color, they are
% colored like other internal links. You can use |citecolor| and |citebordercolor| to
% assign them a special color. This color is not reset if you use |allcolors| or
% switch to another color scheme. If you want the colors to follow |linkcolor| again
% you should remove the label |hyp/cite| and/or |hyp/citeborder|
% from the hook |hyp/link/cite|.
% \item a number of color schemes have been predefined.
% \end{itemize}
%
% \subsection{Background information}
% With the standard drivers \pkg{hyperref} allows either to color the link text,
% or to use a border around it.
% There is also a (rather unknown) option |frenchlinks| to use small caps
% for some links instead of colors.
%
% The \emph{link border} is a setting in the PDF annotation directory.
% It can be colored and styled (with the |<xxx>bordercolor|, |pdfborderstyle|
% and |pdfhighlight| keys), but the exact look depends on the PDF viewer.
% Such decorations are normally not printed.
%
% The \emph{link text} is colored with the standard color commands for text.
% Such a color is also printed, which is often not wanted. The printing
% can be avoided in PDF with so-called OCG-layers: They allow to add
% variants of a text along with instructions which variant should be used for
% viewing and which for printing. \pkg{hyperref} implements a rather simple version
% for links: The link text is put in a box and printed twice with different colors
% on different OCG layers. As boxes are used such links can't be broken. The
% package \pkg{ocgx2} implements a more sophisticated version which allows to
% use it for links broken over lines and pages.
%
% \pkg{hyperref} has keys to set the color and border for |link|, |url|, |file|,
% |menu| and |run| types. They correspond to the PDF annotation types
% |GoTo|, |URI|, |GoToR|, |Named| and |Launch|.
% Beside this there is a |anchorcolor| which isn't used at all, and |citecolor|
% which is a semantical category and doesn't fit to the other types.
%
% In the standard drivers the decoration options are more or less exclusive and global:
% One of the options (|colorlinks|, |ocgcolorlinks|, or borders) has to be
% chosen in the preamble and is then used for the whole document
% and all link types.
% Only colors and eventually the border style can be adjusted locally.
% But there is no technical reason for these restrictions:
% It is quite possible to change all these attributes
% at any time both by link type and locally. The restrictions of the current
% implementation can only be explained by the age of the code: \pkg{hyperref}
% has been created at a time when memory was small and the main drivers were html
% and postscript based.
%
% While link colors have been traditionally more or less
% under the control of \pkg{hyperref},
% the situation with other format options, like the font, is more complicated.
% The font in \cs{url} is for example determined by \cs{Urlfont},
% a command from the \pkg{url} package.
% In the case of internal (GoTo) references packages like \pkg{cleveref} or
% \pkg{biblatex} or \pkg{glossaries} offer formatting options too.
% Formatting here is often connected to semantics:
% an acronym should use a different font than a citation.
% While \pkg{hyperref} could offer options here, it would probably only clash
% with package formatting. It is more sensible not to interfere here. For this
% reason the |frenchlinks| option has been dropped.
%
% \subsection{New Keys}
% Some of the existing keys have been extended to allow individual setting for
% the link types |link|, |url|, |file| |menu| and |run|:
%
% \begin{itemize}
% \item Beside |pdfborder| there are also |linkborder|, |urlborder| etc
% \item Beside |pdfhighlight| there are also |linkhighlight|, |urlhighlight| etc
% \item Beside |pdfborderstyle| there are also |linkborderstyle|, |urlborderstyle| etc
% \item Beside |colorlinks| there are also |colorlink|, |colorurl| etc
% \item Beside |ocgcolorlinks| there are also |ocgcolorlink|, |ocgcolorurl|, etc %TODO
% \item Beside |hidelinks| there are also |hidelink|, |hideurl|, etc
% \item |bordercolormodel| allows to set the model used in annotations,
% the allowed values are |rgb| or |cmyk|. |rgb| is the default.
% It does \emph{not} change the model of text colors. Be aware
% that while the PDF format allows cmyk (4 numbers) in the |/C| key of an annotation,
% this is often ignored by pdf viewers and the colors can be wrong.
% \item The boolean keys |url|, |link|, |run|, |menu|, |file| allow to deactivate
% locally the link types.
% \end{itemize}
%
% \begin{hypkey}{colorscheme}
%
% The new key |colorscheme| allows to switch the colors (both for text and borders)
% with a key word. It takes one of the values
% |primary-colors| (the colors as \pkg{hyperref} uses normally), |phelype|, |daleif|,
% |szabolcsA|, |szabolcsB|, |tivv|, |julian|, |henryford|.
%
% The names refer to the authors in answers and comments in
% \url{https://tex.stackexchange.com/questions/525261/better-default-colors-for-hyperref-links}.
%
% The default is |phelype|.
% \end{hypkey}
%
% \subsection{Public interfaces}
%
% \begin{variable}
% {\l_hyp_annot_colorlink_bool,
% \l_hyp_annot_colorurl_bool,
% \l_hyp_annot_colorfile_bool,
% \l_hyp_annot_colorrun_bool,
% \l_hyp_annot_colormenu_bool,
% \l_hyp_annot_ocgcolorlink_bool,
% \l_hyp_annot_ocgcolorurl_bool,
% \l_hyp_annot_ocgcolorfile_bool,
% \l_hyp_annot_ocgcolorrun_bool,
% \l_hyp_annot_ocgcolormenu_bool
% }
% These boolean are used by the |colorlinks| and |ocgcolorlinks| and related keys.
% These keys insert hook code in the |pdfannot/link/|\meta{type}|/begin|
% and |pdfannot/link/|\meta{type}|/end| hooks. \meta{type} is one of
% |GoTo|, |URI|, |GoToR|, |Named| or |Launch|.
%
% |colorlinks| uses the label |hyp/color|, and |ocgcolorlinks| the label |hyp/ocg|.
%
% They both use the same color names: |hyp/color/link|, |hyp/color/url|,
% |hyp/color/file|, |hyp/color/run|, |hyp/color/menu|.
%
% The cite colors uses the names |hyp/color/cite| and |hyp/color/citeborder|.
%
% The border colors aren't saved in color names currently, but if the need
% would arise it would possible to change this.
% \end{variable}
% \subsection{Changed behaviour}
% \begin{description}
% \item[colorlinks] |colorlinks| or |colorlinks=true| will as before disable the |pdfborder|
% (|colorlinks=false| will leave the |pdfborder| untouched), but it is possible
% to use the key in the document at any time, or to reenable the border if wanted.
% Internally |colorlinks| \& friends will no longer define/undefine
% |\Hy@colorlink|, but instead use the hooks provided by the \pkg{l3pdfannot} package.
% \item Color keys accept the following input syntax:
%
% \begin{tabular}{ll}
% model based & |urlbordercolor = [rgb]{1,1,0}| \\
% color expression & |urlbordercolor = red!50!blue| \\
% command & |urlbordercolor = \mycolor|
% \end{tabular}
%
% where |\mycolor| should expand to one of the other two syntax variants.
%
% \item[frenchlinks] The option |frenchlinks| does nothing at all.
% \item[cite colors] As mentioned above the support for |citecolor|
% and |citebordercolor| has been reduced. A package like \pkg{hyperref}
% can't keep track of such semantic
% contexts like cite, acronym, glossaries and special references and maintain keys for
% them. The keys are not completely dropped as this would affect packages like
% \pkg{natbib}, but they have been separated and are no longer affected by
% group keys like |allcolors| but must be set individually instead.
%
% \item[link margin] The driver sets a default link margin---this is identical
% to pdftex and luatex driver, but a change for the xetex and dvips driver.
% The (undocumentated) command \cs{setpdflinkmargin} does nothing.
% Use either the key |pdflinkmargin| or \cs{pdfannot_link_margin:n} to change the margin.
% See also the description in section~\ref{sec:keydesc} and in the \pkg{hyperref} manual.
% \end{description}
%
% \section{PDF strings}
%
% \pkg{hyperref} uses a command called \cs{pdfstringdef} to convert text input into
% something that makes sense and is valid in a PDF string, e.g. in the bookmarks
% or in the info dictionary or as form field values.
%
% As the handling of the outlines are delegated to the \pkg{bookmark} package, they
% will for now still use \cs{pdfstringdef}, but all other strings produced by
% this driver will use a new method based on the expl3 commands
% \cs{text_purify:n} and \cs{str_set_convert:Nnnn}. For normal text
% it shouldn't matter, but a variety of commands and math are handled differently.
% Like with \cs{pdfstringdef} they are a number of ways to adjust the outcome of
% \cs{text_purify:n}. These are described in the expl3 documentation interface3.pdf.
%
% \emph{The new method is under heavy development!}
%
% Important differences here are
% \begin{itemize}
% \item \emph{This new method requires that files are utf8-encoded}
% (at least if non-ascii chars are used in for PDF strings).
% \item \emph{All} robust commands are currently removed,
% unless an equivalent has been declared.
% \item Currently the new method is much more silent: it doesn't warn like
% \pkg{hyperref} if it removes commands.
% \end{itemize}
%
% \section{Package options from hyperref}\label{sec:pkg-options}
% The driver will process the package options at the end.
% But normally options should better be set with \cs{hypersetup} after
% the package has been loaded. This is also the case for options which normally
% don't work in \cs{hypersetup}.
% One option that currently doesn't work correctly as package option is
% |ocgcolorlinks|
%
%
% Options that still must be set as package options are
% \begin{itemize}
% \item |backref|
% \item |CJKbookmarks| this key should not be used anymore. At some time
% it will be removed.
% \item |destlabel| (destination names are taken from \cs{label} if possible)
% \item |encap|
% \item |hyperfigures| (according to the \pkg{hyperref} manual
% it makes figures hyper links, but actually is a no-op for most drivers, and it
% does nothing with this driver either.)
% \item |hyperfootnotes|
% \item |hyperindex|
% \item |implicit| (redefine \LaTeX\ internals)
% \item |nesting| unneeded key, see comment below in \ref{sec:keydesc}. At some time
% it will be either removed or extended (if some use can be found).
% \item |pagebackref|
% \item |pdfpagelabels| (set PDF page labels)
% \item |psdextra| this loads some extra definitions used by \cs{pdfstringdef}.
% The new driver uses \cs{pdfstringdef} only for the bookmarks, for other strings
% it is not relevant.
% \end{itemize}
%
% Options that can be without problems set as package options are
% \begin{itemize}
% \item |debug|, |verbose| (a boolean)
% \item |bookmarks| (a boolean)
% \item |plainpages|
% \item |draft|, |final|
% \item |hypertexnames|
% \item |naturalnames|
% \item |pageanchor|
% \end{itemize}
%
% Ignored options:
% \begin{itemize}
% \item All driver options like |pdftex|, |dvipdfmx|, \ldots
% \item |raiselinks| (only used in the dviwind, textures and tex4ht driver anyway)
% \item |frenchlinks|
% \item |setpagesize|
% \item |addtopdfcreator|
% \end{itemize}
%
% \section{Disabling links}
%
% \pkg{hyperref} knows like many packages the options |draft| and |final|.
% With \pkg{hyperref} they can be used as package options or in the preamble
% in \cs{hypersetup} and disable links and anchors completely.
% The new driver passes the options also to the \pkg{bookmark} package if
% \pkg{bookmark} hasn't been loaded yet as bookmarks can't work properly if
% the anchors from \pkg{hyperref} are missing.
%
% \DescribeHypkey{link}%
% \DescribeHypkey{url}%
% \DescribeHypkey{file}%
% \DescribeHypkey{run}%
% \DescribeHypkey{menu}%
% The |draft| option is a global option that can't be undone (at least not easily).
% So the new driver offers also boolean keys |link|, |url|, |file|, |run| and |menu|
% which allow to locally disable a link type. So e.g.
% |\hypersetup{link=false}\ref{abc}| will give a reference without link (this
% is naturally also possible with |\ref*{abc}|). This disables also all hooks of
% the link type, so the link is for example no longer colored. It also removes the
% implicit grouping of the content.
%
% \DescribeHypkey{nested-links}%
%
% Links are sometimes nested. E.g. if a section heading contains a reference
% it can lead to nested links in the table of contents or if |\nameref| is used.
% That is not forbidden and normally work as expected: If the link area overlap
% normally the inner link is \enquote{on top} and chosen at a click.
% But it is not always actually wanted, so with the |nested-links| (a boolean key)
% it is possible to disable such nested links.
%
% \section{Draftmode}
% pdftex and other engines knows a
% draftmode which can be set with |\pdfdraftmode=1|
% and \pkg{hyperref} honors this in some places. The new
% driver ignores it, for example |pagelabels| are created in any case.
% With today's computer power there is not much to gain and it only complicates
% the code.
%
% This should not be confused with the |draft| and |final| package options! They
% are still honored.
%
% \section{Dropped options}
% A number of options are ignored by this driver
% \begin{description}
% \item[pdfversion] The pdfversion should be set in \cs{DocumentMetadata}
% \item[setpagesize] The key is ignored and the PDF page size is not
% set. Load \pkg{color} or \pkg{graphicx} or use a class which sets the PDF page size.
% \item[breaklinks] The option does nothing sensible anyway (apart from triggering
% a warning). Currently with latex+dvips links can't be broken. But there is work
% in progress to change this.
% \item[unicode] This is always true.
% \item[pdfa] If this option is set to true \pkg{hyperref} normally checks and sets
% a small number of requirements for the PDF standard PDF/A.
% The key is ignored with this driver. Instead the wanted standard should be declared
% in \cs{DocumentMetadata}:
% \begin{verbatim}
% \DocumentMetadata{pdfstandard=A-2b}
% \end{verbatim}
% Currently |A-1b|, |A-2b|, |A-3b| can be set.
% The support for various requirements is still incomplete, but the parts that
% \pkg{hyperref} checked are implemented:
% \begin{itemize}
% \item The |/F| key is added to links and |Print| is activated, |Hidden|, |Invisible|,
% |NoView| are deactivated.
% \item |/NeedAppearances| is suppressed
% \item Pushbuttons, which use the action |/S/JavaScript| are suppressed.
% \item Resetbuttons, which use the action |/S/ResetForm| are suppressed.
% \item In widget annotations, the /AA dictionary is suppressed.
% \end{itemize}
% \end{description}
% \section{Destinations}
% Destinations (sometimes call anchors in the \pkg{hyperref} documentation)
% are the places a link jumped too. Unlike the name may suggest they don't described
% an exact location in the PDF. Instead a destination contains a reference to
% a page along with an instruction how to display this page.
% The normally used \enquote{XYZ \textit{top left zoom}} for example instructs
% the viewer to show the page with the given \textit{zoom} and
% the top left corner at the \textit{top left} coordinates---which then gives
% the impression that there is an anchor at this position.
%
% From these instructions two (|Fit| and |FitB|) don't take an argument.
% All others take one (|FitH|, |FitV|, |FitBH|, |FitBV|)
% or more (|XYZ|, |FitR|) arguments. These arguments are normally
% coordinates, |XYZ| takes also a zoom factor. The coordinates are
% absolute coordinates in |bp| relative to the lower left corner
% of the PDF.
%
% With the primitive command \cs{pdfdest} of pdftex almost all instructions are created
% with a keyword only: The needed coordinate is calculated automatically from the location
% the \cs{pdfdest} command is issued. So to get a specific coordinate one has to
% move the command to the right place. E.g.
% \begin{verbatim}
% \AddToHookNext{shipout/background}
% {\put(0,-\pdfpageheight+100bp){\pdfdest name{destA} FitH\relax}}
% \end{verbatim}
%
% Exceptions are the |XYZ| instruction, where pdftex accepts a keyword
% |zoom| followed by a zoom factor, and the |FitR| instruction
% which understands the keywords |width|, |height| and |depth|
% followed by a dimension, which is then used to calculate a rectangle relative to the
% current location. If no keywords are given the dimensions are taken from the surrounding
% box---which can also lead to zero sized areas.
%
% The manual of \pkg{hyperref} gives a bit the impression as if this
% coordinates can be set manually by the user but as described above this is
% mostly wrong: It is for normal destination only possible with a dvi-backend like
% dvips which make use of |pdfmark.def|. pdftex and luatex can use manual coordinates
% only for |pdfstartview| and |pdfremotestartview|.
% As dvips was the first driver of \pkg{hyperref} the option |pdfview| was at first
% developed for it and then adapted to pdftex. But this had the effect that the handling
% of the option |pdfview| is inconsequent across the backend and engines:
% For example with |pdfview=FitH 100| pdftex ignores the
% number and calculates its own, while dvips sets the coordinate to the absolute
% 100. The zoom factor of |XYZ| is not supported by the pdftex driver at all, and
% |FitR| only partially.
%
% The generic driver consolidate this but tries to stay compatible with the other
% drivers as far as possible.
% It also takes into account that |pdfview| and |pdfstartview| and |pdfremotestartview|
% have different requirements: While for the first relative coordinates are fine,
% for the two others absolute coordinates are more sensible.
%
% \DescribeHypkey{pdfview}
% \DescribeHypkey{pdfstartview}
% \DescribeHypkey{pdfremotestartview}
% So with this driver the options
% |pdfview|, |pdfstartview| and |pdfremotestartview| take
% the following options:
% \begin{itemize}
% \item |Fit|, |FitB|, |FitH|, |FitV|,
% |FitBH|, |FitBV| which can be followed by a positive integer (separated by a space) or the
% keyword |null|.
% The number can be gives as a \meta{dimension expression} surrounded with
% \cs{hypercalcbp}. The driver redefines this command to use
% \cs{dim_to_decimal_in_bp:n}.
% \begin{itemize}
% \item |pdfview| will ignore the integer and any other arguments and calculate
% the expected coordinates as described above for pdftex with all
% supported engines and backends.
% \item |pdfstartview| and |pdfremotestartview| will pass the optional
% number or keyword after expansion as absolute coordinate. Missing numbers will
% be filled up with |null|.
% \end{itemize}
%
% \item |XYZ|. This can be followed (separated by spaces) by up to three
% positive integers or keywords |null| which are then taken as \textit{top left zoom}
% in this order. \textit{zoom} is a factor, so e.g. 0.5 will give a scaling of 50\%.
% \begin{itemize}
% \item |pdfview| will use the last value as \textit{zoom}, ignore all other values
% and calculate the expected coordinates as described above for pdftex with all
% supported engines and backends (this means it is possible to use |XYZ 2| to
% set a zoom of 200\%, it is not necessary to fill in dummy values.)
% \item |pdfstartview| and |pdfremotestartview| will pass the optional
% numbers or keyword after expansion as absolute coordinates and zoom.
% Missing numbers will be filled up with |null|.
% \end{itemize}
% This new behaviour is in part incompatible with previous handling with the dvips driver.
%
%
% \item |FitR|.
% If no argument (separated by spaces) follows then
% |pdfview| will use with pdftex and luatex
% the automatic calculation of the coordinates from the encompassing box. With
% dvips and (x)dvipdfmx it will fall back to |Fit|.
% |pdfstartview| and |pdfremotestartview| will fallback to |Fit| too.
%
% If arguments (separated by spaces) follow they should be
% four numbers representing \texttt{left bottom right top}.
% \begin{itemize}\item
% |pdfview| will use the values to calculate coordinates relative to the current
% location. So |0 -100 200 400| will give a \enquote{box} of width 200bp,
% height 400bp and depth 100dp that the destination should encompass.
% Missing numbers will be set to 0. But one should be aware that is it is quite
% unpredictable how viewers which support |FitR| handles zero sizes.
%
% \item |pdfstartview| and |pdfremotestartview| will pass
% the values as absolute coordinates.
% \end{itemize}
% \end{itemize}
%
% \subsection{Names of destinations}
% hyperref creates two types of destination names: For numbered structures
% (so when the anchor is set by \cs{refstepcounter}) it builds the name
% from the counter name and the \cs{theH...} representation: |<counter name>.\theH<counter name>|.
%
% For unnumbered structures, e.g. starred chapters or anchors created with \cs{phantomsection}
% it uses names like |section*.<number>| and |chapter*.<number>|.
%
% Typically the name of destination can be retrieved by setting a label, this works also
% with unnumbered sections.
% The anchor and also the page can be retrieve in an expandable way
% with the help of commands from the
% \pkg{refcount} package which is loaded by hyperref. For example with the
% following commands it is possible to use the label to create a bookmark:
%
% \begin{verbatim}
% \bookmark[dest=\getrefbykeydefault{label}{anchor}{Doc-Start}]{my bookmark}
% \bookmark[dest=page.\getrefbykeydefault{label}{page}{Doc-Start}]{my bookmark}
% \end{verbatim}
%
% If a \cs{HyperDestNameFilter} is defined, this must be added around the definition,
% so actually the full code has to look like this
% \begin{verbatim}
% \bookmark[dest=
% \HyperDestNameFilter{\getrefbykeydefault{label}{anchor}{Doc-Start}}]{mysection}
% \end{verbatim}
% To simplify this hyperref provides |\hyperget{anchor}{label}| and
% |\hyperget{pageanchor}{label}|
%
%\section{Assorted key descriptions}\label{sec:keydesc}
%The following gives a few details to some keys that are perhaps not
%completely described in the manual, or are a bit different in this driver.
%The list is alphabetic.
%
% \DescribeHypkey{bookmarkstype} This key takes as value the extension of a list
% like |toc| or |lof|. If this list uses \cs{addcontentsline} the content will
% be added to the bookmarks. The key can be use in \cs{hypersetup} and also in
% the middle of the document to switch the list.
%
% \DescribeHypkey{bordercolormodel} With |bordercolormodel| the colormodel used in the |/C|
% key of the annotation array and in similar keys is set. It does not affect
% the text and graphics colors in the page stream.
% Possible choices are |rgb| (three numbers in the array) and |cmyk| (four numbers).
% While the PDF reference allows four numbers, PDF readers don't necessarily handle
% this correctly, so the value can be wrong.
%
% \DescribeHypkey{destlabel} This is a boolean key. Currently it must be set
% as package option. If set to true, the name
% of a destination is taken from a following \cs{label}, if there is one before
% the next destination command. This requires two compilations to get
% the correct coordinates in the destination. In the first compilation
% the alias name is recorded in the aux-file:
% \begin{verbatim}
% \hyper@newdestlabel{section.1.2}{sec:sec2}
% \end{verbatim}
% The next compilation can then make use of it.
% The two-pass could be avoided in the future with a better labeling system,
% where the name if set earlier.
%
% \DescribeHypkey{extension} This key sets an variable that has two purposes:
% It is used if file name has not extension, and it decides if the annotation
% is a URI or GoToR annotation. So
% \begin{verbatim}
% \hypersetup{extension=dvi}
% \href{mwe1.pdf}{pdf}
% \href{mwe2.dvi}{dvi}
% \href{mwe3}{no ext}
% \end{verbatim}
% will create
% \begin{verbatim}
% /Subtype/Link/A<</S/URI /URI(mwe1.pdf)>>
% /Subtype/Link/A<</S/GoToR /F (mwe2.dvi)>>
% /Subtype/Link/A<</S/GoToR /F (mwe3.dvi)>>
% \end{verbatim}
% Typically PDF viewer can handle only GoToR annotations pointing to a PDF.
% So normally the default value |pdf| of this key should not be changed.
% \DescribeHypkey{nesting}\label{key:nesting}%
% This key is useless in PDF context. The boolean is only used in
% the code for anchors/destination where nesting doesn't make sense.
% It should not be changed.
%
% \DescribeHypkey{pdfborder}\DescribeHypkey{linkborder}\DescribeHypkey{urlborder}
% \DescribeHypkey{runborder}\DescribeHypkey{menuborder}
% This key set accept as value three numbers or three numbers and an array describing
% a dash pattern, examples are |0 0 1| or |0 0 1 [3 2]|.
% The first two numbers should according to the reference set round
% corners, but PDF viewer seem to ignore it. The third number is the line width
% of the border. Settings done with |pdfborderstyle| should take precedence.
%
% \DescribeHypkey{pdfborderstyle}\DescribeHypkey{linkborderstyle}
% \DescribeHypkey{urlborderstyle}\DescribeHypkey{fileborderstyle}
% \DescribeHypkey{runborderstyle}\DescribeHypkey{menuborderstyle}
% The value of this key is the content of the |BS| dictionary.
% As an example |/Type/Border /W 1 /S/U /D[3 2]|
%
% \begin{tabular}{>{\ttfamily} lll}
% Key & Values & comment / example\\\hline
% /Type & |/Border| & optional \\
% /W & \meta{number} & Width of border line \\
% /S & |/S| & solid (default)\\
% & |/D| &dash pattern can be set with /D\\
% & |/B| & beveled\\
% & |/I| & inset\\
% & |/U| & underline\\
% /D & \meta{array of numbers} & dash pattern (lines/gaps) (default [3])
% \end{tabular}
%
% \DescribeHypkey{pdfcreationdate}\DescribeHypkey{pdfmoddate}\DescribeHypkey{pdfmetadate}
% Setting these keys is normally not needed. If they are used the values
% of the first two keys are stored directly in the Info dictionary for
% |/Creationdate| and |/ModDate|. All three keys are used in XMP-metadata.
% The values are converted to strings but not processed further, so they should
% have the correct PDF format without the enclosing parentheses,
% e.g. |D:20200202111111+01'00'|.
%
% \DescribeHypkey{pdflinkmargin}As described in the \pkg{hyperref} manual
% the behaviour differs between the backends: with dvips it is possible to
% change links locally, pdflatex and lualatex work by page, with dvipdfmx
% the setting is global (and has to be done in the preamble).
%
% \DescribeHypkey{pdflang} The key will work, but it is recommended to the set
% the language in \cs{DocumentMetadata} instead.
%^^A %% This is an adapted version of hluatex.def
%^^A %% meant to test the use of the commands
%^^A %% from pdfmanagement.sty
%^^A %%
%^^A %% drivers are loaded in line 4745 in hyperref.sty in a \Hy@AtEndOfPackage command.
%^^A %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%^^A %% list of new internal commands
%^^A %% @@_link_goto_begin:nw : start command for links to internal destination
%^^A %% replaces \find@pdflink
%^^A %% @@_link_goto_end:
%^^A %% @@_destination:n : sets an anchor, replaces \new@pdflink
%^^A %% \@@_PageLabels_gpush: : puts pagelabels in the catalog, used on every storing
%^^A %% PDF String (text)
%^^A %% *\@@_text_pdfstring:nnN : replaces Hy@pstringdef, converts #1 to pdfstring in encoding #2
%^^A %% and stores in N
%^^A %% Build with:
%^^A %% *\@@_text_purify:nN
%^^A %% *\@@_text_cleanup:N
%^^A %% *\@@_text_convert:nN
%^^A %%
%^^A %% Destinations (dest)
%^^A %% \l_@@_dest_box
%^^A %%
%^^A %% References (ref)
%^^A %% *\@@_property_record:nn
%^^A %% *\property_if_recorded:nn
%^^A %% *\property_ref_undefined_warn:nn,
%^^A %% % helps to display key list messages
%^^A %% \@@_clist_display:n
%^^A %%
%^^A %% \@@_info_generate_addons: what did this do??
%^^A %%
%^^A %% \g_@@_AcroForm_CoFields_prop
%^^A %% \g_@@_AcroForm_Fields_prop
%^^A %%
%^^A %% \g_@@_dest_pdfstartpage_tl ,
%^^A %% \g_@@_dest_pdfstartview_tl ,
%^^A %% \l_@@_dest_pdfremotestartview_tl ,
%^^A
%^^A %% Constants
%^^A %% *\c_@@_map_annot_hyp_prop
%^^A %% *\c_@@_dest_undefined_tl
%^^A %% Temp variables
%^^A %% \l_@@_tmpa_seq
%^^A %% \l_@@_tmpa_box
%^^A %% \l_@@_tmpa_tl
%^^A %% \l_@@_tmpa_str
%^^A %% \l_@@_tmpa_int
%^^A %%
%^^A %% \l_@@_dest_name_tmpa_tl
%^^A %% \l_@@_uri_tmpa_tl
%^^A %% \l_@@_filename_tmpa_tl
%^^A %% \l_@@_para_tmpa_tl
%^^A %% \l_@@_text_tmpa_str
%^^A %% \g_@@_text_tmpa_str
%^^A %% \g_@@_bordercolormodel_tl
%
%^^A %% \l_@@_dest_pdfview_tl
%^^A %% list of commands which probably will have to change
%^^A TODO: move hrefurl, hrefrun, hrefpdf into hyperref. They should also work
% \end{documentation}
% \begin{implementation}
% \part{\pkg{hyperref-generic} driver implementation}
% \begin{macrocode}
%<*package>
%<@@=hyp>
% \end{macrocode}
% \begin{macrocode}
\ProvidesFile{hgeneric-testphase.def}[2024-12-20 v0.96o %
generic Hyperref driver for the LaTeX PDF management testphase bundle]
\RequirePackage{etoolbox} %why?
% \end{macrocode}
% Temporary command definition, can be remove when hyperref is update too.
% \begin{macrocode}
\long\def\Hy@ReturnAfterFi#1\fi{\fi#1}
% \end{macrocode}
% \begin{macrocode}
\ExplSyntaxOn
\file_input:n {hyperref-colorschemes.def}
\ExplSyntaxOff
% \end{macrocode}
%
%
% \section{messages}
% Redirect the message name:
% \begin{macrocode}
\ExplSyntaxOn
\prop_gput:Nnn \g_msg_module_name_prop { hyp }{ hyperref }
% \end{macrocode}
% At first a message for the testing of the resource management
% \begin{macrocode}
\cs_if_exist:NTF \DocumentMetadata
{
\msg_new:nnnn
{ hyp }
{ missing-resource-management }
{ The~PDF~resource~management~is~required~for~this~hyperref~driver! }
{
Activate~it~with \\
\tl_to_str:n{\DocumentMetadata{<options>}}\\