[latex3-commits] [git/LaTeX3-latex3-hyperref] testnewkeyval: WIP, colorlinks and co (298aac0)

Ulrike Fischer fischer at troubleshooting-tex.de
Wed Jul 6 19:49:52 CEST 2022


Repository : https://github.com/latex3/hyperref
On branch  : testnewkeyval
Link       : https://github.com/latex3/hyperref/commit/298aac0b0364ec1b3f42111d2d17de52d32d26b8

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

commit 298aac0b0364ec1b3f42111d2d17de52d32d26b8
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Wed Jul 6 19:49:52 2022 +0200

    WIP, colorlinks and co


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

298aac0b0364ec1b3f42111d2d17de52d32d26b8
 hyperref.dtx | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 54 insertions(+), 2 deletions(-)

diff --git a/hyperref.dtx b/hyperref.dtx
index 8497457..35c0843 100644
--- a/hyperref.dtx
+++ b/hyperref.dtx
@@ -6320,11 +6320,63 @@
 %    \end{macrocode}
 %
 % \section{Options to change appearance of links}\label{appearance}
-% Colouring links at the \LaTeX\ level is useful for debugging, perhaps.
-%    \begin{macrocode}
+% Colouring links at the \LaTeX\ level is not only useful for debugging.
+% So we allow to switch also in the document.
+% The options must be defined so that they work with the generic driver
+% and with the other drivers.
+% We assume for now that the generic driver is used if |\DocumentMetadata| has been
+% used; this is perhaps not true.
+%    \begin{macrocode}
+\newcommand \Hy at set@colorlinks
+  {%
+    \def\Hy at colorlink#1{\begingroup\HyColor at UseColor#1}%
+    \def\Hy at endcolorlink{\endgroup}%
+    \def\@pdfborder{0 0 0}%
+    \let\@pdfborderstyle\@empty
+  }
+\newcommand \Hy at set@hidelinks
+  {%
+    \def\Hy at colorlink#1{\begingroup#1}%
+    \def\Hy at endcolorlink{\endgroup}%
+    \def\@pdfborder{0 0 0}%
+    \let\@pdfborderstyle\ltx at empty
+  }
+\newcommand \Hy at set@frenchlinks
+ {%
+   \def\Hy at colorlink#1{\begingroup\fontshape{\scdefault}\selectfont}%
+   \def\Hy at endcolorlink{\endgroup}%
+ }
 \define at key{Hyp}{colorlinks}[true]{%
   \Hy at boolkey{colorlinks}{#1}%
 }
+
+\ExplSyntaxOn
+\IfDocumentMetadataTF
+ {
+   \DeclareKeys
+     {
+       ,colorlinks .choice:
+       ,colorlinks / true .code:n =
+        {
+          \AtEndOfPackage {\keys_set:nn { hyp / setup }{colorlinks=true}}
+        }
+       ,colorlinks / false .code:n =
+        {
+          \AtEndOfPackage {\keys_set:nn { hyp / setup }{colorlinks=false}}
+        }
+       ,colorlinks .default:n = true
+     }
+ }
+ {
+   \DeclareKeys
+    {
+      colorlinks .code:n =
+       {
+
+       }
+    }
+ }
+\ExplSyntaxOff
 \DeclareVoidOption{hidelinks}{%
   \Hy at colorlinksfalse
   \Hy at ocgcolorlinksfalse





More information about the latex3-commits mailing list.