| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
%% File: hyperref-generic.dtx |
| 4 |
% |
| 5 |
% Copyright (C) 2021-2026 The LaTeX Project |
| 6 |
% |
| 7 |
% It may be distributed and/or modified under the conditions of the |
| 8 |
% LaTeX Project Public License (LPPL), either version 1.3c of this |
| 9 |
% license or (at your option) any later version. The latest version |
| 10 |
% of this license is in the file |
| 11 |
% |
| 12 |
% http://www.latex-project.org/lppl.txt |
| 13 |
% |
| 14 |
% This file is part of the "LaTeX PDF management bundle" (The Work in LPPL) |
| 15 |
% and all files in that bundle must be distributed together. |
| 16 |
% |
| 17 |
% The released version of this bundle is available from CTAN. |
| 18 |
% |
| 19 |
% ----------------------------------------------------------------------- |
| 20 |
% |
| 21 |
% The development version of the bundle can be found at |
| 22 |
% |
| 23 |
% https://github.com/latex3/pdfresources |
| 24 |
% |
| 25 |
% for those people who are interested. |
| 26 |
% |
| 27 |
%<*driver> |
| 28 |
\DocumentMetadata{tagging=on,pdfstandard=ua-2} |
| 29 |
\documentclass{l3in2edoc} |
| 30 |
\usepackage{tabularx,array,booktabs} |
| 31 |
\hypersetup{pdfauthor=The LaTeX Project, |
| 32 |
pdftitle=generic hyperref driver (LaTeX PDF management bundle)} |
| 33 |
\premulticols=4cm |
| 34 |
\begin{document} |
| 35 |
\DocInput{\jobname.dtx} |
| 36 |
\end{document} |
| 37 |
%</driver> |
| 38 |
% \fi |
| 39 |
% \NewDocElement[ |
| 40 |
% idxgroup=hypersetup keys\actualchar\cs{hypersetup} keys, |
| 41 |
% idxtype = {hypersetup key}, |
| 42 |
% printtype= \textit{setup key} |
| 43 |
% ]{Hypkey}{xhypkey} |
| 44 |
% \ExplSyntaxOn |
| 45 |
% \NewDocumentEnvironment{hypkey}{m} |
| 46 |
% { |
| 47 |
% \clist_map_inline:nn {#1}{\begin{xhypkey}{##1}} |
| 48 |
% } |
| 49 |
% { |
| 50 |
% \clist_map_inline:nn {#1}{\end{xhypkey}} |
| 51 |
% } |
| 52 |
% \ExplSyntaxOff |
| 53 |
% \NewDocElement[ |
| 54 |
% idxgroup=color names, |
| 55 |
% idxtype = {color name}, |
| 56 |
% printtype= \textit{color name} |
| 57 |
% ]{HypColor}{xhypcolor} |
| 58 |
% \ExplSyntaxOn |
| 59 |
% \NewDocumentEnvironment{hypcolor}{m} |
| 60 |
% { |
| 61 |
% \clist_map_inline:nn {#1}{\begin{xhypcolor}{##1}} |
| 62 |
% } |
| 63 |
% { |
| 64 |
% \clist_map_inline:nn {#1}{\end{xhypcolor}} |
| 65 |
% } |
| 66 |
% \ExplSyntaxOff |
| 67 |
% |
| 68 |
% \title{^^A |
| 69 |
% The \pkg{hyperref-generic} module \\ A generic driver for hyperref ^^A |
| 70 |
% } |
| 71 |
% |
| 72 |
% \author{^^A |
| 73 |
% The \LaTeX{} Project\thanks |
| 74 |
% {^^A |
| 75 |
% E-mail: |
| 76 |
% \href{mailto:[email protected]} |
| 77 |
% {[email protected]}^^A |
| 78 |
% }^^A |
| 79 |
% } |
| 80 |
% |
| 81 |
% \date{Version 0.97c, released 2026-05-26} |
| 82 |
% |
| 83 |
% \maketitle |
| 84 |
% \begin{documentation} |
| 85 |
% This module generates a generic driver \texttt{hgeneric.def}/\texttt{hgeneric-testphase.def} |
| 86 |
% for \pkg{hyperref} meant to be used |
| 87 |
% with the new \LaTeX{} PDF management code. It is loaded automatically |
| 88 |
% if the PDF management code is active. The name of the driver will change after |
| 89 |
% the testphase. |
| 90 |
% |
| 91 |
% The generic driver can be used with pdflatex, lualatex, xelatex, latex with |
| 92 |
% dvipdfmx, latex with dvips+ps2pdf. latex with dvips+distiller could work too |
| 93 |
% but is untested. (x)dvipdfmx will probably soon support dvilualatex, then this |
| 94 |
% combination should work too. |
| 95 |
% |
| 96 |
% The driver \emph{requires} the new PDF management code, so documents wanting to use it |
| 97 |
% should start like this (this requires \LaTeX-2022-06-01 or newer): |
| 98 |
% |
| 99 |
%\begin{verbatim} |
| 100 |
% \RequirePackage{pdfmanagement} %loads the PDF management and activates it |
| 101 |
% \SetKeys[document/metadata] |
| 102 |
% { |
| 103 |
% %% options, e.g., pdf version: |
| 104 |
% pdfversion=1.7, |
| 105 |
% } |
| 106 |
% \end{verbatim} |
| 107 |
% |
| 108 |
% If a special backend is needed it can be passed as option: |
| 109 |
% \begin{verbatim} |
| 110 |
% \RequirePackage[backend=dvipdfmx]{pdfmanagement} |
| 111 |
% \end{verbatim} |
| 112 |
% |
| 113 |
% The pdfmanagement is also loaded if \cs{DocumentMetadata} is used e.g. for |
| 114 |
% tagging |
| 115 |
% \begin{verbatim} |
| 116 |
% \DocumentMetadata %loads the PDF management and activates it |
| 117 |
% { |
| 118 |
% %% options |
| 119 |
% %% e.g. tagging, pdf version, backend: |
| 120 |
% % tagging=on, |
| 121 |
% % pdfversion=1.7, |
| 122 |
% % backend = dvipdfmx |
| 123 |
% } |
| 124 |
% \end{verbatim} |
| 125 |
% |
| 126 |
% The new driver tries to be compatible with the standard \pkg{hyperref} drivers |
| 127 |
% but there are nevertheless differences. Some of them due to the still experimental |
| 128 |
% status of the driver, others are design decisions: one part of the project is |
| 129 |
% to clean up and modernize the code. The following sections try to describe |
| 130 |
% the differences but also to document some of the rationales of the changes, |
| 131 |
% and to add some details and comments about the existing options and so to |
| 132 |
% extend the \pkg{hyperref} manual. |
| 133 |
% |
| 134 |
% \section{Avoiding transition problems} |
| 135 |
% Some code will only work properly after other packages have been adapted to |
| 136 |
% the new PDF management code and the changes in this driver. |
| 137 |
% This will take some time. Until then it is recommended to follow |
| 138 |
% the following rules |
| 139 |
% \begin{itemize} |
| 140 |
% \item Package options are processed at the end of the driver, |
| 141 |
% Class options are ignored. But not every option already works as package options, |
| 142 |
% in some cases \pkg{hyperref} interferes. So |
| 143 |
% it is recommended for most options ---with the exception of a few mentioned below in |
| 144 |
% section~\ref{sec:pkg-options}---to set them in \cs{hypersetup}, |
| 145 |
% not as package option. |
| 146 |
% \item This driver uses the \pkg{l3color} module for the colors. All colors |
| 147 |
% defined with \cs{color_set:nn} or \cs{color_set:nnn} will work. |
| 148 |
% Colors defined with \pkg{xcolor} will work if they don't use one of |
| 149 |
% the special color models not supported by \pkg{l3color} as |
| 150 |
% \pkg{pdfmanagement-firstaid} contains a patch for xcolor. |
| 151 |
% If the package \pkg{color} is used it is currently recommended to define |
| 152 |
% colors after \pkg{hyperref}. |
| 153 |
% \item Load a color package or graphicx to get the right page sizes. |
| 154 |
% \item Report problems! Only known problem can be resolved. |
| 155 |
% \end{itemize} |
| 156 |
% |
| 157 |
% |
| 158 |
% \section{Bookmarks / outlines} |
| 159 |
% The new driver doesn't contain code to handle bookmarks/outlines. |
| 160 |
% Instead it forces the loading of the \pkg{bookmark} package |
| 161 |
% unless the package option |bookmarks=false| |
| 162 |
% has been used. It is possible to disable bookmarks with |\hypersetup{bookmarks=false}|. |
| 163 |
% |
| 164 |
% \section{\enquote{Metadata}} |
| 165 |
% |
| 166 |
% \enquote{Metadata}, information about the document, are stored in a PDF in two |
| 167 |
% places: The |/Info| dictionary and the XMP-metadata. \pkg{hyperref} only handles the |
| 168 |
% |/Info| dictionary. The XMP-metadata are added by code from \pkg{l3pdfmeta}. |
| 169 |
% (without the pdfmanagement the XMP-metadata can be added with packages like \pkg{pdfx} and |
| 170 |
% \pkg{hyperxmp}). |
| 171 |
% |
| 172 |
% The |/Info| dictionary can be filled with arbitrary keys, but the PDF viewer typically |
| 173 |
% care only about a few, like |/Author|, |/Title| and |/Keywords|. |
| 174 |
% A number of |/Info| keys, like dates and the producer, are added automatically |
| 175 |
% by the engines and backends. |
| 176 |
% Some of them can only be removed with special commands, some not at all. |
| 177 |
% But---with the exception of |/Producer| when using the dvips backend---they |
| 178 |
% can be overwritten. |
| 179 |
% |
| 180 |
% The current handling of the metadata is problematic: |
| 181 |
% \begin{itemize} |
| 182 |
% \item External package like \pkg{hyperxmp} wants to access them too and for |
| 183 |
% this had to patch an number of internal \pkg{hyperref} commands---which is a problem |
| 184 |
% if the internal commands change (as happens with this new driver) |
| 185 |
% \item \pkg {hyperref} (and also \pkg{hyperxmp}) |
| 186 |
% tries to deduce some data from document commands like |
| 187 |
% \cs{title} or \cs{author}---something that worked reasonably well when only |
| 188 |
% some standard classes with well-known definitions of these command existed, |
| 189 |
% but gets problematic with classes and packages which define |
| 190 |
% more powerful commands knowing a variety of optional arguments to set authors and |
| 191 |
% affiliations and title information. |
| 192 |
% \end{itemize} |
| 193 |
% |
| 194 |
% To resolve some of this problem the driver will |
| 195 |
% \begin{itemize} |
| 196 |
% \item \emph{Not} try deduce author and title from documents. They have to be set in |
| 197 |
% \cs{hypersetup} with |pdfauthor| and |pdftitle|. It is recommended to separate |
| 198 |
% more than one author by commas, and to hide commas inside braces if needed: |
| 199 |
% |
| 200 |
% \begin{verbatim} |
| 201 |
% pdfauthor = {Bär, Peter Anteater, {Riley, the sloth}} |
| 202 |
% \end{verbatim} |
| 203 |
% |
| 204 |
% \item It is possible to store titles in more than one language. If the value begins with |
| 205 |
% an \enquote{optional argument} which represents a language tag, the value is taken |
| 206 |
% as a comma list and split. The first value is used for the Info dictionary, |
| 207 |
% the others are used in the XMP-metadata. Commas in a title must then be |
| 208 |
% protected with braces: |
| 209 |
% |
| 210 |
% \begin{verbatim} |
| 211 |
% pdftitle = {[en]English Title,[de] Deutscher Titel,[fr]{titre français, avec comma}} |
| 212 |
% \end{verbatim} |
| 213 |
% |
| 214 |
% |
| 215 |
% \item All values of relevant keys (including keys from the hyperxmp package) |
| 216 |
% will be stored in a Metadata container, and can be retrieved with |
| 217 |
% \cs{GetDocumentProperty}. |
| 218 |
% |
| 219 |
% \begin{verbatim} |
| 220 |
% \edef\my@pdfauthor{\GetDocumentProperty{hyperref/pdfauthor}} |
| 221 |
% \end{verbatim} |
| 222 |
% If the key hasn't be set, the result is empty. This gives external |
| 223 |
% packages a public and reliable access to the data. |
| 224 |
% |
| 225 |
% \item |pdflang| is deprecated. Instead it can be passed |
| 226 |
% with \cs{DocumentMetadata} or the \texttt{document/metadata} key: |
| 227 |
% \begin{verbatim} |
| 228 |
% \DocumentMetadata{lang=de-DE} |
| 229 |
% \end{verbatim} |
| 230 |
% or |
| 231 |
% \begin{verbatim} |
| 232 |
% \RequirePackage{pdfmanagement} |
| 233 |
% \SetKeys[document/metadata]{lang=de-DE} |
| 234 |
% \end{verbatim} |
| 235 |
|
| 236 |
% The value can be retrieved as |document/lang|. |
| 237 |
% |
| 238 |
% \item The code supports two new keys now to set the reservation of rights relative to text \& data mining |
| 239 |
% (TDM): |pdftdmreservation| which should be either 0 or 1, and |pdftdmpolicy| which |
| 240 |
% should be an url pointing to the policy, see \url{https://pdfa.org/resource/xmp-extension-schema-templates/#tdmrep}. |
| 241 |
% |
| 242 |
% \end{itemize} |
| 243 |
% \section{Dates} |
| 244 |
% \pkg{hyperref} has a few keys to set dates. They typically expect the date |
| 245 |
% in \enquote{PDF} format: |D:YYYYMMDDhhmmss+01'00'|. |
| 246 |
% |
| 247 |
% |
| 248 |
% \section{PDF page size (mediabox)} |
| 249 |
% The standard \pkg{hyperref} driver contain code to set the PDF page size. |
| 250 |
% There is no real justification why this is done by \pkg{hyperref} apart from the |
| 251 |
% fact that \LaTeX{} itself doesn't do it and that the needed special code could |
| 252 |
% be added to the backend drivers. |
| 253 |
% |
| 254 |
% In the new driver this code is gone. The reason is not that it is |
| 255 |
% difficult to set the MediaBox, actually it could be done with one line of code: |
| 256 |
% \begin{verbatim} |
| 257 |
% \pdfmanagement_add:nnn{Page}{MediaBox} |
| 258 |
% {[0~0~\dim_to_decimal_in_bp:n{\paperwidth}~ |
| 259 |
% \dim_to_decimal_in_bp:n{\paperheight}]} |
| 260 |
% \end{verbatim} |
| 261 |
% |
| 262 |
% The problem is to know which value to use (with the memoir class e.g.\cs{stockwidth} |
| 263 |
% should be used instead of \cs{paperwidth}), |
| 264 |
% and detecting this not a \pkg{hyperref} task. Instead the packages which change |
| 265 |
% these values should also set the PDF page size. Also there are |
| 266 |
% too many actors here: color/graphicx, geometry,the KOMA-classes, memoir, |
| 267 |
% \ldots\ all try to set this. |
| 268 |
% |
| 269 |
% So if the PDF page size is wrong: load one of the other packages setting it |
| 270 |
% e.g. the \pkg{color} or the \pkg{graphicx} package. |
| 271 |
% |
| 272 |
% \section{Commands to create \enquote{external} references} |
| 273 |
% \pkg{hyperref} has three commands related to external references like |
| 274 |
% URL and file: \cs{url}, |
| 275 |
% \cs{nolinkurl} and \cs{href}. The first two take one argument, |
| 276 |
% while the last has two: the url and some free text. |
| 277 |
% |
| 278 |
% |
| 279 |
% \cs{url} and \cs{href} create link annotations. \cs{url} creates always an URI |
| 280 |
% type, \cs{href} creates URI, GoToR and Launch |
| 281 |
% depending on the structure of the argument. |
| 282 |
% |
| 283 |
% \cs{href} has to create a (in the PDF) valid url or file name from its first argument. |
| 284 |
% \cs{url} has to create a (in the PDF) valid url from its only argument and has also to print |
| 285 |
% this argument as url. \cs{nolinkurl} only prints the url. |
| 286 |
% |
| 287 |
% For the printing \cs{url} and \cs{nolinkurl} rely on the url package and its \cs{Url} command. |
| 288 |
% |
| 289 |
% (Expandable) commands are expanded and special chars can also be input by commands but |
| 290 |
% beside this no conversion is done: for all input \pkg{hyperref} basically assumes that |
| 291 |
% the input is already a valid percent encoded url or a valid file name. \pkg{hyperref} also |
| 292 |
% doesn't extend or add protocols. |
| 293 |
% |
| 294 |
% As nowadays everyone is used to copy and paste links with all sorts of unicode into a browser and |
| 295 |
% they work the \pkg{hyperref} input is clearly rather restricted. |
| 296 |
% |
| 297 |
% So the new driver tries to extend the input and print options. Both \cs{href} and \cs{url} |
| 298 |
% can now be told to accept non-ascii url's and to convert them internally to |
| 299 |
% percent encoding. It is possible to define a standard protocol and so to avoid to |
| 300 |
% have to type it all the time. |
| 301 |
% |
| 302 |
% But extending the \emph{print} options for \cs{url} and \cs{nolinkurl} while still |
| 303 |
% using the url-package is hard to impossible in pdf\LaTeX{} due to the way the url package works. |
| 304 |
% Some chars can be added with the help of \cs{UrlSpecial} (at the cost of warnings) |
| 305 |
% but it doesn't work for every input and documenting and explaining all the edge cases is no joy. |
| 306 |
% So instead the new driver offers here the option to use different commands to format |
| 307 |
% the printed output. It must be noted that this disable the special \enquote{hyphenation} method of |
| 308 |
% url's. |
| 309 |
% |
| 310 |
% |
| 311 |
% \subsection{Special problem: links to files} |
| 312 |
% |
| 313 |
% When a file is linked with \cs{href} than normally it is added as URI link. The exceptions are PDF's: |
| 314 |
% for them PDF has the special type GoToR which allows also to link to a destination or a special page. |
| 315 |
% |
| 316 |
% After a number of tests with various PDF viewer established that non-ascii files names don't |
| 317 |
% work at all with a simple file name specification GoToR links now use a full |
| 318 |
% filespec dictionary. This works better, but still no every PDF viewer support this correctly. |
| 319 |
% on various system. |
| 320 |
% |
| 321 |
% The following can be used to test viewers. It assumes that a \texttt{test.pdf}, |
| 322 |
% a \texttt{grüßpdf.pdf} and a \texttt{grüße.txt} are in the current folder. |
| 323 |
% |
| 324 |
% \hrefpdf{test.pdf}{test-ascii} |
| 325 |
% |
| 326 |
% \hrefpdf{grüßpdf.pdf}{test grüßpdf.pdf} |
| 327 |
% |
| 328 |
% \hrefurl[urlencode]{grüße.txt}{test grüße.txt} |
| 329 |
% |
| 330 |
% |
| 331 |
% \subsection{Splits} |
| 332 |
% |
| 333 |
% \cs{href} tries to be clever and to detect from the argument |
| 334 |
% if a url or a file link or a launch command should be created. |
| 335 |
% |
| 336 |
% The rules are not trivial, and they make the code complicated. |
| 337 |
% This detection also makes it more difficult to handle special cases |
| 338 |
% like non-ascii input for the link types. |
| 339 |
% |
| 340 |
% For this reason three new commands have been create: |
| 341 |
% |
| 342 |
% \begin{itemize} |
| 343 |
% \item \cs{hrefurl} for standard urls (and non-pdf files) |
| 344 |
% \item \cs{hrefpdf} for references to pdf files |
| 345 |
% \item \cs{hrefrun} for launch links |
| 346 |
% \end{itemize} |
| 347 |
% |
| 348 |
% The new commands don't use prefixes like \cs{href}. |
| 349 |
% Their argument should be the real content. |
| 350 |
% |
| 351 |
% \subsection{Options} |
| 352 |
% All \cs{href} commands and \cs{url} have an option argument for keyval syntax. |
| 353 |
% It accepts the following keys. Not all keys make sense for all keys, but they don't |
| 354 |
% error, they are silently ignored. The optional argument can currently not be used together |
| 355 |
% with the \cs{urldef} command. |
| 356 |
% |
| 357 |
% \begin{tabular}{llp{6cm}} |
| 358 |
% key & applicable commands & note\\\hline |
| 359 |
% urlencode & \cs{hrefurl} & if set the code will convert the argument to percent encoding. This allows non-ascii input.\\ |
| 360 |
% protocol & \cs{hrefurl}, \cs{url} & This sets a prefix/protocol that is added to the url, see below. \\ |
| 361 |
% format & \cs{url} & a command used to format the printed text. It replaces the standard \cs{Url}. This can improve non-ascii |
| 362 |
% typesetting at the cost of losing the special line breaking.\\ |
| 363 |
% destination & \cs{href}, \cs{hrefpdf} & A destination name in the PDF\\ |
| 364 |
% page & \cs{href}, \cs{hrefpdf} & destination page, default: 1\\ |
| 365 |
% pdfremotestartview &\cs{href}, \cs{hrefpdf} & start view, default: Fit\\ |
| 366 |
% ismap & \cs{href}, \cs{hrefurl} & see PDF reference\\ |
| 367 |
% afrelationship & \cs{href}, \cs{hrefpdf} & Changes the /AFRelationship key of the filespec dictionary. The value should be a PDF name without the starting slash.\\ |
| 368 |
% run-parameter & \cs{hreflaunch} & run parameter (see the PDF reference)\\ |
| 369 |
% nextactionraw & various & puts a /Next entry in the action dictionary (see the PDF reference)\\ |
| 370 |
% \end{tabular} |
| 371 |
% |
| 372 |
% |
| 373 |
% The first four keys can be set also in \cs{hypersetup} for all following commands in |
| 374 |
% the current group through the keys |
| 375 |
% \texttt{href/urlencode}, \texttt{href/protocol}, \texttt{href/destination}, \texttt{href/format}. |
| 376 |
% |
| 377 |
% It is possible to define own url commands with specific options e.g. with |
| 378 |
% |
| 379 |
% \begin{verbatim} |
| 380 |
% \NewDocumentCommand\myurl{O{}}{\url[protocol=https://,format=\textsc,#1]} |
| 381 |
% \end{verbatim} |
| 382 |
% |
| 383 |
% \section{Link decorations: border, color, OCG-color, \ldots} |
| 384 |
% Some main changes are |
| 385 |
% \begin{itemize} |
| 386 |
% \item The default colors have been changed. |
| 387 |
% \item Citations have by default no special color, they are |
| 388 |
% colored like other internal links. You can use |citecolor| and |citebordercolor| to |
| 389 |
% assign them a special color. This color is not reset if you use |allcolors| or |
| 390 |
% switch to another color scheme. If you want the colors to follow |linkcolor| again |
| 391 |
% you should remove the label |hyp/cite| and/or |hyp/citeborder| |
| 392 |
% from the hook |hyp/link/cite|. |
| 393 |
% \item a number of color schemes have been predefined. |
| 394 |
% \end{itemize} |
| 395 |
% |
| 396 |
% \subsection{Background information} |
| 397 |
% With the standard drivers \pkg{hyperref} allows either to color the link text, |
| 398 |
% or to use a border around it. |
| 399 |
% There is also a (rather unknown) option |frenchlinks| to use small caps |
| 400 |
% for some links instead of colors. |
| 401 |
% |
| 402 |
% The \emph{link border} is a setting in the PDF annotation directory. |
| 403 |
% It can be colored and styled (with the |<xxx>bordercolor|, |pdfborderstyle| |
| 404 |
% and |pdfhighlight| keys), but the exact look depends on the PDF viewer. |
| 405 |
% Such decorations are normally not printed. |
| 406 |
% |
| 407 |
% The \emph{link text} is colored with the standard color commands for text. |
| 408 |
% Such a color is also printed, which is often not wanted. The printing |
| 409 |
% can be avoided in PDF with so-called OCG-layers: They allow to add |
| 410 |
% variants of a text along with instructions which variant should be used for |
| 411 |
% viewing and which for printing. \pkg{hyperref} implements a rather simple version |
| 412 |
% for links: The link text is put in a box and printed twice with different colors |
| 413 |
% on different OCG layers. As boxes are used such links can't be broken. The |
| 414 |
% package \pkg{ocgx2} implements a more sophisticated version which allows to |
| 415 |
% use it for links broken over lines and pages. |
| 416 |
% |
| 417 |
% \pkg{hyperref} has keys to set the color and border for |link|, |url|, |file|, |
| 418 |
% |menu| and |run| types. They correspond to the PDF annotation types |
| 419 |
% |GoTo|, |URI|, |GoToR|, |Named| and |Launch|. |
| 420 |
% Beside this there is a |anchorcolor| which isn't used at all, and |citecolor| |
| 421 |
% which is a semantical category and doesn't fit to the other types. |
| 422 |
% |
| 423 |
% In the standard drivers the decoration options are more or less exclusive and global: |
| 424 |
% One of the options (|colorlinks|, |ocgcolorlinks|, or borders) has to be |
| 425 |
% chosen in the preamble and is then used for the whole document |
| 426 |
% and all link types. |
| 427 |
% Only colors and eventually the border style can be adjusted locally. |
| 428 |
% But there is no technical reason for these restrictions: |
| 429 |
% It is quite possible to change all these attributes |
| 430 |
% at any time both by link type and locally. The restrictions of the current |
| 431 |
% implementation can only be explained by the age of the code: \pkg{hyperref} |
| 432 |
% has been created at a time when memory was small and the main drivers were html |
| 433 |
% and postscript based. |
| 434 |
% |
| 435 |
% While link colors have been traditionally more or less |
| 436 |
% under the control of \pkg{hyperref}, |
| 437 |
% the situation with other format options, like the font, is more complicated. |
| 438 |
% The font in \cs{url} is for example determined by \cs{Urlfont}, |
| 439 |
% a command from the \pkg{url} package. |
| 440 |
% In the case of internal (GoTo) references packages like \pkg{cleveref} or |
| 441 |
% \pkg{biblatex} or \pkg{glossaries} offer formatting options too. |
| 442 |
% Formatting here is often connected to semantics: |
| 443 |
% an acronym should use a different font than a citation. |
| 444 |
% While \pkg{hyperref} could offer options here, it would probably only clash |
| 445 |
% with package formatting. It is more sensible not to interfere here. For this |
| 446 |
% reason the |frenchlinks| option has been dropped. |
| 447 |
% |
| 448 |
% \subsection{New Keys} |
| 449 |
% Some of the existing keys have been extended to allow individual setting for |
| 450 |
% the link types |link|, |url|, |file| |menu| and |run|: |
| 451 |
% |
| 452 |
% \begin{itemize} |
| 453 |
% \item Beside |pdfborder| there are also |linkborder|, |urlborder| etc |
| 454 |
% \item Beside |pdfhighlight| there are also |linkhighlight|, |urlhighlight| etc |
| 455 |
% \item Beside |pdfborderstyle| there are also |linkborderstyle|, |urlborderstyle| etc |
| 456 |
% \item Beside |colorlinks| there are also |colorlink|, |colorurl| etc |
| 457 |
% \item Beside |ocgcolorlinks| there are also |ocgcolorlink|, |ocgcolorurl|, etc %TODO |
| 458 |
% \item Beside |hidelinks| there are also |hidelink|, |hideurl|, etc |
| 459 |
% \item |bordercolormodel| allows to set the model used in annotations, |
| 460 |
% the allowed values are |rgb| or |cmyk|. |rgb| is the default. |
| 461 |
% It does \emph{not} change the model of text colors. Be aware |
| 462 |
% that while the PDF format allows cmyk (4 numbers) in the |/C| key of an annotation, |
| 463 |
% this is often ignored by pdf viewers and the colors can be wrong. |
| 464 |
% \item The boolean keys |url|, |link|, |run|, |menu|, |file| allow to deactivate |
| 465 |
% locally the link types. |
| 466 |
% \end{itemize} |
| 467 |
% |
| 468 |
% \begin{hypkey}{colorscheme} |
| 469 |
% |
| 470 |
% The new key |colorscheme| allows to switch the colors (both for text and borders) |
| 471 |
% with a key word. It takes one of the values |
| 472 |
% |primary-colors| (the colors as \pkg{hyperref} uses normally), |phelype|, |daleif|, |
| 473 |
% |szabolcsA|, |szabolcsB|, |tivv|, |julian|, |henryford|. |
| 474 |
% |
| 475 |
% The names refer to the authors in answers and comments in |
| 476 |
% \url{https://tex.stackexchange.com/questions/525261/better-default-colors-for-hyperref-links}. |
| 477 |
% |
| 478 |
% The default is |phelype|. |
| 479 |
% \end{hypkey} |
| 480 |
% |
| 481 |
% \subsection{Public interfaces} |
| 482 |
% |
| 483 |
% \begin{variable} |
| 484 |
% {\l_hyp_annot_colorlink_bool, |
| 485 |
% \l_hyp_annot_colorurl_bool, |
| 486 |
% \l_hyp_annot_colorfile_bool, |
| 487 |
% \l_hyp_annot_colorrun_bool, |
| 488 |
% \l_hyp_annot_colormenu_bool, |
| 489 |
% \l_hyp_annot_ocgcolorlink_bool, |
| 490 |
% \l_hyp_annot_ocgcolorurl_bool, |
| 491 |
% \l_hyp_annot_ocgcolorfile_bool, |
| 492 |
% \l_hyp_annot_ocgcolorrun_bool, |
| 493 |
% \l_hyp_annot_ocgcolormenu_bool |
| 494 |
% } |
| 495 |
% These boolean are used by the |colorlinks| and |ocgcolorlinks| and related keys. |
| 496 |
% These keys insert hook code in the |pdfannot/link/|\meta{type}|/begin| |
| 497 |
% and |pdfannot/link/|\meta{type}|/end| hooks. \meta{type} is one of |
| 498 |
% |GoTo|, |URI|, |GoToR|, |Named| or |Launch|. |
| 499 |
% |
| 500 |
% |colorlinks| uses the label |hyp/color|, and |ocgcolorlinks| the label |hyp/ocg|. |
| 501 |
% |
| 502 |
% They both use the same color names: |hyp/color/link|, |hyp/color/url|, |
| 503 |
% |hyp/color/file|, |hyp/color/run|, |hyp/color/menu|. |
| 504 |
% |
| 505 |
% The cite colors uses the names |hyp/color/cite| and |hyp/color/citeborder|. |
| 506 |
% |
| 507 |
% The border colors aren't saved in color names currently, but if the need |
| 508 |
% would arise it would possible to change this. |
| 509 |
% \end{variable} |
| 510 |
% \subsection{Changed behaviour} |
| 511 |
% \begin{description} |
| 512 |
% \item[colorlinks] |colorlinks| or |colorlinks=true| will as before disable the |pdfborder| |
| 513 |
% (|colorlinks=false| will leave the |pdfborder| untouched), but it is possible |
| 514 |
% to use the key in the document at any time, or to reenable the border if wanted. |
| 515 |
% Internally |colorlinks| \& friends will no longer define/undefine |
| 516 |
% |\Hy@colorlink|, but instead use the hooks provided by the \pkg{l3pdfannot} package. |
| 517 |
% \item Color keys accept the following input syntax: |
| 518 |
% |
| 519 |
% \begin{tabular}{ll} |
| 520 |
% model based & |urlbordercolor = [rgb]{1,1,0}| \\ |
| 521 |
% color expression & |urlbordercolor = red!50!blue| \\ |
| 522 |
% command & |urlbordercolor = \mycolor| |
| 523 |
% \end{tabular} |
| 524 |
% |
| 525 |
% where |\mycolor| should expand to one of the other two syntax variants. |
| 526 |
% |
| 527 |
% \item[frenchlinks] The option |frenchlinks| does nothing at all. |
| 528 |
% \item[cite colors] As mentioned above the support for |citecolor| |
| 529 |
% and |citebordercolor| has been reduced. A package like \pkg{hyperref} |
| 530 |
% can't keep track of such semantic |
| 531 |
% contexts like cite, acronym, glossaries and special references and maintain keys for |
| 532 |
% them. The keys are not completely dropped as this would affect packages like |
| 533 |
% \pkg{natbib}, but they have been separated and are no longer affected by |
| 534 |
% group keys like |allcolors| but must be set individually instead. |
| 535 |
% |
| 536 |
% \item[link margin] The driver sets a default link margin---this is identical |
| 537 |
% to pdftex and luatex driver, but a change for the xetex and dvips driver. |
| 538 |
% The (undocumentated) command \cs{setpdflinkmargin} does nothing. |
| 539 |
% Use either the key |pdflinkmargin| or \cs{pdfannot_link_margin:n} to change the margin. |
| 540 |
% See also the description in section~\ref{sec:keydesc} and in the \pkg{hyperref} manual. |
| 541 |
% \end{description} |
| 542 |
% |
| 543 |
% \section{PDF strings} |
| 544 |
% |
| 545 |
% \pkg{hyperref} uses a command called \cs{pdfstringdef} to convert text input into |
| 546 |
% something that makes sense and is valid in a PDF string, e.g. in the bookmarks |
| 547 |
% or in the info dictionary or as form field values. |
| 548 |
% |
| 549 |
% As the handling of the outlines are delegated to the \pkg{bookmark} package, they |
| 550 |
% will for now still use \cs{pdfstringdef}, but all other strings produced by |
| 551 |
% this driver will use a new method based on the expl3 commands |
| 552 |
% \cs{text_purify:n} and \cs{str_set_convert:Nnnn}. For normal text |
| 553 |
% it shouldn't matter, but a variety of commands and math are handled differently. |
| 554 |
% Like with \cs{pdfstringdef} they are a number of ways to adjust the outcome of |
| 555 |
% \cs{text_purify:n}. These are described in the expl3 documentation interface3.pdf. |
| 556 |
% |
| 557 |
% \emph{The new method is under heavy development!} |
| 558 |
% |
| 559 |
% Important differences here are |
| 560 |
% \begin{itemize} |
| 561 |
% \item \emph{This new method requires that files are utf8-encoded} |
| 562 |
% (at least if non-ascii chars are used in for PDF strings). |
| 563 |
% \item \emph{All} robust commands are currently removed, |
| 564 |
% unless an equivalent has been declared. |
| 565 |
% \item Currently the new method is much more silent: it doesn't warn like |
| 566 |
% \pkg{hyperref} if it removes commands. |
| 567 |
% \end{itemize} |
| 568 |
% |
| 569 |
% \section{Package options from hyperref}\label{sec:pkg-options} |
| 570 |
% The driver will process the package options at the end. |
| 571 |
% But normally options should better be set with \cs{hypersetup} after |
| 572 |
% the package has been loaded. This is also the case for options which normally |
| 573 |
% don't work in \cs{hypersetup}. |
| 574 |
% One option that currently doesn't work correctly as package option is |
| 575 |
% |ocgcolorlinks| |
| 576 |
% |
| 577 |
% |
| 578 |
% Options that still must be set as package options are |
| 579 |
% \begin{itemize} |
| 580 |
% \item |backref| |
| 581 |
% \item |CJKbookmarks| this key should not be used anymore. At some time |
| 582 |
% it will be removed. |
| 583 |
% \item |destlabel| (destination names are taken from \cs{label} if possible) |
| 584 |
% \item |encap| |
| 585 |
% \item |hyperfigures| (according to the \pkg{hyperref} manual |
| 586 |
% it makes figures hyper links, but actually is a no-op for most drivers, and it |
| 587 |
% does nothing with this driver either.) |
| 588 |
% \item |hyperfootnotes| |
| 589 |
% \item |hyperindex| |
| 590 |
% \item |implicit| (redefine \LaTeX\ internals) |
| 591 |
% \item |nesting| unneeded key, see comment below in \ref{sec:keydesc}. At some time |
| 592 |
% it will be either removed or extended (if some use can be found). |
| 593 |
% \item |pagebackref| |
| 594 |
% \item |pdfpagelabels| (set PDF page labels) |
| 595 |
% \item |psdextra| this loads some extra definitions used by \cs{pdfstringdef}. |
| 596 |
% The new driver uses \cs{pdfstringdef} only for the bookmarks, for other strings |
| 597 |
% it is not relevant. |
| 598 |
% \end{itemize} |
| 599 |
% |
| 600 |
% Options that can be without problems set as package options are |
| 601 |
% \begin{itemize} |
| 602 |
% \item |debug|, |verbose| (a boolean) |
| 603 |
% \item |bookmarks| (a boolean) |
| 604 |
% \item |plainpages| |
| 605 |
% \item |draft|, |final| |
| 606 |
% \item |hypertexnames| |
| 607 |
% \item |naturalnames| |
| 608 |
% \item |pageanchor| |
| 609 |
% \end{itemize} |
| 610 |
% |
| 611 |
% Ignored options: |
| 612 |
% \begin{itemize} |
| 613 |
% \item All driver options like |pdftex|, |dvipdfmx|, \ldots |
| 614 |
% \item |raiselinks| (only used in the dviwind, textures and tex4ht driver anyway) |
| 615 |
% \item |frenchlinks| |
| 616 |
% \item |setpagesize| |
| 617 |
% \item |addtopdfcreator| |
| 618 |
% \end{itemize} |
| 619 |
% |
| 620 |
% \section{Disabling links} |
| 621 |
% |
| 622 |
% \pkg{hyperref} knows like many packages the options |draft| and |final|. |
| 623 |
% With \pkg{hyperref} they can be used as package options or in the preamble |
| 624 |
% in \cs{hypersetup} and disable links and anchors completely. |
| 625 |
% The new driver passes the options also to the \pkg{bookmark} package if |
| 626 |
% \pkg{bookmark} hasn't been loaded yet as bookmarks can't work properly if |
| 627 |
% the anchors from \pkg{hyperref} are missing. |
| 628 |
% |
| 629 |
% \DescribeHypkey{link}% |
| 630 |
% \DescribeHypkey{url}% |
| 631 |
% \DescribeHypkey{file}% |
| 632 |
% \DescribeHypkey{run}% |
| 633 |
% \DescribeHypkey{menu}% |
| 634 |
% The |draft| option is a global option that can't be undone (at least not easily). |
| 635 |
% So the new driver offers also boolean keys |link|, |url|, |file|, |run| and |menu| |
| 636 |
% which allow to locally disable a link type. So e.g. |
| 637 |
% |\hypersetup{link=false}\ref{abc}| will give a reference without link (this |
| 638 |
% is naturally also possible with |\ref*{abc}|). This disables also all hooks of |
| 639 |
% the link type, so the link is for example no longer colored. It also removes the |
| 640 |
% implicit grouping of the content. |
| 641 |
% |
| 642 |
% \DescribeHypkey{nested-links}% |
| 643 |
% |
| 644 |
% Links are sometimes nested. E.g. if a section heading contains a reference |
| 645 |
% it can lead to nested links in the table of contents or if |\nameref| is used. |
| 646 |
% That is not forbidden and normally work as expected: If the link area overlap |
| 647 |
% normally the inner link is \enquote{on top} and chosen at a click. |
| 648 |
% But it is not always actually wanted, so with the |nested-links| (a boolean key) |
| 649 |
% it is possible to disable such nested links. |
| 650 |
% |
| 651 |
% \section{Draftmode} |
| 652 |
% pdftex and other engines knows a |
| 653 |
% draftmode which can be set with |\pdfdraftmode=1| |
| 654 |
% and \pkg{hyperref} honors this in some places. The new |
| 655 |
% driver ignores it, for example |pagelabels| are created in any case. |
| 656 |
% With today's computer power there is not much to gain and it only complicates |
| 657 |
% the code. |
| 658 |
% |
| 659 |
% This should not be confused with the |draft| and |final| package options! They |
| 660 |
% are still honored. |
| 661 |
% |
| 662 |
% \section{Dropped options} |
| 663 |
% A number of options are ignored by this driver |
| 664 |
% \begin{description} |
| 665 |
% \item[pdfversion] The pdfversion should be set in \cs{DocumentMetadata} or |
| 666 |
% with \verb+\SetKeys[document/metadata]+ |
| 667 |
% \item[setpagesize] The key is ignored and the PDF page size is not |
| 668 |
% set. Load \pkg{color} or \pkg{graphicx} or use a class which sets the PDF page size. |
| 669 |
% \item[breaklinks] The option does nothing sensible anyway (apart from triggering |
| 670 |
% a warning). Currently with latex+dvips links can't be broken. But there is work |
| 671 |
% in progress to change this. |
| 672 |
% \item[unicode] This is always true. |
| 673 |
% \item[pdfa] If this option is set to true \pkg{hyperref} normally checks and sets |
| 674 |
% a small number of requirements for the PDF standard PDF/A. |
| 675 |
% The key is ignored with this driver. Instead the wanted standard should be declared |
| 676 |
% in \cs{DocumentMetadata} or \verb+\SetKeys[document/metadata]+: |
| 677 |
% \begin{verbatim} |
| 678 |
% \DocumentMetadata{pdfstandard=A-2b} |
| 679 |
% \end{verbatim} |
| 680 |
% Currently |A-1b|, |A-2b|, |A-3b| can be set. |
| 681 |
% The support for various requirements is still incomplete, but the parts that |
| 682 |
% \pkg{hyperref} checked are implemented: |
| 683 |
% \begin{itemize} |
| 684 |
% \item The |/F| key is added to links and |Print| is activated, |Hidden|, |Invisible|, |
| 685 |
% |NoView| are deactivated. |
| 686 |
% \item |/NeedAppearances| is suppressed |
| 687 |
% \item Pushbuttons, which use the action |/S/JavaScript| are suppressed. |
| 688 |
% \item Resetbuttons, which use the action |/S/ResetForm| are suppressed. |
| 689 |
% \item In widget annotations, the /AA dictionary is suppressed. |
| 690 |
% \end{itemize} |
| 691 |
% \end{description} |
| 692 |
% \section{Destinations} |
| 693 |
% Destinations (sometimes call anchors in the \pkg{hyperref} documentation) |
| 694 |
% are the places a link jumped too. Unlike the name may suggest they don't described |
| 695 |
% an exact location in the PDF. Instead a destination contains a reference to |
| 696 |
% a page along with an instruction how to display this page. |
| 697 |
% The normally used \enquote{XYZ \textit{top left zoom}} for example instructs |
| 698 |
% the viewer to show the page with the given \textit{zoom} and |
| 699 |
% the top left corner at the \textit{top left} coordinates---which then gives |
| 700 |
% the impression that there is an anchor at this position. |
| 701 |
% |
| 702 |
% From these instructions two (|Fit| and |FitB|) don't take an argument. |
| 703 |
% All others take one (|FitH|, |FitV|, |FitBH|, |FitBV|) |
| 704 |
% or more (|XYZ|, |FitR|) arguments. These arguments are normally |
| 705 |
% coordinates, |XYZ| takes also a zoom factor. The coordinates are |
| 706 |
% absolute coordinates in |bp| relative to the lower left corner |
| 707 |
% of the PDF. |
| 708 |
% |
| 709 |
% With the primitive command \cs{pdfdest} of pdftex almost all instructions are created |
| 710 |
% with a keyword only: The needed coordinate is calculated automatically from the location |
| 711 |
% the \cs{pdfdest} command is issued. So to get a specific coordinate one has to |
| 712 |
% move the command to the right place. E.g. |
| 713 |
% \begin{verbatim} |
| 714 |
% \AddToHookNext{shipout/background} |
| 715 |
% {\put(0,-\pdfpageheight+100bp){\pdfdest name{destA} FitH\relax}} |
| 716 |
% \end{verbatim} |
| 717 |
% |
| 718 |
% Exceptions are the |XYZ| instruction, where pdftex accepts a keyword |
| 719 |
% |zoom| followed by a zoom factor, and the |FitR| instruction |
| 720 |
% which understands the keywords |width|, |height| and |depth| |
| 721 |
% followed by a dimension, which is then used to calculate a rectangle relative to the |
| 722 |
% current location. If no keywords are given the dimensions are taken from the surrounding |
| 723 |
% box---which can also lead to zero sized areas. |
| 724 |
% |
| 725 |
% The manual of \pkg{hyperref} gives a bit the impression as if this |
| 726 |
% coordinates can be set manually by the user but as described above this is |
| 727 |
% mostly wrong: It is for normal destination only possible with a dvi-backend like |
| 728 |
% dvips which make use of |pdfmark.def|. pdftex and luatex can use manual coordinates |
| 729 |
% only for |pdfstartview| and |pdfremotestartview|. |
| 730 |
% As dvips was the first driver of \pkg{hyperref} the option |pdfview| was at first |
| 731 |
% developed for it and then adapted to pdftex. But this had the effect that the handling |
| 732 |
% of the option |pdfview| is inconsequent across the backend and engines: |
| 733 |
% For example with |pdfview=FitH 100| pdftex ignores the |
| 734 |
% number and calculates its own, while dvips sets the coordinate to the absolute |
| 735 |
% 100. The zoom factor of |XYZ| is not supported by the pdftex driver at all, and |
| 736 |
% |FitR| only partially. |
| 737 |
% |
| 738 |
% The generic driver consolidate this but tries to stay compatible with the other |
| 739 |
% drivers as far as possible. |
| 740 |
% It also takes into account that |pdfview| and |pdfstartview| and |pdfremotestartview| |
| 741 |
% have different requirements: While for the first relative coordinates are fine, |
| 742 |
% for the two others absolute coordinates are more sensible. |
| 743 |
% |
| 744 |
% \DescribeHypkey{pdfview} |
| 745 |
% \DescribeHypkey{pdfstartview} |
| 746 |
% \DescribeHypkey{pdfremotestartview} |
| 747 |
% So with this driver the options |
| 748 |
% |pdfview|, |pdfstartview| and |pdfremotestartview| take |
| 749 |
% the following options: |
| 750 |
% \begin{itemize} |
| 751 |
% \item |Fit|, |FitB|, |FitH|, |FitV|, |
| 752 |
% |FitBH|, |FitBV| which can be followed by a positive integer (separated by a space) or the |
| 753 |
% keyword |null|. |
| 754 |
% The number can be gives as a \meta{dimension expression} surrounded with |
| 755 |
% \cs{hypercalcbp}. The driver redefines this command to use |
| 756 |
% \cs{dim_to_decimal_in_bp:n}. |
| 757 |
% \begin{itemize} |
| 758 |
% \item |pdfview| will ignore the integer and any other arguments and calculate |
| 759 |
% the expected coordinates as described above for pdftex with all |
| 760 |
% supported engines and backends. |
| 761 |
% \item |pdfstartview| and |pdfremotestartview| will pass the optional |
| 762 |
% number or keyword after expansion as absolute coordinate. Missing numbers will |
| 763 |
% be filled up with |null|. |
| 764 |
% \end{itemize} |
| 765 |
% |
| 766 |
% \item |XYZ|. This can be followed (separated by spaces) by up to three |
| 767 |
% positive integers or keywords |null| which are then taken as \textit{top left zoom} |
| 768 |
% in this order. \textit{zoom} is a factor, so e.g. 0.5 will give a scaling of 50\%. |
| 769 |
% \begin{itemize} |
| 770 |
% \item |pdfview| will use the last value as \textit{zoom}, ignore all other values |
| 771 |
% and calculate the expected coordinates as described above for pdftex with all |
| 772 |
% supported engines and backends (this means it is possible to use |XYZ 2| to |
| 773 |
% set a zoom of 200\%, it is not necessary to fill in dummy values.) |
| 774 |
% \item |pdfstartview| and |pdfremotestartview| will pass the optional |
| 775 |
% numbers or keyword after expansion as absolute coordinates and zoom. |
| 776 |
% Missing numbers will be filled up with |null|. |
| 777 |
% \end{itemize} |
| 778 |
% This new behaviour is in part incompatible with previous handling with the dvips driver. |
| 779 |
% |
| 780 |
% |
| 781 |
% \item |FitR|. |
| 782 |
% If no argument (separated by spaces) follows then |
| 783 |
% |pdfview| will use with pdftex and luatex |
| 784 |
% the automatic calculation of the coordinates from the encompassing box. With |
| 785 |
% dvips and (x)dvipdfmx it will fall back to |Fit|. |
| 786 |
% |pdfstartview| and |pdfremotestartview| will fallback to |Fit| too. |
| 787 |
% |
| 788 |
% If arguments (separated by spaces) follow they should be |
| 789 |
% four numbers representing \texttt{left bottom right top}. |
| 790 |
% \begin{itemize}\item |
| 791 |
% |pdfview| will use the values to calculate coordinates relative to the current |
| 792 |
% location. So |0 -100 200 400| will give a \enquote{box} of width 200bp, |
| 793 |
% height 400bp and depth 100dp that the destination should encompass. |
| 794 |
% Missing numbers will be set to 0. But one should be aware that is it is quite |
| 795 |
% unpredictable how viewers which support |FitR| handles zero sizes. |
| 796 |
% |
| 797 |
% \item |pdfstartview| and |pdfremotestartview| will pass |
| 798 |
% the values as absolute coordinates. |
| 799 |
% \end{itemize} |
| 800 |
% \end{itemize} |
| 801 |
% |
| 802 |
% \subsection{Names of destinations} |
| 803 |
% hyperref creates two types of destination names: For numbered structures |
| 804 |
% (so when the anchor is set by \cs{refstepcounter}) it builds the name |
| 805 |
% from the counter name and the \cs{theH...} representation: |<counter name>.\theH<counter name>|. |
| 806 |
% |
| 807 |
% For unnumbered structures, e.g. starred chapters or anchors created with \cs{phantomsection} |
| 808 |
% it uses names like |section*.<number>| and |chapter*.<number>|. |
| 809 |
% |
| 810 |
% Typically the name of destination can be retrieved by setting a label, this works also |
| 811 |
% with unnumbered sections. |
| 812 |
% The anchor and also the page can be retrieve in an expandable way |
| 813 |
% with the help of commands from the |
| 814 |
% \pkg{refcount} package which is loaded by hyperref. For example with the |
| 815 |
% following commands it is possible to use the label to create a bookmark: |
| 816 |
% |
| 817 |
% \begin{verbatim} |
| 818 |
% \bookmark[dest=\getrefbykeydefault{label}{anchor}{Doc-Start}]{my bookmark} |
| 819 |
% \bookmark[dest=page.\getrefbykeydefault{label}{page}{Doc-Start}]{my bookmark} |
| 820 |
% \end{verbatim} |
| 821 |
% |
| 822 |
% If a \cs{HyperDestNameFilter} is defined, this must be added around the definition, |
| 823 |
% so actually the full code has to look like this |
| 824 |
% \begin{verbatim} |
| 825 |
% \bookmark[dest= |
| 826 |
% \HyperDestNameFilter{\getrefbykeydefault{label}{anchor}{Doc-Start}}]{mysection} |
| 827 |
% \end{verbatim} |
| 828 |
% To simplify this hyperref provides |\hyperget{anchor}{label}| and |
| 829 |
% |\hyperget{pageanchor}{label}| |
| 830 |
% |
| 831 |
%\section{Assorted key descriptions}\label{sec:keydesc} |
| 832 |
%The following gives a few details to some keys that are perhaps not |
| 833 |
%completely described in the manual, or are a bit different in this driver. |
| 834 |
%The list is alphabetic. |
| 835 |
% |
| 836 |
% \DescribeHypkey{bookmarkstype} This key takes as value the extension of a list |
| 837 |
% like |toc| or |lof|. If this list uses \cs{addcontentsline} the content will |
| 838 |
% be added to the bookmarks. The key can be use in \cs{hypersetup} and also in |
| 839 |
% the middle of the document to switch the list. |
| 840 |
% |
| 841 |
% \DescribeHypkey{bordercolormodel} With |bordercolormodel| the colormodel used in the |/C| |
| 842 |
% key of the annotation array and in similar keys is set. It does not affect |
| 843 |
% the text and graphics colors in the page stream. |
| 844 |
% Possible choices are |rgb| (three numbers in the array) and |cmyk| (four numbers). |
| 845 |
% While the PDF reference allows four numbers, PDF readers don't necessarily handle |
| 846 |
% this correctly, so the value can be wrong. |
| 847 |
% |
| 848 |
% \DescribeHypkey{destlabel} This is a boolean key. Currently it must be set |
| 849 |
% as package option. If set to true, the name |
| 850 |
% of a destination is taken from a following \cs{label}, if there is one before |
| 851 |
% the next destination command. This requires two compilations to get |
| 852 |
% the correct coordinates in the destination. In the first compilation |
| 853 |
% the alias name is recorded in the aux-file: |
| 854 |
% \begin{verbatim} |
| 855 |
% \hyper@newdestlabel{section.1.2}{sec:sec2} |
| 856 |
% \end{verbatim} |
| 857 |
% The next compilation can then make use of it. |
| 858 |
% The two-pass could be avoided in the future with a better labeling system, |
| 859 |
% where the name if set earlier. |
| 860 |
% |
| 861 |
% \DescribeHypkey{extension} This key sets an variable that has two purposes: |
| 862 |
% It is used if file name has not extension, and it decides if the annotation |
| 863 |
% is a URI or GoToR annotation. So |
| 864 |
% \begin{verbatim} |
| 865 |
% \hypersetup{extension=dvi} |
| 866 |
% \href{mwe1.pdf}{pdf} |
| 867 |
% \href{mwe2.dvi}{dvi} |
| 868 |
% \href{mwe3}{no ext} |
| 869 |
% \end{verbatim} |
| 870 |
% will create |
| 871 |
% \begin{verbatim} |
| 872 |
% /Subtype/Link/A<</S/URI /URI(mwe1.pdf)>> |
| 873 |
% /Subtype/Link/A<</S/GoToR /F (mwe2.dvi)>> |
| 874 |
% /Subtype/Link/A<</S/GoToR /F (mwe3.dvi)>> |
| 875 |
% \end{verbatim} |
| 876 |
% Typically PDF viewer can handle only GoToR annotations pointing to a PDF. |
| 877 |
% So normally the default value |pdf| of this key should not be changed. |
| 878 |
% \DescribeHypkey{nesting}\label{key:nesting}% |
| 879 |
% This key is useless in PDF context. The boolean is only used in |
| 880 |
% the code for anchors/destination where nesting doesn't make sense. |
| 881 |
% It should not be changed. |
| 882 |
% |
| 883 |
% \DescribeHypkey{pdfborder}\DescribeHypkey{linkborder}\DescribeHypkey{urlborder} |
| 884 |
% \DescribeHypkey{runborder}\DescribeHypkey{menuborder} |
| 885 |
% This key set accept as value three numbers or three numbers and an array describing |
| 886 |
% a dash pattern, examples are |0 0 1| or |0 0 1 [3 2]|. |
| 887 |
% The first two numbers should according to the reference set round |
| 888 |
% corners, but PDF viewer seem to ignore it. The third number is the line width |
| 889 |
% of the border. Settings done with |pdfborderstyle| should take precedence. |
| 890 |
% |
| 891 |
% \DescribeHypkey{pdfborderstyle}\DescribeHypkey{linkborderstyle} |
| 892 |
% \DescribeHypkey{urlborderstyle}\DescribeHypkey{fileborderstyle} |
| 893 |
% \DescribeHypkey{runborderstyle}\DescribeHypkey{menuborderstyle} |
| 894 |
% The value of this key is the content of the |BS| dictionary. |
| 895 |
% As an example |/Type/Border /W 1 /S/U /D[3 2]| |
| 896 |
% |
| 897 |
% \begin{tabular}{>{\ttfamily} lll} |
| 898 |
% Key & Values & comment / example\\\hline |
| 899 |
% /Type & |/Border| & optional \\ |
| 900 |
% /W & \meta{number} & Width of border line \\ |
| 901 |
% /S & |/S| & solid (default)\\ |
| 902 |
% & |/D| &dash pattern can be set with /D\\ |
| 903 |
% & |/B| & beveled\\ |
| 904 |
% & |/I| & inset\\ |
| 905 |
% & |/U| & underline\\ |
| 906 |
% /D & \meta{array of numbers} & dash pattern (lines/gaps) (default [3]) |
| 907 |
% \end{tabular} |
| 908 |
% |
| 909 |
% \DescribeHypkey{pdfcreationdate}\DescribeHypkey{pdfmoddate}\DescribeHypkey{pdfmetadate} |
| 910 |
% Setting these keys is normally not needed. If they are used the values |
| 911 |
% of the first two keys are stored directly in the Info dictionary for |
| 912 |
% |/Creationdate| and |/ModDate|. All three keys are used in XMP-metadata. |
| 913 |
% The values are converted to strings but not processed further, so they should |
| 914 |
% have the correct PDF format without the enclosing parentheses, |
| 915 |
% e.g. |D:20200202111111+01'00'|. |
| 916 |
% |
| 917 |
% \DescribeHypkey{pdflinkmargin}As described in the \pkg{hyperref} manual |
| 918 |
% the behaviour differs between the backends: with dvips it is possible to |
| 919 |
% change links locally, pdflatex and lualatex work by page, with dvipdfmx |
| 920 |
% the setting is global (and has to be done in the preamble). |
| 921 |
% |
| 922 |
% \DescribeHypkey{pdflang} The key will work, but it is recommended to the set |
| 923 |
% the language in \cs{DocumentMetadata} or \verb+\SetKeys[document/metadata]+ instead. |
| 924 |
%^^A %% This is an adapted version of hluatex.def |
| 925 |
%^^A %% meant to test the use of the commands |
| 926 |
%^^A %% from pdfmanagement.sty |
| 927 |
%^^A %% |
| 928 |
%^^A %% drivers are loaded in line 4745 in hyperref.sty in a \Hy@AtEndOfPackage command. |
| 929 |
%^^A %%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 930 |
%^^A %% list of new internal commands |
| 931 |
%^^A %% @@_link_goto_begin:nw : start command for links to internal destination |
| 932 |
%^^A %% replaces \find@pdflink |
| 933 |
%^^A %% @@_link_goto_end: |
| 934 |
%^^A %% @@_destination:n : sets an anchor, replaces \new@pdflink |
| 935 |
%^^A %% \@@_PageLabels_gpush: : puts pagelabels in the catalog, used on every storing |
| 936 |
%^^A %% PDF String (text) |
| 937 |
%^^A %% *\pdf_purify:nN : replaces (part of) Hy@pstringdef, converts #1 to pdfstring in encoding #2 |
| 938 |
%^^A %% and stores in N |
| 939 |
%^^A %% |
| 940 |
%^^A %% Destinations (dest) |
| 941 |
%^^A %% \l_@@_dest_box |
| 942 |
%^^A %% |
| 943 |
%^^A %% References (ref) |
| 944 |
%^^A %% *\@@_property_record:nn |
| 945 |
%^^A %% *\property_if_recorded:nn |
| 946 |
%^^A %% *\property_ref_undefined_warn:nn, |
| 947 |
%^^A %% % helps to display key list messages |
| 948 |
%^^A %% \@@_clist_display:n |
| 949 |
%^^A %% |
| 950 |
%^^A %% \@@_info_generate_addons: what did this do?? |
| 951 |
%^^A %% |
| 952 |
%^^A %% \g_@@_AcroForm_CoFields_prop |
| 953 |
%^^A %% \g_@@_AcroForm_Fields_prop |
| 954 |
%^^A %% |
| 955 |
%^^A %% \g_@@_dest_pdfstartpage_tl , |
| 956 |
%^^A %% \g_@@_dest_pdfstartview_tl , |
| 957 |
%^^A %% \l_@@_dest_pdfremotestartview_tl , |
| 958 |
%^^A |
| 959 |
%^^A %% Constants |
| 960 |
%^^A %% *\c_@@_map_annot_hyp_prop |
| 961 |
%^^A %% *\c_@@_dest_undefined_tl |
| 962 |
%^^A %% Temp variables |
| 963 |
%^^A %% \l_@@_tmpa_seq |
| 964 |
%^^A %% \l_@@_tmpa_box |
| 965 |
%^^A %% \l_@@_tmpa_tl |
| 966 |
%^^A %% \l_@@_tmpa_str |
| 967 |
%^^A %% \l_@@_tmpa_int |
| 968 |
%^^A %% |
| 969 |
%^^A %% \l_@@_dest_name_tmpa_tl |
| 970 |
%^^A %% \l_@@_uri_tmpa_tl |
| 971 |
%^^A %% \l_@@_filename_tmpa_tl |
| 972 |
%^^A %% \l_@@_para_tmpa_tl |
| 973 |
%^^A %% \l_@@_text_tmpa_str |
| 974 |
%^^A %% \g_@@_text_tmpa_str |
| 975 |
%^^A %% \g_@@_bordercolormodel_tl |
| 976 |
% |
| 977 |
%^^A %% \l_@@_dest_pdfview_tl |
| 978 |
%^^A %% list of commands which probably will have to change |
| 979 |
%^^A TODO: move hrefurl, hrefrun, hrefpdf into hyperref. They should also work |
| 980 |
% \end{documentation} |
| 981 |
% \begin{implementation} |
| 982 |
% \part{\pkg{hyperref-generic} driver implementation} |
| 983 |
% \begin{macrocode} |
| 984 |
%<@@=hyp> |
| 985 |
% \end{macrocode} |
| 986 |
% \begin{macrocode} |
| 987 |
%<*headertestphase> |
| 988 |
\ProvidesFile{hgeneric-testphase.def}[2026-05-26 v0.97c % |
| 989 |
generic Hyperref driver for the LaTeX PDF management bundle] |
| 990 |
%</headertestphase> |
| 991 |
% \end{macrocode} |
| 992 |
% |
| 993 |
% \begin{macrocode} |
| 994 |
%<*header> |
| 995 |
\ProvidesFile{hgeneric.def}[2026-05-26 v0.97c % |
| 996 |
generic Hyperref driver for the LaTeX PDF management bundle] |
| 997 |
%</header> |
| 998 |
% \end{macrocode} |
| 999 |
% \begin{macrocode} |
| 1000 |
%<*package> |
| 1001 |
\RequirePackage{etoolbox} %why? |
| 1002 |
% \end{macrocode} |
| 1003 |
% Temporary command definition, can be remove when hyperref is update too. |
| 1004 |
% \begin{macrocode} |
| 1005 |
\long\def\Hy@ReturnAfterFi#1\fi{\fi#1} |
| 1006 |
% \end{macrocode} |
| 1007 |
% \begin{macrocode} |
| 1008 |
\ExplSyntaxOn |
| 1009 |
\file_input:n {hyperref-colorschemes.def} |
| 1010 |
\ExplSyntaxOff |
| 1011 |
% \end{macrocode} |
| 1012 |
% |
| 1013 |
% |
| 1014 |
% \section{messages} |
| 1015 |
% Redirect the message name: |
| 1016 |
% \begin{macrocode} |
| 1017 |
\ExplSyntaxOn |
| 1018 |
\prop_gput:Nnn \g_msg_module_name_prop { hyp }{ hyperref } |
| 1019 |
% \end{macrocode} |
| 1020 |
% At first a message for the testing of the resource management |
| 1021 |
% \begin{macrocode} |
| 1022 |
\msg_new:nnnn |
| 1023 |
{ hyp } |
| 1024 |
{ missing-resource-management } |
| 1025 |
{ The~PDF~resource~management~is~required~for~this~hyperref~driver! } |
| 1026 |
{ |
| 1027 |
Activate~it~with \\ |
| 1028 |
\tl_to_str:n{\DocumentMetadata{<options>}}\\ |
| 1029 |
before~\tl_to_str:n{\documentclass} or \\ |
| 1030 |
\RequirePackage{pdfmanagement} |
| 1031 |
} |
| 1032 |
% \end{macrocode} |
| 1033 |
% The pdfversion should be set in \cs{DocumentMetadata} or |
| 1034 |
% \verb+\SetKeys[document/metadata]+ |
| 1035 |
% \begin{macrocode} |
| 1036 |
\msg_new:nnnn |
| 1037 |
{ hyp } |
| 1038 |
{ pdfversion-disabled } |
| 1039 |
{ |
| 1040 |
This~hyperref~driver~ignores~the~pdfversion~key!\\ |
| 1041 |
Set~the~pdfversion~in~\token_to_str:N \DocumentMetadata\\or |
| 1042 |
with \tl_to_str:n{\SetKeys[document/metadata]} |
| 1043 |
} |
| 1044 |
{ |
| 1045 |
For example:\\ |
| 1046 |
\tl_to_str:n |
| 1047 |
{ |
| 1048 |
\DocumentMetadata { pdfversion=1.7 } |
| 1049 |
} |
| 1050 |
} |
| 1051 |
% \end{macrocode} |
| 1052 |
% A generic message for ignored keys. |
| 1053 |
% \begin{macrocode} |
| 1054 |
\msg_new:nnn |
| 1055 |
{ hyp } |
| 1056 |
{ key-dropped } |
| 1057 |
{ |
| 1058 |
This~hyperref~driver~ignores~the~key~#1!\\ |
| 1059 |
Please~check~the~documentation. |
| 1060 |
} |
| 1061 |
% \end{macrocode} |
| 1062 |
% pdf/A messages for fields, this will probably be moved to an external package |
| 1063 |
% \begin{macrocode} |
| 1064 |
\msg_new:nnn |
| 1065 |
{ hyp } |
| 1066 |
{ pdfa-no-push-button } |
| 1067 |
{ PDF/A:~Push~button~with~JavaScript~is~prohibited } |
| 1068 |
|
| 1069 |
\msg_new:nnn |
| 1070 |
{ hyp } |
| 1071 |
{ pdfa-no-reset-button } |
| 1072 |
{ PDF/A:~Reset~action~is~prohibited } |
| 1073 |
% \end{macrocode} |
| 1074 |
% pdf/A message for not allowed Named actions |
| 1075 |
% \begin{macrocode} |
| 1076 |
\msg_new:nnn |
| 1077 |
{ hyp } |
| 1078 |
{ pdfa-no-named-action } |
| 1079 |
{ PDF/A:~Named~action~#1~is~prohibited } |
| 1080 |
% \end{macrocode} |
| 1081 |
% A message if the destination name is empty. |
| 1082 |
% \begin{macrocode} |
| 1083 |
\msg_new:nnn |
| 1084 |
{ hyp } |
| 1085 |
{ empty-destination-name } |
| 1086 |
{ |
| 1087 |
Empty~destination~name,\\ |
| 1088 |
using~'#1' |
| 1089 |
} |
| 1090 |
% \end{macrocode} |
| 1091 |
% A message if the destination check fails |
| 1092 |
% \begin{macrocode} |
| 1093 |
\msg_new:nnn |
| 1094 |
{ hyp } |
| 1095 |
{ invalid-destination-value } |
| 1096 |
{ |
| 1097 |
Invalid~value~'#1'~of~'#2' \\ |
| 1098 |
is~replaced~by~'Fit'~\msg_line_context:. |
| 1099 |
} |
| 1100 |
% \end{macrocode} |
| 1101 |
% Some options or values should not be used in older pdf versions |
| 1102 |
% \begin{macrocode} |
| 1103 |
\msg_new:nnn |
| 1104 |
{ hyp } |
| 1105 |
{ ignore-deprecated-or-unknown-option-in-pdf-version } |
| 1106 |
{ |
| 1107 |
Option~'#1'~is~unknown~or~deprecated~in\\ |
| 1108 |
pdf~version~#2.~Ignored. |
| 1109 |
} |
| 1110 |
\msg_new:nnn |
| 1111 |
{ hyp } |
| 1112 |
{ ignore-deprecated-or-unknown-value-in-pdf-version } |
| 1113 |
{ |
| 1114 |
Value~'#1'~is~unknown~or~deprecated~in\\ |
| 1115 |
pdf~version~#2.~Ignored. |
| 1116 |
} |
| 1117 |
\msg_new:nnn |
| 1118 |
{ hyp } |
| 1119 |
{ replace-deprecated-or-unknown-value-in-pdf-version } |
| 1120 |
{ |
| 1121 |
Value~'#1'~is~unknown~or~deprecated~in\\ |
| 1122 |
pdf~version~#2. Value~'#3'~is used instead. |
| 1123 |
} |
| 1124 |
% \end{macrocode} |
| 1125 |
% During development not all standard hyperref keys are known and the |
| 1126 |
% Hyp-handler needs to process some new keys unknown to him. |
| 1127 |
% This issues warnings for now: |
| 1128 |
% \begin{macrocode} |
| 1129 |
\msg_new:nnn |
| 1130 |
{ hyp } |
| 1131 |
{ unknown-key } |
| 1132 |
{ |
| 1133 |
unknown~key~#2~of~module~'#1'~set~to~'#3'. |
| 1134 |
} |
| 1135 |
\msg_new:nnn |
| 1136 |
{ hyp } |
| 1137 |
{ unknown-key-to-Hyp } |
| 1138 |
{ |
| 1139 |
ignored~in~family~Hyp~unknown~key~#1. |
| 1140 |
} |
| 1141 |
% \end{macrocode} |
| 1142 |
% There are a lot choice keys. This defines messages which shows the valid |
| 1143 |
% choices if a faulty one has been used: |
| 1144 |
% \begin{macrocode} |
| 1145 |
\cs_new:Npn \@@_clist_display:n #1 {*~#1\\} |
| 1146 |
\msg_new:nnn |
| 1147 |
{ hyp } |
| 1148 |
{ unknown-choice } |
| 1149 |
{ |
| 1150 |
Value~'#3'~is~invalid~for~key~'#1'.\\ |
| 1151 |
The~key~accepts~only~the~choices\\ |
| 1152 |
\clist_map_function:nN { #2 }\@@_clist_display:n |
| 1153 |
} |
| 1154 |
|
| 1155 |
\msg_new:nnn |
| 1156 |
{ hyp } |
| 1157 |
{ unknown-choice+empty } |
| 1158 |
{ |
| 1159 |
Value~'#3'~is~invalid~for~key~'#1'.\\ |
| 1160 |
The~key~accepts~only~the~choices\\ |
| 1161 |
\clist_map_function:nN { #2 }\@@_clist_display:n |
| 1162 |
An~empty~value~removes~the~setting. |
| 1163 |
} |
| 1164 |
|
| 1165 |
\msg_new:nnn |
| 1166 |
{ hyp } |
| 1167 |
{ no-bool } |
| 1168 |
{ |
| 1169 |
Value~'#2'~is~invalid~for~key~'#1'.\\ |
| 1170 |
The~key~accepts~only~the~choices\\ |
| 1171 |
*~true\\ |
| 1172 |
*~false \\ |
| 1173 |
*~and~an~empty~value~which~removes~the~setting.\\ |
| 1174 |
No~value~is~equivalent~to~using~'true'. |
| 1175 |
} |
| 1176 |
% \end{macrocode} |
| 1177 |
% A message for creator and producer which can't be removed. |
| 1178 |
% \begin{macrocode} |
| 1179 |
\msg_new:nnn |
| 1180 |
{ hyp } |
| 1181 |
{ empty-info-value } |
| 1182 |
{ |
| 1183 |
Empty~value~for~key~#1.\\ |
| 1184 |
This~isn't~honored~by~all~backends. |
| 1185 |
} |
| 1186 |
% \end{macrocode} |
| 1187 |
% \section{Variants} |
| 1188 |
% \begin{macrocode} |
| 1189 |
\cs_generate_variant:Nn\pdf_destination:nn {nf} |
| 1190 |
\cs_generate_variant:Nn\pdf_object_ref:n {e} |
| 1191 |
\cs_generate_variant:Nn\pdf_pageobject_ref:n {e} |
| 1192 |
% \end{macrocode} |
| 1193 |
% \section{Overwriting/providing commands from hyperref} |
| 1194 |
% \pkg{hyperref} checks driver version, we need to suppress this during the development |
| 1195 |
% \begin{macrocode} |
| 1196 |
\chardef\Hy@VersionChecked=1 %don't check the version! |
| 1197 |
% \end{macrocode} |
| 1198 |
% \begin{macrocode} |
| 1199 |
%\cs_set_protected:Npn \PDF@SetupDoc{} |
| 1200 |
%\\PDF@FinishDoc{}% dummy needed for hyperref ... |
| 1201 |
% \end{macrocode} |
| 1202 |
% \begin{function}{\hypercalcbp} |
| 1203 |
% We define a better (expandable) version of \cs{hypercalcbp} |
| 1204 |
% \end{function} |
| 1205 |
% \begin{macro}[EXP]{\hypercalcbp} |
| 1206 |
% \begin{macrocode} |
| 1207 |
\cs_set_eq:NN \hypercalcbp \dim_to_decimal_in_bp:n |
| 1208 |
% \end{macrocode} |
| 1209 |
% \end{macro} |
| 1210 |
% |
| 1211 |
% This command must be provided for now, but they are unused by the driver: |
| 1212 |
% \begin{macrocode} |
| 1213 |
\providecommand\@pdfborder{} |
| 1214 |
\providecommand\@pdfborderstyle{} |
| 1215 |
\newcommand\OBJ@OCG@view {} % needed in hyperref |
| 1216 |
\def\Hy@numberline#1{#1\c_space_tl} %needed by bookmark |
| 1217 |
% \end{macrocode} |
| 1218 |
% |
| 1219 |
% The pdfversion should be set in |
| 1220 |
% \cs{DocumentMetadata} or\verb+\SetKeys[document/metadata]+ but we must |
| 1221 |
% copy it to the \pkg{hyperref} command: |
| 1222 |
% \begin{macrocode} |
| 1223 |
\cs_set_eq:NN \Hy@pdfminorversion \pdf_version_minor: |
| 1224 |
\cs_set_eq:NN \Hy@pdfmajorversion \pdf_version_major: |
| 1225 |
% \end{macrocode} |
| 1226 |
% \begin{macrocode} |
| 1227 |
\legacy_if:nT { Hy@setpdfversion } |
| 1228 |
{ |
| 1229 |
\msg_warning:nn { hyp }{ pdfversion-disabled } |
| 1230 |
} |
| 1231 |
\Hy@DisableOption{pdfversion} |
| 1232 |
% \end{macrocode} |
| 1233 |
% \cs{Acrobatmenu} should use the new internal link command |
| 1234 |
% \begin{macrocode} |
| 1235 |
\RenewDocumentCommand \Acrobatmenu { m m } |
| 1236 |
{ |
| 1237 |
\hyper@linknamed {#1} {#2} |
| 1238 |
} |
| 1239 |
% \end{macrocode} |
| 1240 |
% |
| 1241 |
% \cs{hypersetup} should set the new keys. |
| 1242 |
% We can't also execute |\kvsetkeys{Hyp}| as this errors for example with colors. |
| 1243 |
% This means the driver has to provide new code for every key! |
| 1244 |
% |
| 1245 |
% \begin{macrocode} |
| 1246 |
% TODO should go at some time ... |
| 1247 |
% \kv@set@family@handler{Hyp} |
| 1248 |
% { \msg_warning:nne {hyp}{unknown-key-to-Hyp}{#1} } |
| 1249 |
\cs_set_protected:Npn \hypersetup #1 |
| 1250 |
{ |
| 1251 |
%\kvsetkeys{Hyp} {#1} |
| 1252 |
\keys_set:nn { hyp }{ #1 } |
| 1253 |
} |
| 1254 |
% TODO for now unknown keys should only give warnings. |
| 1255 |
\keys_define:nn { hyp } |
| 1256 |
{ |
| 1257 |
unknown .code:n = |
| 1258 |
{ |
| 1259 |
\msg_warning:nneee { hyp } { unknown-key } |
| 1260 |
{ hyp }{ \l_keys_key_str } { #1 } |
| 1261 |
} |
| 1262 |
} |
| 1263 |
% \end{macrocode} |
| 1264 |
% |
| 1265 |
% Hyperref creates a number of destinations automatically. E.g. in unnumbered |
| 1266 |
% chapters and sections and with \cs{phantomsection}. The following key allows |
| 1267 |
% to force a specific name for the destination so that it can be used by bookmarks. |
| 1268 |
% \begin{macrocode} |
| 1269 |
\keys_define:nn { hyp } |
| 1270 |
{ |
| 1271 |
next-anchor .code:n = |
| 1272 |
{ |
| 1273 |
\AddToHookNext{__hyp/dest/make} |
| 1274 |
{\Hy@MakeCurrentHref{#1}} |
| 1275 |
} |
| 1276 |
} |
| 1277 |
% \end{macrocode} |
| 1278 |
% |
| 1279 |
% Allow non-ascii in href, and add more href versions. |
| 1280 |
% We add a few new keys: |
| 1281 |
% |urlencode| to force percent encoding (\cs{hrefurl}, \cs{href}) |
| 1282 |
% |protocol | to add a protocol (\cs{hrefurl}, |
| 1283 |
% \cs{href} doesn't work here as it needs the colon for the split and the guessing.) |
| 1284 |
% |destination| to add a destination (\cs{hrefpdf}) |
| 1285 |
% |
| 1286 |
% \begin{macrocode} |
| 1287 |
|
| 1288 |
\bool_new:N \l_@@_href_url_encode_bool |
| 1289 |
\bool_new:N \l_@@_href_url_ismap_bool |
| 1290 |
\tl_new:N \l_@@_href_url_protocol_tl |
| 1291 |
\tl_new:N \l_@@_href_pdf_destination_tl |
| 1292 |
\tl_new:N \l_@@_href_pdf_page_tl |
| 1293 |
\tl_new:N \l_@@_href_run_parameter_tl |
| 1294 |
\cs_new_protected:Npn \@@_href_url_format: {\begingroup\Url} |
| 1295 |
|
| 1296 |
|
| 1297 |
\keys_define:nn { hyp / href } |
| 1298 |
{ |
| 1299 |
,urlencode .bool_set:N = \l_@@_href_url_encode_bool |
| 1300 |
,format .code:n = { \cs_set:Nn \@@_href_url_format: {#1} }, |
| 1301 |
,protocol .tl_set:N = \l_@@_href_url_protocol_tl |
| 1302 |
,destination .tl_set:N = \l_@@_href_pdf_destination_tl |
| 1303 |
,pdfremotestartview .code:n = |
| 1304 |
{ |
| 1305 |
\keys_set:nn { hyp } |
| 1306 |
{ pdfremotestartview = #1 } |
| 1307 |
} |
| 1308 |
,page .code:n = |
| 1309 |
{ |
| 1310 |
\tl_set:Nn \l_@@_href_pdf_page_tl {#1} |
| 1311 |
\tl_set:Nn \Hy@href@page {#1} |
| 1312 |
} |
| 1313 |
,ismap .bool_set:N = \l_@@_href_url_ismap_bool |
| 1314 |
,run-parameter .tl_set:N = \l_@@_href_run_parameter_tl |
| 1315 |
,nextactionraw .code:n = |
| 1316 |
{ %perhaps some safety match later, see hyperref code |
| 1317 |
\tl_if_empty:nTF {#1} |
| 1318 |
{ |
| 1319 |
\pdfdict_remove:nn{l_hyp/annot/A}{Next} |
| 1320 |
} |
| 1321 |
{ |
| 1322 |
\pdfdict_put:nnn{l_hyp/annot/A}{Next}{#1} |
| 1323 |
\tl_set:Nn \Hy@href@nextactionraw {/Next~#1} |
| 1324 |
\keys_set:nn {hyp }{ pdfnewwindow = true} |
| 1325 |
} |
| 1326 |
} |
| 1327 |
,afrelationship .code:n = |
| 1328 |
{ |
| 1329 |
\pdfdict_put:nne |
| 1330 |
{ l_pdffile/Filespec}{AFRelationship}{ \pdf_name_from_unicode_e:n {#1}} |
| 1331 |
} |
| 1332 |
|
| 1333 |
} |
| 1334 |
|
| 1335 |
\keys_define:nn { hyp } |
| 1336 |
{ |
| 1337 |
,href / urlencode .bool_set:N = \l_@@_href_url_encode_bool |
| 1338 |
,href / urlencode .default:n = {true} |
| 1339 |
,href / urlencode .initial:n = {false} |
| 1340 |
,href / protocol .tl_set:N = \l_@@_href_url_protocol_tl |
| 1341 |
,href / destination .tl_set:N = \l_@@_href_pdf_destination_tl |
| 1342 |
,href / format .code:n = { \cs_set:Nn \@@_href_url_format:{#1} } |
| 1343 |
} |
| 1344 |
|
| 1345 |
\hook_new_pair:nn{cmd/href/before}{cmd/href/after} |
| 1346 |
|
| 1347 |
\DeclareRobustCommand*{\href}[1][]{% |
| 1348 |
\mode_leave_vertical: |
| 1349 |
\hook_use:n{cmd/href/before} |
| 1350 |
\group_begin: |
| 1351 |
\keys_set:nn { hyp / href } {#1} |
| 1352 |
\bool_if:NTF \l_@@_href_url_encode_bool |
| 1353 |
{ |
| 1354 |
\tl_set:Nn \l_@@_text_enc_uri_print_tl {utf8/URI} |
| 1355 |
} |
| 1356 |
{ |
| 1357 |
\tl_set:Nn \l_@@_text_enc_uri_print_tl {utf8/string} |
| 1358 |
} |
| 1359 |
\@ifnextchar\bgroup\Hy@href{\hyper@normalise\href@}% |
| 1360 |
} |
| 1361 |
|
| 1362 |
\begingroup |
| 1363 |
\catcode`\$=6 % |
| 1364 |
\catcode`\#=12 % |
| 1365 |
\gdef\href@$1{\expandafter\href@split$1##\\}% |
| 1366 |
\gdef\href@split$1#$2#$3\\$4{% |
| 1367 |
\hyper@@@@link{$1}{$2}{$4}%<---@@-docstrip doubling! |
| 1368 |
\endgroup |
| 1369 |
\hook_use:n{cmd/href/after} |
| 1370 |
}% |
| 1371 |
\endgroup |
| 1372 |
|
| 1373 |
\hook_new_pair:nn{cmd/hrefurl/before}{cmd/hrefurl/after} |
| 1374 |
|
| 1375 |
\DeclareRobustCommand*{\hrefurl}[1][] |
| 1376 |
{ |
| 1377 |
\mode_leave_vertical: |
| 1378 |
\hook_use:n{cmd/href/before} |
| 1379 |
\group_begin: |
| 1380 |
\keys_set:nn { hyp / href } {#1} |
| 1381 |
\bool_if:NTF \l_@@_href_url_encode_bool |
| 1382 |
{ |
| 1383 |
\tl_set:Nn \l_@@_text_enc_uri_print_tl {utf8/URI} |
| 1384 |
} |
| 1385 |
{ |
| 1386 |
\tl_set:Nn \l_@@_text_enc_uri_print_tl {utf8/string} |
| 1387 |
} |
| 1388 |
\hyper@normalise\@@_href_url_aux:nn} |
| 1389 |
|
| 1390 |
\cs_new_protected:Npn \@@_href_url_aux:nn #1 #2 |
| 1391 |
{ |
| 1392 |
\exp_args:Nno\hyper@linkurl{#2}{\l_@@_href_url_protocol_tl#1} |
| 1393 |
\group_end: |
| 1394 |
\hook_use:n{cmd/href/after} |
| 1395 |
} |
| 1396 |
|
| 1397 |
\hook_new_pair:nn{cmd/hrefpdf/before}{cmd/hrefpdf/after} |
| 1398 |
\DeclareRobustCommand*{\hrefpdf}[1][] |
| 1399 |
{ |
| 1400 |
\mode_leave_vertical: |
| 1401 |
\hook_use:n{cmd/hrefpdf/before} |
| 1402 |
\group_begin: |
| 1403 |
\keys_set:nn { hyp / href } {#1} |
| 1404 |
\hyper@normalise\@@_href_pdf_aux:nn |
| 1405 |
} |
| 1406 |
|
| 1407 |
\cs_new_protected:Npn \@@_href_pdf_aux:nn #1 #2 |
| 1408 |
{ |
| 1409 |
\exp_args:Nnno\hyper@linkfile{#2}{#1}{\l_@@_href_pdf_destination_tl} |
| 1410 |
\group_end: |
| 1411 |
\hook_use:n{cmd/hrefpdf/after} |
| 1412 |
} |
| 1413 |
|
| 1414 |
\hook_new_pair:nn{cmd/hrefrun/before}{cmd/hrefrun/after} |
| 1415 |
\DeclareRobustCommand*{\hrefrun}[1][] |
| 1416 |
{ |
| 1417 |
\mode_leave_vertical: |
| 1418 |
\hook_use:n{cmd/hrefrun/before} |
| 1419 |
\group_begin: |
| 1420 |
\keys_set:nn { hyp / href } {#1} |
| 1421 |
\hyper@normalise\@@_href_run_aux:nn |
| 1422 |
} |
| 1423 |
|
| 1424 |
\cs_new_protected:Npn \@@_href_run_aux:nn #1 #2 |
| 1425 |
{ |
| 1426 |
\exp_args:Nnno\hyper@linklaunch{#1}{#2}{\l_@@_href_run_parameter_tl} |
| 1427 |
\group_end: |
| 1428 |
\hook_use:n{cmd/hrefrun/after} |
| 1429 |
} |
| 1430 |
|
| 1431 |
|
| 1432 |
\hook_new_pair:nn{cmd/url/before}{cmd/url/after} |
| 1433 |
|
| 1434 |
\DeclareRobustCommand*{\url}[1][] |
| 1435 |
{ |
| 1436 |
\mode_leave_vertical: |
| 1437 |
\hook_use:n{cmd/url/before} |
| 1438 |
\group_begin: |
| 1439 |
\keys_set:nn {hyp / href } {#1} |
| 1440 |
\bool_if:NTF \l_@@_href_url_encode_bool |
| 1441 |
{ |
| 1442 |
\tl_set:Nn \l_@@_text_enc_uri_print_tl {utf8/URI} |
| 1443 |
} |
| 1444 |
{ |
| 1445 |
\tl_set:Nn \l_@@_text_enc_uri_print_tl {utf8/string} |
| 1446 |
} |
| 1447 |
\hyper@normalise\@@_href_url_aux:n |
| 1448 |
} |
| 1449 |
|
| 1450 |
\cs_new_protected:Npn \@@_href_url_aux:n #1 |
| 1451 |
{ |
| 1452 |
\exp_args:Nno |
| 1453 |
\hyper@linkurl{\@@_href_url_format: {#1}} |
| 1454 |
{\l_@@_href_url_protocol_tl#1} |
| 1455 |
\group_end: |
| 1456 |
\hook_use:n{cmd/url/after} |
| 1457 |
} |
| 1458 |
|
| 1459 |
% \end{macrocode} |
| 1460 |
% the \cs{urldef} command doesn't like the optional argument, so we overwrite |
| 1461 |
% locally the \cs{url} command here: |
| 1462 |
% \begin{macrocode} |
| 1463 |
|
| 1464 |
\def\urldef#1#2{\begingroup\def\url{\hyper@normalise\url@}\setbox\z@\hbox\bgroup |
| 1465 |
\def\Url@HyperHook##1\endgroup{\Url@def{#1}{#2}}% |
| 1466 |
% Because hyperref breaks \urldef and does not define its own (Grrrr!)... |
| 1467 |
\def\url@##1{\egroup\endgroup\DeclareRobustCommand#1{#2{##1}}}% |
| 1468 |
#2} |
| 1469 |
|
| 1470 |
% \end{macrocode} |
| 1471 |
% make the new commands compatible with \cs{pdfstringdef}: |
| 1472 |
% \begin{macrocode} |
| 1473 |
\NewExpandableDocumentCommand\@@_secondoftwowithopt:wnn {omm}{#3} |
| 1474 |
\pdfstringdefDisableCommands{\let\hrefurl\@@_secondoftwowithopt:wnn} |
| 1475 |
\pdfstringdefDisableCommands{\let\hrefpdf\@@_secondoftwowithopt:wnn} |
| 1476 |
\pdfstringdefDisableCommands{\let\hrefrun\@@_secondoftwowithopt:wnn} |
| 1477 |
% \end{macrocode} |
| 1478 |
% \section{Compatibility commands} |
| 1479 |
% \subsection{Metadata} |
| 1480 |
% A number of values should be accessible from other packages. Until now |
| 1481 |
% packages like \pkg{hyperxmp} used variables like \cs{@pdfauthor}. As they are |
| 1482 |
% gone we need to provide some other access. |
| 1483 |
% \begin{macrocode} |
| 1484 |
\cs_new_protected:Npn \@@_store_metadata:nn #1 #2 %#1 key, #2 value. |
| 1485 |
{ |
| 1486 |
%\tl_set:cn {@#1}{#2} |
| 1487 |
\AddToDocumentProperties[hyperref]{#1}{#2} |
| 1488 |
} |
| 1489 |
\cs_generate_variant:Nn \@@_store_metadata:nn {en,ne,ee,no,eo} |
| 1490 |
% \end{macrocode} |
| 1491 |
% \subsection{citecolor} |
| 1492 |
% cite is a link context. So we define a hook, and the keys in terms of this hook. |
| 1493 |
% |
| 1494 |
% \begin{macrocode} |
| 1495 |
\hook_new:n{hyp/link/cite} |
| 1496 |
%\color_set:nnn {hyp/color/cite}{HTML}{2E7E2A} |
| 1497 |
%\color_set:nn {hyp/color/citeborder}{hyp/color/cite!60!white} |
| 1498 |
\keys_define:nn { hyp } |
| 1499 |
{ |
| 1500 |
,citecolor .code:n = {\@@_color_set:ne {hyp/color/cite}{#1}\@@_citecolor_hook_init:} |
| 1501 |
,citebordercolor |
| 1502 |
.code:n = {\@@_color_set:ne {hyp/color/citeborder}{#1}\@@_citebordercolor_hook_init:} |
| 1503 |
} |
| 1504 |
\cs_new_protected:Npn \@@_citecolor_hook_init: |
| 1505 |
{ |
| 1506 |
\hook_gput_code:nnn { hyp/link/cite }{hyp/cite} |
| 1507 |
{ |
| 1508 |
\keys_set:nn { hyp } |
| 1509 |
{ |
| 1510 |
linkcolor = hyp/color/cite |
| 1511 |
} |
| 1512 |
} |
| 1513 |
\cs_gset_eq:NN \@@_citecolor_hook_init: \prg_do_nothing: |
| 1514 |
} |
| 1515 |
\cs_new_protected:Npn \@@_citebordercolor_hook_init: |
| 1516 |
{ |
| 1517 |
\hook_gput_code:nnn { hyp/link/cite }{hyp/citeborder} |
| 1518 |
{ |
| 1519 |
\keys_set:nn { hyp } |
| 1520 |
{ |
| 1521 |
linkbordercolor = hyp/color/citeborder |
| 1522 |
} |
| 1523 |
} |
| 1524 |
\cs_gset_eq:NN \@@_citebordercolor_hook_init: \prg_do_nothing: |
| 1525 |
} |
| 1526 |
|
| 1527 |
% \end{macrocode} |
| 1528 |
% \section{Checks} |
| 1529 |
% The driver can not work properly if the pdfmanagement is not active, |
| 1530 |
% as keys need to write to the catalog and to info. But annotations |
| 1531 |
% and outlines should work. |
| 1532 |
% So should this be a fatal error? |
| 1533 |
% Should there be a difference between missing and inactive management? |
| 1534 |
% TODO |
| 1535 |
% \begin{macrocode} |
| 1536 |
\bool_lazy_and:nnF |
| 1537 |
{ \cs_if_exist_p:N \pdfmanagement_if_active_p: }{ \pdfmanagement_if_active_p: } |
| 1538 |
{ \msg_error:nn { hyp}{ missing-resource-management } } |
| 1539 |
% \end{macrocode} |
| 1540 |
% |
| 1541 |
% \section{bookmarks} |
| 1542 |
% Outlines/bookmarks require the bookmark package. |
| 1543 |
% TODO check pdfpagemode if bookmarks are suppressed. |
| 1544 |
% TODO We overwrite the color key here for now, but this should be moved to bookmark |
| 1545 |
% \begin{macrocode} |
| 1546 |
\AddToHook { package/bookmark/after } |
| 1547 |
{ |
| 1548 |
\define@key{BKM}{color} |
| 1549 |
{ |
| 1550 |
\tl_if_blank:nTF {#1} |
| 1551 |
{ \cs_set_eq:NN\BKM@color\@empty } |
| 1552 |
{ |
| 1553 |
\__hyp_color_set:ne {__hyp/tmpa}{#1} |
| 1554 |
\color_export:nVN |
| 1555 |
{__hyp/tmpa} |
| 1556 |
\g__hyp_bordercolormodel_str |
| 1557 |
\BKM@color |
| 1558 |
} |
| 1559 |
} |
| 1560 |
} |
| 1561 |
% \end{macrocode} |
| 1562 |
% \changes{v0.97b}{2026-05-15}{load bookmark earlier for issue \#115} |
| 1563 |
% \begin{macrocode} |
| 1564 |
\legacy_if:nTF { Hy@bookmarks } |
| 1565 |
{ |
| 1566 |
\legacy_if:nT {Hy@draft} |
| 1567 |
{ |
| 1568 |
\PassOptionsToPackage{draft}{bookmark} |
| 1569 |
} |
| 1570 |
\RequirePackage{bookmark} |
| 1571 |
} |
| 1572 |
% \end{macrocode} |
| 1573 |
% Some of the bookmark keys make use of \cs{bookmarksetup}. |
| 1574 |
% So we provide the command so that the keys do not error if \pkg{bookmark} is not loaded. |
| 1575 |
% In case someone loads bookmarks afterwards we undefine it before the file: |
| 1576 |
% \begin{macrocode} |
| 1577 |
{ |
| 1578 |
\providecommand\bookmarksetup[1]{} |
| 1579 |
\AddToHook{file/bookmark.sty/before}{\let\bookmarksetup\undefined} |
| 1580 |
} |
| 1581 |
% \end{macrocode} |
| 1582 |
% |
| 1583 |
% \section{Reference and label commands} |
| 1584 |
% This uses the in-built property module. |
| 1585 |
% |
| 1586 |
% \begin{macro} |
| 1587 |
% { |
| 1588 |
% \@@_property_record:nn, |
| 1589 |
% } |
| 1590 |
% \begin{macrocode} |
| 1591 |
% |
| 1592 |
% \end{macrocode} |
| 1593 |
% A label command which adds the space commands from LaTeX: |
| 1594 |
% \begin{macrocode} |
| 1595 |
\cs_new_protected:Npn \@@_property_record:nn #1 #2 %label/attributes |
| 1596 |
{ |
| 1597 |
\@bsphack |
| 1598 |
\property_record:nn{#1}{#2} |
| 1599 |
\@esphack |
| 1600 |
} |
| 1601 |
% \end{macrocode} |
| 1602 |
% we generate a few variants. We use ee-variants as they already exist |
| 1603 |
% in the module and once this is there it can go here. |
| 1604 |
% \begin{macrocode} |
| 1605 |
\cs_generate_variant:Nn \@@_property_record:nn {ee} |
| 1606 |
% \end{macrocode} |
| 1607 |
% \end{macro} |
| 1608 |
% \section{Variables} |
| 1609 |
% \subsection{Private temporary variables} |
| 1610 |
% At first a few generic tmp variables |
| 1611 |
% \begin{variable} |
| 1612 |
% { |
| 1613 |
% \l_@@_tmpa_tl, |
| 1614 |
% \l_@@_tmpb_tl, |
| 1615 |
% \l_@@_tmpa_seq, |
| 1616 |
% \l_@@_tmpa_int, |
| 1617 |
% \l_@@_tmpa_box, |
| 1618 |
% \l_@@_tmpa_str, |
| 1619 |
% } |
| 1620 |
% \begin{macrocode} |
| 1621 |
\box_new:N \l_@@_tmpa_box |
| 1622 |
\tl_new:N \l_@@_tmpa_tl |
| 1623 |
\tl_new:N \l_@@_tmpb_tl |
| 1624 |
\seq_new:N \l_@@_tmpa_seq |
| 1625 |
\int_new:N \l_@@_tmpa_int |
| 1626 |
\str_new:N \l_@@_tmpa_str |
| 1627 |
% \end{macrocode} |
| 1628 |
% \end{variable} |
| 1629 |
% |
| 1630 |
% A number of more specific tmp variables. These will perhaps disappear or change. |
| 1631 |
% \begin{variable} |
| 1632 |
% { |
| 1633 |
% \l_@@_dest_name_tmpa_tl, |
| 1634 |
% \l_@@_uri_tmpa_tl, |
| 1635 |
% \l_@@_filename_tmpa_tl, |
| 1636 |
% \l_@@_para_tmpa_tl |
| 1637 |
% \l_@@_text_tmpa_str |
| 1638 |
% \g_@@_text_tmpa_str |
| 1639 |
% } |
| 1640 |
% TODO: document and check use! |
| 1641 |
% \begin{macrocode} |
| 1642 |
\tl_new:N \l_@@_dest_name_tmpa_tl |
| 1643 |
\tl_new:N \l_@@_uri_tmpa_tl |
| 1644 |
\tl_new:N \l_@@_filename_tmpa_tl |
| 1645 |
\tl_new:N \l_@@_para_tmpa_tl |
| 1646 |
\str_new:N \l_@@_text_tmpa_str |
| 1647 |
\str_new:N \g_@@_text_tmpa_str |
| 1648 |
% \end{macrocode} |
| 1649 |
% \end{variable} |
| 1650 |
% |
| 1651 |
% \subsection{Constants} |
| 1652 |
% \begin{variable} |
| 1653 |
% { \c_@@_dest_undefined_tl } |
| 1654 |
% This variable is used if a destination name is empty. |
| 1655 |
% \begin{macrocode} |
| 1656 |
\tl_const:Nn \c_@@_dest_undefined_tl {UNDEFINED} |
| 1657 |
% \end{macrocode} |
| 1658 |
% \end{variable} |
| 1659 |
% \begin{variable} |
| 1660 |
% { |
| 1661 |
% \c_@@_annot_types_seq, |
| 1662 |
% \c_@@_map_annot_hyp_prop, |
| 1663 |
% \c_@@_map_hyp_annot_prop, |
| 1664 |
% } |
| 1665 |
% This constants holds the link types managed by hyperref |
| 1666 |
% along with a mapping from annot names to hyperref names and back. |
| 1667 |
% \begin{macrocode} |
| 1668 |
\seq_const_from_clist:Nn \c_@@_annot_types_seq |
| 1669 |
{url,link,file,menu,run} |
| 1670 |
\prop_const_from_keyval:Nn \c_@@_map_annot_hyp_prop |
| 1671 |
{ |
| 1672 |
URI = url, |
| 1673 |
GoTo = link, |
| 1674 |
GoToR = file, |
| 1675 |
Named = menu, |
| 1676 |
Launch= run |
| 1677 |
} |
| 1678 |
\prop_const_from_keyval:Nn \c_@@_map_hyp_annot_prop |
| 1679 |
{ |
| 1680 |
url = URI, |
| 1681 |
link = GoTo, |
| 1682 |
file = GoToR, |
| 1683 |
menu = Named, |
| 1684 |
run = Launch |
| 1685 |
} |
| 1686 |
|
| 1687 |
% \end{macrocode} |
| 1688 |
% \end{variable} |
| 1689 |
% \subsection{Variables} |
| 1690 |
% \begin{variable} |
| 1691 |
% { |
| 1692 |
% \g_@@_dest_pdfstartpage_tl , |
| 1693 |
% \g_@@_dest_pdfstartview_tl , |
| 1694 |
% \l_@@_dest_pdfremotestartview_tl , |
| 1695 |
% } |
| 1696 |
% The first holds the (absolute) start page number, |
| 1697 |
% the other the startview instruction for the current and remote files. |
| 1698 |
% The instruction is in \enquote{PDF format} but without the leading slash! |
| 1699 |
% \begin{macrocode} |
| 1700 |
\tl_new:N \g_@@_dest_pdfstartpage_tl |
| 1701 |
\tl_new:N \g_@@_dest_pdfstartview_tl |
| 1702 |
\tl_new:N \l_@@_dest_pdfremotestartview_tl |
| 1703 |
% \end{macrocode} |
| 1704 |
% \end{variable} |
| 1705 |
% |
| 1706 |
% It is still unclear which str convert option is the best in the various |
| 1707 |
% places, so we use a variable to allow tests and perhaps external configuration. |
| 1708 |
% The \enquote{print} type should always have the delimiters. |
| 1709 |
% \begin{variable} |
| 1710 |
% { |
| 1711 |
% \l_@@_text_enc_uri_print_tl, |
| 1712 |
% \l_@@_text_enc_info_print_tl, |
| 1713 |
% \l_@@_text_enc_dest_tl, |
| 1714 |
% \l_@@_text_enc_dest_print_tl, |
| 1715 |
% \l_@@_text_enc_file_print_tl, |
| 1716 |
% \l_@@_text_enc_para_print_tl |
| 1717 |
% } |
| 1718 |
% \begin{macrocode} |
| 1719 |
\tl_new:N \l_@@_text_enc_uri_print_tl |
| 1720 |
\tl_new:N \l_@@_text_enc_info_print_tl |
| 1721 |
\tl_new:N \l_@@_text_enc_dest_tl |
| 1722 |
\tl_new:N \l_@@_text_enc_dest_print_tl |
| 1723 |
\tl_new:N \l_@@_text_enc_file_print_tl |
| 1724 |
\tl_new:N \l_@@_text_enc_para_print_tl |
| 1725 |
|
| 1726 |
\tl_set:Nn \l_@@_text_enc_uri_print_tl {utf8/URI} |
| 1727 |
\tl_set:Nn \l_@@_text_enc_info_print_tl {utf16/hex} |
| 1728 |
\tl_set:Nn \l_@@_text_enc_dest_tl {utf8/string-raw} |
| 1729 |
\tl_set:Nn \l_@@_text_enc_dest_print_tl {utf8/string} |
| 1730 |
\tl_set:Nn \l_@@_text_enc_file_print_tl {utf8/string} |
| 1731 |
\tl_set:Nn \l_@@_text_enc_para_print_tl {utf8/string} |
| 1732 |
% \end{macrocode} |
| 1733 |
% \end{variable} |
| 1734 |
% |
| 1735 |
% It is also unclear how the /Contents entry would look at best. |
| 1736 |
% So we use sockets. The first argument is the target (url or destination), |
| 1737 |
% For GoTo we also pass the text as argument. |
| 1738 |
% The sockets should eat their arguments and |
| 1739 |
% put something into the relevant annotation dictionaries. |
| 1740 |
% \changes{v0.96o}{2024-10-27}{moved dictionary command into socket so that |
| 1741 |
% it can be fully replaced.} |
| 1742 |
% \begin{macrocode} |
| 1743 |
\tl_new:N\l_@@_link_Contents_tl |
| 1744 |
\socket_new:nn {hyp/link/GoTo/Contents}{2} |
| 1745 |
\socket_new:nn {hyp/link/URI/Contents}{1} |
| 1746 |
\socket_new:nn {hyp/link/GoToR/Contents}{1} |
| 1747 |
\socket_assign_plug:nn{hyp/link/GoTo/Contents}{noop} |
| 1748 |
\socket_assign_plug:nn{hyp/link/GoToR/Contents}{noop} |
| 1749 |
\socket_assign_plug:nn{hyp/link/URI/Contents}{noop} |
| 1750 |
\socket_new_plug:nnn {hyp/link/GoTo/Contents}{default} |
| 1751 |
{ |
| 1752 |
\@@_text_pdfstring:noN |
| 1753 |
{ Go~to~destination~#1 } |
| 1754 |
{ \l_@@_text_enc_info_print_tl } |
| 1755 |
\l_@@_link_Contents_tl |
| 1756 |
\pdfannot_dict_put:nne {link/GoTo}{Contents} |
| 1757 |
{\l_@@_link_Contents_tl} |
| 1758 |
} |
| 1759 |
\socket_new_plug:nnn {hyp/link/GoToR/Contents}{default} |
| 1760 |
{ |
| 1761 |
\@@_text_pdfstring:noN |
| 1762 |
{ Open~file~#1 } |
| 1763 |
{ \l_@@_text_enc_info_print_tl } |
| 1764 |
\l_@@_link_Contents_tl |
| 1765 |
\pdfannot_dict_put:nne {link/GoToR}{Contents} |
| 1766 |
{\l_@@_link_Contents_tl} |
| 1767 |
} |
| 1768 |
\socket_new_plug:nnn {hyp/link/URI/Contents}{default} |
| 1769 |
{ |
| 1770 |
\@@_text_pdfstring:noN |
| 1771 |
{ #1 } |
| 1772 |
{ \l_@@_text_enc_info_print_tl } |
| 1773 |
\l_@@_link_Contents_tl |
| 1774 |
\pdfannot_dict_put:nne {link/URI}{Contents} |
| 1775 |
{\l_@@_link_Contents_tl} |
| 1776 |
} |
| 1777 |
\pdfmeta_standard_family:nn{UA} |
| 1778 |
{ |
| 1779 |
\pdfmeta_standard_verify:nF{link_Contents} |
| 1780 |
{ |
| 1781 |
\socket_assign_plug:nn{hyp/link/GoTo/Contents}{default} |
| 1782 |
\socket_assign_plug:nn{hyp/link/GoToR/Contents}{default} |
| 1783 |
\socket_assign_plug:nn{hyp/link/URI/Contents}{default} |
| 1784 |
} |
| 1785 |
} |
| 1786 |
% \end{macrocode} |
| 1787 |
% \begin{variable}{\l_@@_dest_pdfview_tl} |
| 1788 |
% This hold the destination instructions in a format suitable for |
| 1789 |
% \cs{pdf_destination:nn}. The special value |fitrbox| indicates a boxed destination. |
| 1790 |
% \begin{macrocode} |
| 1791 |
\tl_new:N \l_@@_dest_pdfview_tl |
| 1792 |
% \end{macrocode} |
| 1793 |
% \end{variable} |
| 1794 |
% \begin{hypcolor} |
| 1795 |
% { |
| 1796 |
% hyp/annot/link, |
| 1797 |
% hyp/annot/url, |
| 1798 |
% hyp/annot/file, |
| 1799 |
% hyp/annot/run, |
| 1800 |
% hyp/annot/menu, |
| 1801 |
% } |
| 1802 |
% These color names are used for the annotations (colorlinks). They are initialized |
| 1803 |
% at the end when the color scheme is used |
| 1804 |
% \end{hypcolor} |
| 1805 |
% \begin{variable}{\g_@@_bordercolormodel_str} |
| 1806 |
% This holds the export model for border color etc. |
| 1807 |
% It is currently either |space-sep-cmyk| or |space-sep-rgb|. |
| 1808 |
% The default is the second. It can be change by the key |bordercolormodel| |
| 1809 |
% \begin{macrocode} |
| 1810 |
\str_new:N \g_@@_bordercolormodel_str |
| 1811 |
% \end{macrocode} |
| 1812 |
% \end{variable} |
| 1813 |
% \subsection{Booleans} |
| 1814 |
% \begin{variable} |
| 1815 |
% { |
| 1816 |
% \l_hyp_annot_colorlink_bool, |
| 1817 |
% \l_hyp_annot_colorurl_bool, |
| 1818 |
% \l_hyp_annot_colorfile_bool, |
| 1819 |
% \l_hyp_annot_colorrun_bool, |
| 1820 |
% \l_hyp_annot_colormenu_bool, |
| 1821 |
% } |
| 1822 |
% These booleans are needed to control the colors. |
| 1823 |
% They are public so that other packages can query the state too. |
| 1824 |
% \begin{macrocode} |
| 1825 |
\seq_map_inline:Nn \c_@@_annot_types_seq |
| 1826 |
{ |
| 1827 |
\bool_new:c {l_hyp_annot_color#1_bool} |
| 1828 |
} |
| 1829 |
% \end{macrocode} |
| 1830 |
% \end{variable} |
| 1831 |
% \begin{variable} |
| 1832 |
% { |
| 1833 |
% \l_hyp_annot_ocgcolorlink_bool, |
| 1834 |
% \l_hyp_annot_ocgcolorurl_bool, |
| 1835 |
% \l_hyp_annot_ocgcolorfile_bool, |
| 1836 |
% \l_hyp_annot_ocgcolorrun_bool, |
| 1837 |
% \l_hyp_annot_ocgcolormenu_bool, |
| 1838 |
% } |
| 1839 |
% These booleans are needed to control the ocgcolors. |
| 1840 |
% They are public so that other packages can query the state too. |
| 1841 |
% \begin{macrocode} |
| 1842 |
\seq_map_inline:Nn \c_@@_annot_types_seq |
| 1843 |
{ |
| 1844 |
\bool_new:c {l_hyp_annot_ocgcolor#1_bool} |
| 1845 |
} |
| 1846 |
% \end{macrocode} |
| 1847 |
% \end{variable} |
| 1848 |
% \begin{variable} |
| 1849 |
% { |
| 1850 |
% \l_@@_annot_GoTo_bool |
| 1851 |
% \l_@@_annot_URI_bool |
| 1852 |
% \l_@@_annot_GoToR_bool |
| 1853 |
% \l_@@_annot_Named_bool |
| 1854 |
% \l_@@_annot_Launch_bool |
| 1855 |
% } |
| 1856 |
% This booleans are used to disable some link types |
| 1857 |
% while keeping others. |
| 1858 |
% \begin{macrocode} |
| 1859 |
\seq_map_inline:Nn \c_pdfannot_link_types_seq |
| 1860 |
{ |
| 1861 |
\bool_new:c {l_@@_annot_#1_bool} |
| 1862 |
\bool_set_true:c {l_@@_annot_#1_bool} |
| 1863 |
} |
| 1864 |
% \end{macrocode} |
| 1865 |
% \end{variable} |
| 1866 |
% |
| 1867 |
% \subsection{Boxes} |
| 1868 |
% \begin{variable}{\l_@@_dest_box} |
| 1869 |
% This holds an (empty) box which is used to get the width for FitR destinations. |
| 1870 |
% \begin{macrocode} |
| 1871 |
\box_new:N \l_@@_dest_box |
| 1872 |
% \end{macrocode} |
| 1873 |
% \end{variable} |
| 1874 |
|
| 1875 |
% \subsection{Regex} |
| 1876 |
% \begin{variable}{\c_@@_dest_startview_regex} |
| 1877 |
% This regex is used to extract the right arguments |
| 1878 |
% pdfstartview and pdfremotestartview. Their values is filled up with |null| |
| 1879 |
% and then the start extracted. |
| 1880 |
% \begin{macrocode} |
| 1881 |
\regex_const:Nn \c_@@_dest_startview_regex |
| 1882 |
{ |
| 1883 |
\A\ * |
| 1884 |
(?: |
| 1885 |
(?:XYZ (?:\ +(?:(?:\d+|\d*\.\d+)|null)){3}\ ) |
| 1886 |
| |
| 1887 |
(?:Fit\b|FitB\b) |
| 1888 |
| |
| 1889 |
(?:(?:FitH|FitV|FitBH|FitBV)(?:\ +(?:\d+|\d*\.\d+)|\ +null){1}) |
| 1890 |
| |
| 1891 |
(?:FitR (?:\ +\d+|\ +\d*\.\d+){4}\ ) |
| 1892 |
) |
| 1893 |
} |
| 1894 |
% \end{macrocode} |
| 1895 |
% \end{variable} |
| 1896 |
% |
| 1897 |
% \subsection{PDF dictionaries} |
| 1898 |
% \begin{variable}{l_@@_page/Trans} |
| 1899 |
% This dictionary is used for page transitions. |
| 1900 |
% \begin{macrocode} |
| 1901 |
\pdfdict_new:n {l_@@_page/Trans} |
| 1902 |
\pdfdict_put:nnn {l_@@_page/Trans}{Type}{/Trans} |
| 1903 |
% \end{macrocode} |
| 1904 |
% \end{variable} |
| 1905 |
|
| 1906 |
% \section{PDF string conversion} |
| 1907 |
% |
| 1908 |
% This is now done with \cs{pdf_purify:nN} which is defined and documented in |
| 1909 |
% l3pdftools. |
| 1910 |
% |
| 1911 |
% After the content is purified the last step has to convert |
| 1912 |
% the string to a PDF encoding. This should be done with |
| 1913 |
% cs{pdf_string_from_unicode:nnN} in l3pdftools and typically uses one of these |
| 1914 |
% methods: |
| 1915 |
% |
| 1916 |
% \begin{tabular}{ll} |
| 1917 |
% utf8/string & \texttt{(lit)} (utf8/string)\\ |
| 1918 |
% utf8/string-raw & \texttt{lit} (utf8/string)\\ |
| 1919 |
% utf8/URI & \texttt{(percent encoded url)}\\ |
| 1920 |
% utf8/URI-raw & \texttt{percent encoded url}\\ |
| 1921 |
% utf16/hex & \texttt{<HEX>} (utf16/hex)\\ |
| 1922 |
% utf16/hex-raw & \texttt{HEX} (utf16/hex)\\ |
| 1923 |
% utf16/string & \texttt{(lit)} (utf16/string)\\ |
| 1924 |
% utf16/string-raw & \texttt{lit} (utf16/string) |
| 1925 |
% \end{tabular} |
| 1926 |
% |
| 1927 |
% \begin{macro}{ \@@_text_string_from_unicode:nN } |
| 1928 |
% As normally we have to duplicate the argument we define a helper command: |
| 1929 |
% |
| 1930 |
% \begin{macrocode} |
| 1931 |
\cs_new_protected:Npn \@@_text_string_from_unicode:nN #1 #2 |
| 1932 |
{ |
| 1933 |
\pdf_string_from_unicode:nVN { #1 } #2 #2 |
| 1934 |
} |
| 1935 |
% \end{macrocode} |
| 1936 |
% \end{macro} |
| 1937 |
% |
| 1938 |
% This command combines the two parts: |
| 1939 |
% |#1|=input, |#2|= handler shortcut |#3|= output str variable |
| 1940 |
% |
| 1941 |
% \begin{macro}{ \@@_text_pdfstring:nnN } |
| 1942 |
% \begin{macrocode} |
| 1943 |
\cs_new_protected:Npn \@@_text_pdfstring:nnN #1 #2 #3 |
| 1944 |
{ |
| 1945 |
\pdf_purify:nN {#1}#3 |
| 1946 |
\pdf_string_from_unicode:nVN { #2 } #3 #3 |
| 1947 |
} |
| 1948 |
\cs_generate_variant:Nn \@@_text_pdfstring:nnN {noN,eoN} |
| 1949 |
|
| 1950 |
% \end{macrocode} |
| 1951 |
% \end{macro} |
| 1952 |
% !!! temporary until all instances are gone |
| 1953 |
%^^A TODO check if the redefinition of |~| is needed (probably not) |
| 1954 |
%^^A \edef~{\string~}% |
| 1955 |
%^^A \char_set_catcode_other:N \~ |
| 1956 |
%^^A \char_set_active_eq:NN \~ \c_tilde_str |
| 1957 |
%^^A \char_set_catcode_active:N \~ |
| 1958 |
% \begin{macrocode} |
| 1959 |
\cs_new_protected:Npn\Hy@pstringdef #1 #2 |
| 1960 |
{ \@@_text_pdfstring:nnN {#2} {utf8/string-raw}#1 } |
| 1961 |
% \end{macrocode} |
| 1962 |
% |
| 1963 |
% This is a special version for info keys: |
| 1964 |
% \begin{macro}{ \@@_text_pdfstring_info:nN } |
| 1965 |
% \begin{macrocode} |
| 1966 |
\cs_new_protected:Npn \@@_text_pdfstring_info:nN #1 #2 |
| 1967 |
{ |
| 1968 |
\@@_text_pdfstring:noN { #1 }{ \l_@@_text_enc_info_print_tl } #2 |
| 1969 |
} |
| 1970 |
\cs_generate_variant:Nn \@@_text_pdfstring_info:nN {eN,oN} |
| 1971 |
% \end{macrocode} |
| 1972 |
% \end{macro} |
| 1973 |
% |
| 1974 |
% \section{Pagelabels} |
| 1975 |
% Page labels are representations of the page numbers in the PDF viewer. If the hyperref |
| 1976 |
% options |pdfpagelabels| is true (the default) roman numbers are e.g. shown as |
| 1977 |
% \enquote{ii (2/58)}. To do this the page ranges must be collected, if possible a prefix |
| 1978 |
% and the numbering of the counter must be identified and then written |
| 1979 |
% to the catalog. |
| 1980 |
% |
| 1981 |
% The current implementation in hyperref/hyperref drivers: |
| 1982 |
% \begin{description} |
| 1983 |
% \item[xetex:] hxetex.def, line 80-110\\ |
| 1984 |
% |\HyPL@StorePageLabel| writes to the aux-file |
| 1985 |
% at begin document (after reading the aux) |
| 1986 |
% |\HyPL@SetPageLabels| is called (defined in hyperref.sty after the driver |
| 1987 |
% loading) |
| 1988 |
% which calls |\Hy@PutCatalog{/PageLabels<</Nums[\HyPL@Labels]>>}| |
| 1989 |
% \item[dvips:] identical to xetex, line 60 to 90 in pdfmark.def |
| 1990 |
% \item[dvipdfm:] identical to xetex |
| 1991 |
% \item[pdftex:] |\HyPL@StorePageLabel| stores in |\HyPL@Labels| in the first compilation |
| 1992 |
% In |\AtVeryEndDocument| |\HyPL@SetPageLabels| is called. |
| 1993 |
% \item[luatex] identical to pdftex |
| 1994 |
% \end{description} |
| 1995 |
% |
| 1996 |
% The code in \pkg{hyperref} inspects |\thepage| and tries to figure out |
| 1997 |
% the numbering system and the prefix. E.g. A-\arabic{page} is correctly split. |
| 1998 |
% If the counter can not be identified \pkg{hyperref} generates only /P entries with the |
| 1999 |
% whole content. |
| 2000 |
% |
| 2001 |
% The new implementation makes use of the pdf management: The relevant entry in the |
| 2002 |
% catalog is continuously updated and pushed out at the end of the document. |
| 2003 |
% This works (hopefully \ldots) with all drivers. |
| 2004 |
% |
| 2005 |
% We do not try to avoid the (in hyperref's wording) |
| 2006 |
% \enquote{useless} pagelabel entry |
| 2007 |
% |/PageLabels <</Nums[0<</S/D>>]>>| |
| 2008 |
% (but it would be possible), we also don't test for empty |\thepage|, |
| 2009 |
% \pkg{hyperref} seems to handle this fine and the pdf is valid. |
| 2010 |
% |
| 2011 |
% The code has to define |\Hy@PutCatalog| as we can't yet |
| 2012 |
% change code in hyperref. The switch for draftmode has been removed. |
| 2013 |
% |
| 2014 |
% \begin{macro}[no-user-doc] |
| 2015 |
% { |
| 2016 |
% \@@_PageLabels_gpush:, |
| 2017 |
% \Hy@PutCatalog, |
| 2018 |
% \HyPL@StorePageLabel |
| 2019 |
% } |
| 2020 |
% \begin{macrocode} |
| 2021 |
\cs_new_protected:Npn\@@_PageLabels_gpush: |
| 2022 |
{ |
| 2023 |
\pdfmanagement_add:nne {Catalog} {PageLabels}{<</Nums[\HyPL@Labels]>>} |
| 2024 |
} |
| 2025 |
|
| 2026 |
\def\Hy@PutCatalog #1 {} |
| 2027 |
|
| 2028 |
|
| 2029 |
\legacy_if:nT { Hy@pdfpagelabels } |
| 2030 |
{ |
| 2031 |
\cs_set_protected:Npn \HyPL@StorePageLabel #1 |
| 2032 |
{ |
| 2033 |
\tl_gput_right:Ne \HyPL@Labels { \the\Hy@abspage<<#1>> } |
| 2034 |
\@@_PageLabels_gpush: |
| 2035 |
} |
| 2036 |
} |
| 2037 |
% \end{macrocode} |
| 2038 |
% \end{macro} |
| 2039 |
% \section{Core Hyperref Commands} |
| 2040 |
% Every \pkg{hyperref} has to define eight core command: |
| 2041 |
% \begin{verbatim} |
| 2042 |
% \hyper@anchor |
| 2043 |
% \hyper@anchorstart |
| 2044 |
% \hyper@anchorend |
| 2045 |
% \hyper@link %GoTo |
| 2046 |
% \hyper@linkstart %GoTo |
| 2047 |
% \hyper@linkend %GoTo |
| 2048 |
% \hyper@linkfile %GoToR |
| 2049 |
% \hyper@linkurl %URI |
| 2050 |
% \end{verbatim} |
| 2051 |
% |
| 2052 |
% This driver defines for consistency also |
| 2053 |
% |\hyper@linklaunch| for Launch and |\hyper@linknamed| for Named. |
| 2054 |
% |
| 2055 |
% \subsection{Link level} |
| 2056 |
% Links can be nested. Inner links need perhaps special handling, e.g. |
| 2057 |
% to deactivate the link, or to change the border, or in the case of |
| 2058 |
% tagging to add some additional structure to handle the parent-child rules. |
| 2059 |
% We therefore add a global counter which is increased at the begin of |
| 2060 |
% link and decreased at the end. |
| 2061 |
% \begin{macro}{g_@@_linknestlevel_int} |
| 2062 |
% \begin{macrocode} |
| 2063 |
\int_new:N \g_@@_linknestlevel_int |
| 2064 |
% \end{macrocode} |
| 2065 |
% \end{macro} |
| 2066 |
% |
| 2067 |
% \begin{macrocode} |
| 2068 |
\prg_new_conditional:Npnn \@@_if_outer_link: {TF} |
| 2069 |
{ |
| 2070 |
\int_compare:nNnTF { \g_@@_linknestlevel_int } > {1} |
| 2071 |
{ \prg_return_false: } |
| 2072 |
{ \prg_return_true: } |
| 2073 |
} |
| 2074 |
% \end{macrocode} |
| 2075 |
|
| 2076 |
% \begin{macrocode} |
| 2077 |
\cs_new:Npn \@@_check_link_nesting:TF #1 #2 |
| 2078 |
{ |
| 2079 |
\use_i:nn {#1}{#2} |
| 2080 |
} |
| 2081 |
% \end{macrocode} |
| 2082 |
% |
| 2083 |
% \begin{macrocode} |
| 2084 |
\keys_define:nn { hyp } |
| 2085 |
{ |
| 2086 |
nested-links .choice:, |
| 2087 |
nested-links / true .code:n = |
| 2088 |
{ \cs_set_eq:NN \@@_check_link_nesting:TF \use_i:nn }, |
| 2089 |
nested-links / false .code:n = |
| 2090 |
{ \cs_set_eq:NN \@@_check_link_nesting:TF \@@_if_outer_link:TF }, |
| 2091 |
nested-links .default:n = {true} |
| 2092 |
} |
| 2093 |
% \end{macrocode} |
| 2094 |
% \subsection{ Anchors / destinations} |
| 2095 |
% The first three commands are needed for \enquote{anchors}. At first |
| 2096 |
% the internal commands to create a destination. It uses |
| 2097 |
% |\Hy@WrapperDef| to make it babel safe, it is not clear if this is |
| 2098 |
% still needed, but we leave if for now. |
| 2099 |
% \begin{function} { \@@_destination:nn } |
| 2100 |
% \begin{syntax} |
| 2101 |
% \cs{@@_destination:nn} \Arg{destination name} \Arg{location} |
| 2102 |
% \end{syntax} |
| 2103 |
% The \meta{destination name} is encoded with the method stored in |
| 2104 |
% in \cs{l_@@_text_enc_dest_tl}. The location should be one of |
| 2105 |
% |fit|, |fith|, |fitv|, |fitbv|, |fitbh|, |fitr|, |xyz|, |fitrbx|. |
| 2106 |
% The last will make use of \cs{l_@@_dest_box} |
| 2107 |
% \end{function} |
| 2108 |
% \begin{macro}{ \@@_destination:nn } |
| 2109 |
% \begin{macrocode} |
| 2110 |
\Hy@WrapperDef \@@_destination:nn #1 #2 |
| 2111 |
{ |
| 2112 |
\mode_if_horizontal:T { \@savsf\spacefactor } |
| 2113 |
\Hy@SaveLastskip %defined in hyperref |
| 2114 |
\Hy@VerboseAnchor{#1} %defined in hyperref, for debugging |
| 2115 |
\@@_text_pdfstring:noN |
| 2116 |
{ \HyperDestNameFilter{#1} } |
| 2117 |
{ \l_@@_text_enc_dest_tl } |
| 2118 |
\l_@@_tmpa_tl |
| 2119 |
\str_if_eq:nnTF {#2} {fitrbox} |
| 2120 |
{ |
| 2121 |
\exp_args:NV |
| 2122 |
\pdf_destination:nnnn \l_@@_tmpa_tl |
| 2123 |
{ \box_wd:N \l_@@_dest_box } |
| 2124 |
{ \box_ht:N \l_@@_dest_box } |
| 2125 |
{ \box_dp:N \l_@@_dest_box } |
| 2126 |
} |
| 2127 |
{ |
| 2128 |
\exp_args:NV |
| 2129 |
\pdf_destination:nf |
| 2130 |
{ \l_@@_tmpa_tl } |
| 2131 |
{ #2 } |
| 2132 |
} |
| 2133 |
\Hy@RestoreLastskip %defined in hyperref |
| 2134 |
\mode_if_horizontal:T { \spacefactor\@savsf } |
| 2135 |
} |
| 2136 |
% \end{macrocode} |
| 2137 |
% \end{macro} |
| 2138 |
% This are the three destinations commands. They are modelled along the |
| 2139 |
% xetex version. It is not quite clear if really all three |
| 2140 |
% are needed for the backends supported by this driver, but changing the hyperref |
| 2141 |
% code would be difficult. |
| 2142 |
% We add a hook. This allows e.g. the tagging code |
| 2143 |
% to create also a structured destination. |
| 2144 |
% We don't use the cmd hook, as we want the same hook for both start commands. |
| 2145 |
% We make the current dest name available so that the hook code can use it. |
| 2146 |
% \begin{macro}[no-user-doc] |
| 2147 |
% { |
| 2148 |
% \hyper@anchor, |
| 2149 |
% \hyper@anchorstart, |
| 2150 |
% \hyper@anchorend, |
| 2151 |
% hyp/anchor, |
| 2152 |
% \l_hyp_current_dest_name_tl |
| 2153 |
% } |
| 2154 |
% \begin{macrocode} |
| 2155 |
\tl_new:N\l_hyp_current_dest_name_tl |
| 2156 |
\hook_new:n{hyp/anchor} |
| 2157 |
\cs_new_protected:Npn \hyper@anchor #1 |
| 2158 |
{ |
| 2159 |
\exp_args:NnV |
| 2160 |
\@@_destination:nn {#1} \l_@@_dest_pdfview_tl |
| 2161 |
\tl_set:Nn \l_hyp_current_dest_name_tl {#1} |
| 2162 |
\hook_use:n{hyp/anchor} |
| 2163 |
} |
| 2164 |
|
| 2165 |
\cs_new_protected:Npn \hyper@anchorstart #1 |
| 2166 |
{ |
| 2167 |
\Hy@activeanchortrue |
| 2168 |
\exp_args:NnV |
| 2169 |
\@@_destination:nn {#1} \l_@@_dest_pdfview_tl |
| 2170 |
\tl_set:Nn \l_hyp_current_dest_name_tl {#1} |
| 2171 |
\hook_use:n{hyp/anchor} |
| 2172 |
} |
| 2173 |
|
| 2174 |
\cs_new_protected:Npn \hyper@anchorend |
| 2175 |
{ |
| 2176 |
\Hy@activeanchorfalse |
| 2177 |
} |
| 2178 |
% \end{macrocode} |
| 2179 |
% \end{macro} |
| 2180 |
% |
| 2181 |
% \subsection{GoTo Links} |
| 2182 |
% The next three commands are for links inside the document, |
| 2183 |
% to destinations (GoTo links). |
| 2184 |
% The definition in \pkg{hyperref} have a first argument which |
| 2185 |
% can be used to pass a semantical context. Currently this argument is |
| 2186 |
% only used for \cs{cite} and only to change the color. The new |
| 2187 |
% implementation uses it for a real hook. |
| 2188 |
% |
| 2189 |
% At first the internal link commands: |
| 2190 |
% \begin{macrocode} |
| 2191 |
\cs_new_protected:Npn \@@_link_goto_begin:nw #1 |
| 2192 |
{ |
| 2193 |
\mode_leave_vertical: |
| 2194 |
\protected@edef \l_@@_dest_name_tmpa_tl { #1 } |
| 2195 |
\tl_if_empty:NTF \l_@@_dest_name_tmpa_tl |
| 2196 |
{ |
| 2197 |
\msg_warning:nne |
| 2198 |
{ hyp } |
| 2199 |
{ empty-destination-name } |
| 2200 |
{ \c_@@_dest_undefined_tl } |
| 2201 |
\tl_set_eq:NN \l_@@_dest_name_tmpa_tl \c_@@_dest_undefined_tl |
| 2202 |
} |
| 2203 |
{ |
| 2204 |
\@@_text_pdfstring:eoN |
| 2205 |
{ \exp_args:No \HyperDestNameFilter { \l_@@_dest_name_tmpa_tl } } |
| 2206 |
{ \l_@@_text_enc_dest_tl } |
| 2207 |
\l_@@_dest_name_tmpa_tl |
| 2208 |
} |
| 2209 |
\exp_args:No |
| 2210 |
\pdfannot_link_goto_begin:nw { \l_@@_dest_name_tmpa_tl } |
| 2211 |
} |
| 2212 |
|
| 2213 |
\cs_new_protected:Npn \@@_link_goto_end: |
| 2214 |
{ |
| 2215 |
\pdfannot_link_goto_end: |
| 2216 |
} |
| 2217 |
% \end{macrocode} |
| 2218 |
% |
| 2219 |
% Now the three \pkg{hyperref} commands. |
| 2220 |
% The split commands \cs{hyper@linkstart} and \cs{hyper@linkend} are used for |
| 2221 |
% footnotemarks, toc and natbib-cites. |
| 2222 |
% \begin{function}{\hyper@link} |
| 2223 |
% \begin{syntax} |
| 2224 |
% \cs{hyper@link}\Arg{context}\Arg{destination name}\Arg{link text} |
| 2225 |
% \end{syntax} |
| 2226 |
% This creates a complete GoTo link around the \meta{link text} |
| 2227 |
% pointing to \meta{destination name}. |
| 2228 |
% The hook |hyp/link/|\meta{context} is executed at the begin if it exists. |
| 2229 |
% |
| 2230 |
% The only \meta{context} for which a hook is predefined is |cite|. |
| 2231 |
% Packages which want to use another \meta{context} should initialize the hook like |
| 2232 |
% this: |
| 2233 |
% \begin{verbatim} |
| 2234 |
% \IfHookExistsTF{hyp/link/context}{} |
| 2235 |
% {\NewHook{hyp/link/context}} |
| 2236 |
% \end{verbatim} |
| 2237 |
% |
| 2238 |
% The hook code is executed in a group but before all the pdfannot hooks. |
| 2239 |
% \end{function} |
| 2240 |
% \begin{function}{\hyper@linkstart,\hyper@linkend} |
| 2241 |
% \begin{syntax} |
| 2242 |
% \cs{hyper@linkstart}\Arg{context}\Arg{destination name}\\ |
| 2243 |
% \cs{hyper@linkend} |
| 2244 |
% \end{syntax} |
| 2245 |
% This creates the start and end commands for a GoTo link around the text |
| 2246 |
% between both pointing to \meta{destination name}. |
| 2247 |
% The hook |hyp/link/|\meta{context} is executed at the begin if it exists |
| 2248 |
% as with \cs{hyper@link} |
| 2249 |
% |
| 2250 |
% The commands open and close a group, so should be placed carefully. . |
| 2251 |
% \end{function} |
| 2252 |
|
| 2253 |
% \pkg{hyperref} adds a group with \cs{Hy@colorlink}, we move this outside the link |
| 2254 |
% so that it groups the context hook too. We store again the destination name in the |
| 2255 |
% public tl |\l_hyp_current_dest_name_tl| so that the hook code can make use of |
| 2256 |
% it |
| 2257 |
% \begin{macrocode} |
| 2258 |
\cs_set_protected:Npn \hyper@link #1 #2 #3 %#1 context, #2=destination name, #3 content |
| 2259 |
{ |
| 2260 |
\bool_if:NTF \l_@@_annot_GoTo_bool |
| 2261 |
{ |
| 2262 |
\int_gincr:N\g_@@_linknestlevel_int |
| 2263 |
\@@_check_link_nesting:TF |
| 2264 |
{ |
| 2265 |
\Hy@VerboseLinkStart{#1}{#2} |
| 2266 |
\group_begin: |
| 2267 |
\tl_set:Nn \l_hyp_current_dest_name_tl {#2} |
| 2268 |
% \end{macrocode} |
| 2269 |
% this socket adds something to the /Contents key. |
| 2270 |
% \begin{macrocode} |
| 2271 |
\socket_use:nnn{hyp/link/GoTo/Contents}{#2}{#3} |
| 2272 |
\hook_use:n {hyp/link/#1} |
| 2273 |
\@@_link_goto_begin:nw {#2}#3\Hy@xspace@end |
| 2274 |
\@@_link_goto_end: |
| 2275 |
\group_end: |
| 2276 |
\Hy@VerboseLinkStop |
| 2277 |
} |
| 2278 |
{ |
| 2279 |
\group_begin: #3\group_end: |
| 2280 |
} |
| 2281 |
\int_gdecr:N\g_@@_linknestlevel_int |
| 2282 |
} |
| 2283 |
{{\let\protect\relax#3}} |
| 2284 |
} |
| 2285 |
\cs_set_protected:Npn \hyper@linkstart #1 #2 %#1 context, #2=destination name |
| 2286 |
{ |
| 2287 |
\bool_if:NT \l_@@_annot_GoTo_bool |
| 2288 |
{ |
| 2289 |
\int_gincr:N\g_@@_linknestlevel_int |
| 2290 |
\@@_check_link_nesting:TF |
| 2291 |
{ |
| 2292 |
\Hy@VerboseLinkStart{#1}{#2}% only for debug |
| 2293 |
\group_begin: |
| 2294 |
\tl_set:Nn \l_hyp_current_dest_name_tl {#2} |
| 2295 |
\socket_use:nnn{hyp/link/GoTo/Contents}{#2}{} |
| 2296 |
\hook_use:n {hyp/link/#1} |
| 2297 |
\@@_link_goto_begin:nw {#2} |
| 2298 |
} |
| 2299 |
{ |
| 2300 |
\group_begin: |
| 2301 |
} |
| 2302 |
} |
| 2303 |
} |
| 2304 |
\cs_set_protected:Npn \hyper@linkend |
| 2305 |
{ |
| 2306 |
\bool_if:NT \l_@@_annot_GoTo_bool |
| 2307 |
{ |
| 2308 |
\@@_check_link_nesting:TF |
| 2309 |
{ |
| 2310 |
\@@_link_goto_end: |
| 2311 |
\group_end: |
| 2312 |
\Hy@VerboseLinkStop |
| 2313 |
} |
| 2314 |
{ |
| 2315 |
\group_end: |
| 2316 |
} |
| 2317 |
\int_gdecr:N\g_@@_linknestlevel_int |
| 2318 |
} |
| 2319 |
} |
| 2320 |
% \end{macrocode} |
| 2321 |
% |
| 2322 |
% \subsection{URI links} |
| 2323 |
% We define a dictionary for the action dictionary. For now it is public. |
| 2324 |
% \begin{macrocode} |
| 2325 |
\pdfdict_new:n {l_hyp/annot/A/URI} |
| 2326 |
\pdfdict_put:nnn {l_hyp/annot/A/URI}{Type}{/Action} |
| 2327 |
\pdfdict_put:nnn {l_hyp/annot/A/URI}{S}{/URI} |
| 2328 |
|
| 2329 |
\cs_new_protected:Npn \hyper@linkurl #1 #2 %#1:link text #2: URI, |
| 2330 |
{ |
| 2331 |
\bool_if:NTF \l_@@_annot_URI_bool |
| 2332 |
{ |
| 2333 |
\int_gincr:N\g_@@_linknestlevel_int |
| 2334 |
\@@_check_link_nesting:TF |
| 2335 |
{ |
| 2336 |
\group_begin: |
| 2337 |
\@@_text_pdfstring:noN {#2}{ \l_@@_text_enc_uri_print_tl }\l_@@_uri_tmpa_tl |
| 2338 |
\pdfdict_put:nno{l_hyp/annot/A/URI}{URI}{\l_@@_uri_tmpa_tl} |
| 2339 |
\bool_if:NT \l_@@_href_url_ismap_bool |
| 2340 |
{ |
| 2341 |
\pdfdict_put:nnn{l_hyp/annot/A/URI}{IsMap}{true} |
| 2342 |
} |
| 2343 |
% \end{macrocode} |
| 2344 |
% This socket adds something to the /Contents key. |
| 2345 |
% \begin{macrocode} |
| 2346 |
\socket_use:nn{hyp/link/URI/Contents}{#2} |
| 2347 |
\cs_set_eq:NN \# \c_hash_str |
| 2348 |
\cs_set_eq:NN \% \c_percent_str |
| 2349 |
\Hy@safe@activestrue |
| 2350 |
\mode_leave_vertical: |
| 2351 |
\pdfannot_dict_put:nne {link/URI}{A}{<<\pdfdict_use:n {l_hyp/annot/A/URI}>>} |
| 2352 |
\pdfannot_link:nen { URI } |
| 2353 |
{ |
| 2354 |
} |
| 2355 |
{ |
| 2356 |
\let\protect\relax |
| 2357 |
#1 |
| 2358 |
\Hy@xspace@end |
| 2359 |
\Hy@VerboseLinkStop %where is the start?? |
| 2360 |
} |
| 2361 |
\group_end: |
| 2362 |
} |
| 2363 |
{ |
| 2364 |
\group_begin: #1 \group_end: |
| 2365 |
} |
| 2366 |
\int_gdecr:N\g_@@_linknestlevel_int |
| 2367 |
} |
| 2368 |
{{\let\protect\relax#1}} |
| 2369 |
} |
| 2370 |
|
| 2371 |
% \end{macrocode} |
| 2372 |
% \subsection{GoToR Links {files}} |
| 2373 |
% \begin{macrocode} |
| 2374 |
\pdfdict_new:n {l_hyp/annot/A/GoToR} |
| 2375 |
\pdfdict_put:nnn {l_hyp/annot/A/GoToR}{Type}{/Action} |
| 2376 |
\pdfdict_put:nnn {l_hyp/annot/A/GoToR}{S}{/GoToR} |
| 2377 |
|
| 2378 |
\cs_generate_variant:Nn \pdffile_embed_file:nnn {noe} |
| 2379 |
\cs_new_protected:Npn \hyper@linkfile #1 #2 #3 % link text, filename, destname |
| 2380 |
{ |
| 2381 |
\bool_if:NTF \l_@@_annot_GoToR_bool |
| 2382 |
{ |
| 2383 |
\int_gincr:N\g_@@_linknestlevel_int |
| 2384 |
\@@_check_link_nesting:TF |
| 2385 |
{ |
| 2386 |
\group_begin: |
| 2387 |
\tl_set:Ne \l_@@_filename_tmpa_tl { \text_expand:n { #2 } } |
| 2388 |
\exp_args:Ne |
| 2389 |
\pdf_object_if_exist:nF { @@_file_\tl_to_str:N \l_@@_filename_tmpa_tl } |
| 2390 |
{ |
| 2391 |
\pdfdict_put:nne { l_pdffile/Filespec}{Subtype}{\pdf_name_from_unicode_e:n {application/pdf}} |
| 2392 |
\pdffile_embed_file:noe |
| 2393 |
{} |
| 2394 |
{\l_@@_filename_tmpa_tl } |
| 2395 |
{@@_file_\tl_to_str:N \l_@@_filename_tmpa_tl } |
| 2396 |
} |
| 2397 |
\pdfdict_put:nne |
| 2398 |
{l_hyp/annot/A/GoToR} |
| 2399 |
{F} |
| 2400 |
{\pdf_object_ref:e {@@_file_\tl_to_str:N \l_@@_filename_tmpa_tl}} |
| 2401 |
\@@_text_pdfstring:noN |
| 2402 |
{ #3 } |
| 2403 |
{ \l_@@_text_enc_dest_print_tl } |
| 2404 |
\l_@@_dest_name_tmpa_tl |
| 2405 |
% \end{macrocode} |
| 2406 |
% This socket adds something to the /Contents key. |
| 2407 |
% \begin{macrocode} |
| 2408 |
\socket_use:nn{hyp/link/GoToR/Contents}{#2} |
| 2409 |
\tl_if_blank:eTF {#3} |
| 2410 |
{ |
| 2411 |
\pdfdict_put:nne {l_hyp/annot/A/GoToR}{D} |
| 2412 |
{ |
| 2413 |
[ |
| 2414 |
\int_eval:n |
| 2415 |
{ \int_max:nn {0}{ 0\l_@@_href_pdf_page_tl - 1 }} |
| 2416 |
/\l_@@_dest_pdfremotestartview_tl |
| 2417 |
] |
| 2418 |
} |
| 2419 |
} |
| 2420 |
{ |
| 2421 |
\pdfdict_put:nno {l_hyp/annot/A/GoToR}{D}{\l_@@_dest_name_tmpa_tl} |
| 2422 |
} |
| 2423 |
\mode_leave_vertical: |
| 2424 |
% \end{macrocode} |
| 2425 |
% We use an extra object here, as ghostscript doesn't like the |
| 2426 |
% object reference in the dict |
| 2427 |
% \url{https://chat.stackexchange.com/transcript/message/57361080#57361080} |
| 2428 |
% \begin{macrocode} |
| 2429 |
\pdf_object_unnamed_write:ne{dict}{\pdfdict_use:n {l_hyp/annot/A/GoToR}} |
| 2430 |
\pdfannot_dict_put:nne {link/GoToR}{A}{\pdf_object_ref_last:} |
| 2431 |
\pdfannot_link:nnn %expansion?? |
| 2432 |
{ GoToR } |
| 2433 |
{ |
| 2434 |
} |
| 2435 |
{ |
| 2436 |
\let\protect\relax |
| 2437 |
#1\Hy@xspace@end |
| 2438 |
\Hy@VerboseLinkStop %where is the start?? |
| 2439 |
} |
| 2440 |
\group_end: |
| 2441 |
} |
| 2442 |
{ |
| 2443 |
\group_begin: #1 \group_end: |
| 2444 |
} |
| 2445 |
\int_gdecr:N\g_@@_linknestlevel_int |
| 2446 |
} |
| 2447 |
{{\let\protect\relax#1}} |
| 2448 |
} |
| 2449 |
% \end{macrocode} |
| 2450 |
% |
| 2451 |
% \subsection{Launch links} |
| 2452 |
% |
| 2453 |
% We define \cs{hyper@linklaunch} for naming consistency |
| 2454 |
% \begin{macrocode} |
| 2455 |
\pdfdict_new:n {l_hyp/annot/A/Launch} |
| 2456 |
\pdfdict_put:nnn {l_hyp/annot/A/Launch}{Type}{/Action} |
| 2457 |
\pdfdict_put:nnn {l_hyp/annot/A/Launch}{S}{/Launch} |
| 2458 |
|
| 2459 |
\cs_new_protected:Npn \hyper@linklaunch #1 #2 #3 % filename, link text, Parameters |
| 2460 |
{ |
| 2461 |
\bool_if:NTF \l_@@_annot_Launch_bool |
| 2462 |
{ |
| 2463 |
\int_gincr:N\g_@@_linknestlevel_int |
| 2464 |
\@@_check_link_nesting:TF |
| 2465 |
{ |
| 2466 |
\group_begin: |
| 2467 |
\@@_text_pdfstring:noN |
| 2468 |
{ #1 } |
| 2469 |
{ \l_@@_text_enc_file_print_tl } |
| 2470 |
\l_@@_filename_tmpa_tl |
| 2471 |
\pdfdict_put:nno {l_hyp/annot/A/Launch}{F}{\l_@@_filename_tmpa_tl} |
| 2472 |
\@@_text_pdfstring:noN |
| 2473 |
{ #3 } |
| 2474 |
{ \l_@@_text_enc_para_print_tl } |
| 2475 |
\l_@@_para_tmpa_tl |
| 2476 |
\bool_if:nTF |
| 2477 |
{ |
| 2478 |
\str_if_eq_p:Vn \l_@@_para_tmpa_tl {()} |
| 2479 |
|| |
| 2480 |
\pdf_version_compare_p:Nn > {1.9} |
| 2481 |
} |
| 2482 |
{ |
| 2483 |
\pdfdict_remove:nn {l_hyp/annot/A/Launch}{Win} |
| 2484 |
} |
| 2485 |
{ |
| 2486 |
\pdfdict_put:nne |
| 2487 |
{l_hyp/annot/A/Launch} |
| 2488 |
{Win} |
| 2489 |
{<</P \l_@@_para_tmpa_tl /F \l_@@_filename_tmpa_tl >>} |
| 2490 |
} |
| 2491 |
\mode_leave_vertical: |
| 2492 |
\pdfannot_dict_put:nne {link/Launch}{A}{<<\pdfdict_use:n {l_hyp/annot/A/Launch}>>} |
| 2493 |
\pdfannot_link:nen |
| 2494 |
{ Launch } |
| 2495 |
{ |
| 2496 |
% /A |
| 2497 |
% << |
| 2498 |
% \pdfdict_use:n {l_hyp/annot/A/Launch} |
| 2499 |
% >> |
| 2500 |
} |
| 2501 |
{ |
| 2502 |
\let\protect\relax |
| 2503 |
#2\Hy@xspace@end |
| 2504 |
\Hy@VerboseLinkStop %where is the start?? |
| 2505 |
} |
| 2506 |
\group_end: |
| 2507 |
} |
| 2508 |
{ \group_begin: #2 \group_end: } |
| 2509 |
\int_gdecr:N\g_@@_linknestlevel_int |
| 2510 |
} |
| 2511 |
{{\let\protect\relax#2}} |
| 2512 |
} |
| 2513 |
% \end{macrocode} |
| 2514 |
% The actually command used by \pkg{hyperref} is \cs{@hyper@launch} which uses a delimited |
| 2515 |
% argument, because of the color the definition is a bit convoluted. |
| 2516 |
% \begin{macrocode} |
| 2517 |
\use:e |
| 2518 |
{ % filename, anchor text, linkname |
| 2519 |
\cs_set_protected:Npn \exp_not:N \@hyper@launch run \c_colon_str #1 \exp_not:N \\ #2 #3 |
| 2520 |
} |
| 2521 |
{ |
| 2522 |
\hyper@linklaunch {#1}{#2}{#3} |
| 2523 |
} |
| 2524 |
% \end{macrocode} |
| 2525 |
% |
| 2526 |
% \subsection{Named links (menu)} |
| 2527 |
% We also define \cs{hyper@linknamed} for consistency. |
| 2528 |
% \begin{macrocode} |
| 2529 |
\pdfdict_new:n {l_hyp/annot/A/Named} |
| 2530 |
\pdfdict_put:nnn {l_hyp/annot/A/Named}{Type}{/Action} |
| 2531 |
\pdfdict_put:nnn {l_hyp/annot/A/Named}{S}{/Named} |
| 2532 |
|
| 2533 |
\cs_new_protected:Npn \hyper@linknamed #1 #2 %#1 action, #2 link text |
| 2534 |
{ |
| 2535 |
\bool_if:NTF \l_@@_annot_Named_bool |
| 2536 |
{ |
| 2537 |
\int_gincr:N\g_@@_linknestlevel_int |
| 2538 |
\@@_check_link_nesting:TF |
| 2539 |
{ |
| 2540 |
\group_begin: |
| 2541 |
\pdfmeta_standard_verify:nnTF {named_actions}{#1} |
| 2542 |
{ |
| 2543 |
\mode_leave_vertical: |
| 2544 |
\pdfdict_put:nne {l_hyp/annot/A/Named}{N} |
| 2545 |
{\pdf_name_from_unicode_e:n{#1}} |
| 2546 |
\pdfannot_dict_put:nne {link/Named}{A}{<<\pdfdict_use:n {l_hyp/annot/A/Named}>>} |
| 2547 |
\pdfannot_link:nnn { Named } |
| 2548 |
{ |
| 2549 |
% /A |
| 2550 |
% << |
| 2551 |
% \pdfdict_use:n { l_hyp/annot/A/Named } |
| 2552 |
% >> |
| 2553 |
} |
| 2554 |
{ |
| 2555 |
#2 |
| 2556 |
\Hy@xspace@end |
| 2557 |
\Hy@VerboseLinkStop |
| 2558 |
} |
| 2559 |
} |
| 2560 |
{ |
| 2561 |
\msg_warning:nnn { hyp } { pdfa-no-named-action }{#1} |
| 2562 |
#2 |
| 2563 |
} |
| 2564 |
\group_end: |
| 2565 |
} |
| 2566 |
{ \group_begin: #2 \group_end: } |
| 2567 |
\int_gdecr:N\g_@@_linknestlevel_int |
| 2568 |
} |
| 2569 |
{{\let\protect\relax#2}} |
| 2570 |
} |
| 2571 |
|
| 2572 |
% \end{macrocode} |
| 2573 |
% |
| 2574 |
% \section{Link decorations} |
| 2575 |
% \subsection{Functions to export and select colors} |
| 2576 |
% We support two input syntax: color expressions and model with values. |
| 2577 |
% Exporting can be done by first setting the color with \cs{@@_color_set:nn} |
| 2578 |
% (if needed to a temporary color name) |
| 2579 |
% and then using \cs{color_export:nnN}. But we need a variant as the export |
| 2580 |
% format |space-sep-cmyk| or |space-sep-rgb| is stored in a tl. |
| 2581 |
% \begin{macrocode} |
| 2582 |
\cs_generate_variant:Nn \color_export:nnN {nVN} |
| 2583 |
% \end{macrocode} |
| 2584 |
% |
| 2585 |
% \begin{function}{\@@_color_select:n} |
| 2586 |
% \begin{syntax} |
| 2587 |
% \cs{@@_color_select:n} \Arg{color} \\ |
| 2588 |
% \end{syntax} |
| 2589 |
% These commands select a (text) color. |
| 2590 |
% \Arg{color} should have either the format |[model]{value}| or be a color expression. |
| 2591 |
% For examples: |[rgb]{1,0,.5}| or |red!50!blue| |
| 2592 |
% \end{function} |
| 2593 |
% \begin{macro}{\@@_color_select:n,\@@_color_select_aux:wn} |
| 2594 |
% Color keys need to parse color expressions. Two input types are supported: |
| 2595 |
% |color=[rgb]{1,0,.5}| and |color=red!50!blue|. |
| 2596 |
% \begin{macrocode} |
| 2597 |
\cs_new_protected:Npn \@@_color_select:n #1 |
| 2598 |
{ |
| 2599 |
\tl_if_head_eq_charcode:nNTF {#1}[ %] |
| 2600 |
{ |
| 2601 |
\@@_color_select_aux:wn #1 |
| 2602 |
} |
| 2603 |
{ |
| 2604 |
\color_select:n {#1} |
| 2605 |
} |
| 2606 |
} |
| 2607 |
|
| 2608 |
\cs_new_protected:Npn \@@_color_select_aux:wn [#1] #2 |
| 2609 |
{ |
| 2610 |
\color_select:nn {#1}{#2} |
| 2611 |
} |
| 2612 |
|
| 2613 |
\cs_generate_variant:Nn \@@_color_select:n {e} |
| 2614 |
% \end{macrocode} |
| 2615 |
% \end{macro} |
| 2616 |
% |
| 2617 |
% \begin{function}{\@@_color_set:nn} |
| 2618 |
% \begin{syntax} |
| 2619 |
% \cs{@@_color_set:nn} \Arg{ name } \Arg{color} \\ |
| 2620 |
% \end{syntax} |
| 2621 |
% These commands store the color in \Arg{name}. |
| 2622 |
% \Arg{color} should have either the format |[model]{value}| or be a color expression. |
| 2623 |
% For examples: |[rgb]{1,0,.5}| or |red!50!blue| |
| 2624 |
% \end{function} |
| 2625 |
% \begin{macro}{\@@_color_set:nn,\@@_color_set_aux:nwn} |
| 2626 |
% Color keys need to parse color expressions. Two input types are supported: |
| 2627 |
% |color=[rgb]{1,0,.5}| and |color=red!50!blue|. |
| 2628 |
% \begin{macrocode} |
| 2629 |
\cs_new_protected:Npn \@@_color_set:nn #1 #2 |
| 2630 |
{ |
| 2631 |
\tl_if_head_eq_charcode:nNTF {#2}[ %] |
| 2632 |
{ |
| 2633 |
\@@_color_set_aux:nwn { #1 } #2 |
| 2634 |
} |
| 2635 |
{ |
| 2636 |
\color_set:nn {#1} {#2} |
| 2637 |
} |
| 2638 |
} |
| 2639 |
|
| 2640 |
\cs_new_protected:Npn \@@_color_set_aux:nwn #1 [#2] #3 |
| 2641 |
{ |
| 2642 |
\color_set:nnn {#1}{#2}{#3} |
| 2643 |
} |
| 2644 |
|
| 2645 |
\cs_generate_variant:Nn \@@_color_set:nn {ne} |
| 2646 |
% \end{macrocode} |
| 2647 |
% \end{macro} |
| 2648 |
% \subsection{Textcolor of links} |
| 2649 |
% colors are added in the hooks. This means that they can also be removed if needed. |
| 2650 |
% They add a group---this isn't needed with \pkg{hyperref} code, but could be relevant |
| 2651 |
% with low-level annotations. |
| 2652 |
% \begin{macrocode} |
| 2653 |
\prop_map_inline:Nn \c_@@_map_hyp_annot_prop |
| 2654 |
{ |
| 2655 |
\hook_gput_code:nnn |
| 2656 |
{pdfannot/link/#2/begin} |
| 2657 |
{hyp/color} |
| 2658 |
{ |
| 2659 |
\bool_if:cT { l_hyp_annot_color#1_bool } |
| 2660 |
{ |
| 2661 |
\group_begin: |
| 2662 |
\color_select:n { hyp/color/#1} |
| 2663 |
} |
| 2664 |
} |
| 2665 |
\hook_gput_code:nnn |
| 2666 |
{pdfannot/link/#2/end} |
| 2667 |
{hyp/color} |
| 2668 |
{ |
| 2669 |
\bool_if:cT { l_hyp_annot_color#1_bool } |
| 2670 |
{ |
| 2671 |
\group_end: |
| 2672 |
} |
| 2673 |
} |
| 2674 |
} |
| 2675 |
% \end{macrocode} |
| 2676 |
% |
| 2677 |
% \begin{hypkey}{colorlinks} |
| 2678 |
% This key also resets the border and borderstyle. |
| 2679 |
% \begin{macrocode} |
| 2680 |
\keys_define:nn { hyp } |
| 2681 |
{ |
| 2682 |
,colorlinks .choice: |
| 2683 |
,colorlinks / true .meta:n = |
| 2684 |
{ |
| 2685 |
,pdfborder={0~0~0} |
| 2686 |
,pdfborderstyle= |
| 2687 |
,colorurl =#1 |
| 2688 |
,colorlink =#1 |
| 2689 |
,colorrun =#1 |
| 2690 |
,colormenu =#1 |
| 2691 |
,colorfile =#1 |
| 2692 |
} |
| 2693 |
,colorlinks / false .meta:n = |
| 2694 |
{ |
| 2695 |
,colorurl =#1 |
| 2696 |
,colorlink =#1 |
| 2697 |
,colorrun =#1 |
| 2698 |
,colormenu =#1 |
| 2699 |
,colorfile =#1 |
| 2700 |
} |
| 2701 |
,colorlinks .default:n = {true} |
| 2702 |
} |
| 2703 |
% \end{macrocode} |
| 2704 |
% \end{hypkey} |
| 2705 |
% \begin{hypkey}{colorurl,colorlink,colorrun,colormenu,colorfile} |
| 2706 |
% \begin{hypkey}{urlcolor,linkcolor,runcolor,menucolor,filecolor} |
| 2707 |
% \begin{hypkey}{allcolors} |
| 2708 |
% \begin{macrocode} |
| 2709 |
\seq_map_inline:Nn \c_@@_annot_types_seq |
| 2710 |
{ |
| 2711 |
\keys_define:nn { hyp } |
| 2712 |
{ |
| 2713 |
,color#1 .bool_set:c = { l_hyp_annot_color#1_bool } |
| 2714 |
,#1color .code:n = { \@@_color_set:ne {hyp/color/#1}{##1} } |
| 2715 |
} |
| 2716 |
} |
| 2717 |
|
| 2718 |
\keys_define:nn { hyp } |
| 2719 |
{ |
| 2720 |
,allcolors .meta:n = |
| 2721 |
{ |
| 2722 |
,urlcolor=#1 |
| 2723 |
,linkcolor=#1 |
| 2724 |
,runcolor=#1 |
| 2725 |
,filecolor=#1 |
| 2726 |
,menucolor=#1 |
| 2727 |
} |
| 2728 |
,allcolors .value_required:n = true |
| 2729 |
} |
| 2730 |
% \end{macrocode} |
| 2731 |
% \end{hypkey} |
| 2732 |
% \end{hypkey} |
| 2733 |
% \end{hypkey} |
| 2734 |
% \subsection{Style and color of borders} |
| 2735 |
% \subsubsection{Border color} |
| 2736 |
% The border color is set by link type. The color can be set as rgb (default) |
| 2737 |
% or cmyk (unusual). This can be set with the |bordercolormodel| key: |
| 2738 |
%\begin{hypkey}{bordercolormodel} |
| 2739 |
% \begin{macrocode} |
| 2740 |
\keys_define:nn { hyp } |
| 2741 |
{ |
| 2742 |
,bordercolormodel .choices:nn = |
| 2743 |
{rgb,cmyk} |
| 2744 |
{ \str_gset:Nn \g_@@_bordercolormodel_str {space-sep-#1}} |
| 2745 |
,bordercolormodel .initial:n ={rgb} |
| 2746 |
} |
| 2747 |
% \end{macrocode} |
| 2748 |
% \end{hypkey} |
| 2749 |
% \begin{macrocode} |
| 2750 |
\prop_map_inline:Nn \c_@@_map_hyp_annot_prop |
| 2751 |
{ |
| 2752 |
\keys_define:nn { hyp } |
| 2753 |
{ |
| 2754 |
#1bordercolor .code:n = |
| 2755 |
{ |
| 2756 |
\tl_if_empty:nTF { ##1 } |
| 2757 |
{ |
| 2758 |
\pdfannot_dict_remove:nn |
| 2759 |
{link/#2} |
| 2760 |
{ C } |
| 2761 |
} |
| 2762 |
{ |
| 2763 |
\@@_color_set:ne {hyp/color/#1border}{##1} |
| 2764 |
\color_export:nVN |
| 2765 |
{hyp/color/#1border} |
| 2766 |
\g_@@_bordercolormodel_str |
| 2767 |
\l_@@_tmpa_tl |
| 2768 |
\pdfannot_dict_put:nne |
| 2769 |
{link/#2} |
| 2770 |
{ C } |
| 2771 |
{ [\l_@@_tmpa_tl] } |
| 2772 |
} |
| 2773 |
} |
| 2774 |
} |
| 2775 |
} |
| 2776 |
|
| 2777 |
\keys_define:nn { hyp } |
| 2778 |
{ |
| 2779 |
,allbordercolors .meta:n = |
| 2780 |
{ |
| 2781 |
,linkbordercolor=#1 |
| 2782 |
,urlbordercolor =#1 |
| 2783 |
,filebordercolor=#1 |
| 2784 |
,menubordercolor=#1 |
| 2785 |
,runbordercolor =#1 |
| 2786 |
} |
| 2787 |
,allbordercolors .value_required:n = true |
| 2788 |
} |
| 2789 |
|
| 2790 |
% \end{macrocode} |
| 2791 |
% |
| 2792 |
% \subsubsection{Borderwidth and -arc} |
| 2793 |
% |
| 2794 |
% \begin{macrocode} |
| 2795 |
\prop_map_inline:Nn \c_@@_map_hyp_annot_prop |
| 2796 |
{ |
| 2797 |
\keys_define:nn { hyp } |
| 2798 |
{ |
| 2799 |
#1border .code:n = |
| 2800 |
{ |
| 2801 |
\tl_if_empty:nTF { ##1 } |
| 2802 |
{ |
| 2803 |
\pdfannot_dict_remove:nn |
| 2804 |
{link/#2} |
| 2805 |
{ Border } |
| 2806 |
} |
| 2807 |
{ |
| 2808 |
\pdfannot_dict_put:nnn |
| 2809 |
{link/#2} |
| 2810 |
{ Border } |
| 2811 |
{ [##1] } |
| 2812 |
} |
| 2813 |
} |
| 2814 |
} |
| 2815 |
} |
| 2816 |
\keys_define:nn { hyp } |
| 2817 |
{ |
| 2818 |
,pdfborder .code:n = |
| 2819 |
{ |
| 2820 |
\tl_if_empty:nTF { #1 } |
| 2821 |
{ |
| 2822 |
\prop_map_inline:Nn \c_@@_map_hyp_annot_prop |
| 2823 |
{ |
| 2824 |
\pdfannot_dict_remove:nn |
| 2825 |
{link/##2} |
| 2826 |
{ Border } |
| 2827 |
} |
| 2828 |
} |
| 2829 |
{ |
| 2830 |
\prop_map_inline:Nn \c_@@_map_hyp_annot_prop |
| 2831 |
{ |
| 2832 |
\pdfannot_dict_put:nnn |
| 2833 |
{link/##2} |
| 2834 |
{ Border } |
| 2835 |
{ [#1] } |
| 2836 |
} |
| 2837 |
} |
| 2838 |
} |
| 2839 |
,pdfborder .initial:n = {0~0~1}, |
| 2840 |
} |
| 2841 |
% \end{macrocode} |
| 2842 |
% \subsubsection{Borderstyle} |
| 2843 |
% This keys fill the extended /BS entry (a dictionary). |
| 2844 |
% \begin{hypkey}{pdfborderstyle,urlborderstyle,linkborderstyle, |
| 2845 |
% runborderstyle,fileborderstyle, |
| 2846 |
% menuborderstyle} |
| 2847 |
% \begin{macrocode} |
| 2848 |
\prop_map_inline:Nn \c_@@_map_hyp_annot_prop |
| 2849 |
{ |
| 2850 |
\keys_define:nn { hyp } |
| 2851 |
{ |
| 2852 |
#1borderstyle .code:n = |
| 2853 |
{ |
| 2854 |
\tl_if_empty:nTF { ##1 } |
| 2855 |
{ |
| 2856 |
\pdfannot_dict_remove:nn |
| 2857 |
{link/#2} |
| 2858 |
{ BS } |
| 2859 |
} |
| 2860 |
{ |
| 2861 |
\pdfannot_dict_put:nnn |
| 2862 |
{link/#2} |
| 2863 |
{ BS } |
| 2864 |
{ <<##1>> } |
| 2865 |
} |
| 2866 |
} |
| 2867 |
} |
| 2868 |
} |
| 2869 |
\keys_define:nn { hyp } |
| 2870 |
{ |
| 2871 |
,pdfborderstyle .code:n = |
| 2872 |
{ |
| 2873 |
\tl_if_empty:nTF { #1 } |
| 2874 |
{ |
| 2875 |
\prop_map_inline:Nn \c_@@_map_hyp_annot_prop |
| 2876 |
{ |
| 2877 |
\pdfannot_dict_remove:nn |
| 2878 |
{link/##2} |
| 2879 |
{ BS } |
| 2880 |
} |
| 2881 |
} |
| 2882 |
{ |
| 2883 |
\prop_map_inline:Nn \c_@@_map_hyp_annot_prop |
| 2884 |
{ |
| 2885 |
\pdfannot_dict_put:nnn |
| 2886 |
{link/##2} |
| 2887 |
{ BS } |
| 2888 |
{ <<#1>> } |
| 2889 |
} |
| 2890 |
} |
| 2891 |
} |
| 2892 |
,pdfborderstyle .initial:n = {}, |
| 2893 |
} |
| 2894 |
% \end{macrocode} |
| 2895 |
% \end{hypkey} |
| 2896 |
% \subsection{ocgcolorlinks} |
| 2897 |
% OCG colorlinks need objects and an entry in the catalog. |
| 2898 |
% Perhaps the objects need public names to avoid that ocgx2 has to create |
| 2899 |
% duplicates? |
| 2900 |
% TODO |
| 2901 |
% \begin{macro}{\@@_ocg_init:} |
| 2902 |
% This commands write the objects as needed if ocg links are used. |
| 2903 |
% The initialization should happens only once. |
| 2904 |
% \begin{macrocode} |
| 2905 |
\cs_new_protected:Npn \@@_ocg_init: |
| 2906 |
{ |
| 2907 |
\pdf_object_new:n { @@/OCG/View } |
| 2908 |
\pdf_object_new:n { @@/OCG/Print } |
| 2909 |
\pdf_object_new:n { @@/OCG/config } |
| 2910 |
\pdf_object_new:n { @@/OCG/refarray } |
| 2911 |
\pdf_object_write:nne { @@/OCG/refarray } { array } |
| 2912 |
{ |
| 2913 |
\pdf_object_ref:n { @@/OCG/View } |
| 2914 |
\c_space_tl |
| 2915 |
\pdf_object_ref:n { @@/OCG/Print } |
| 2916 |
} |
| 2917 |
\pdf_object_write:nnn { @@/OCG/View } { dict } |
| 2918 |
{ |
| 2919 |
/Type/OCG |
| 2920 |
/Name(View) |
| 2921 |
/Usage |
| 2922 |
<< |
| 2923 |
/Print <</PrintState/OFF>>~ |
| 2924 |
/View <</ViewState/ON >>~ |
| 2925 |
>> |
| 2926 |
} |
| 2927 |
\pdf_object_write:nnn { @@/OCG/Print } { dict } |
| 2928 |
{ |
| 2929 |
/Type/OCG |
| 2930 |
/Name(Print) |
| 2931 |
/Usage |
| 2932 |
<< |
| 2933 |
/Print <</PrintState/ON>>~ |
| 2934 |
/View <</ViewState/OFF>>~ |
| 2935 |
>> |
| 2936 |
} |
| 2937 |
\pdfmanagement_add:nne { Catalog / OCProperties }{OCGs }{ \pdf_object_ref:n {@@/OCG/View} } |
| 2938 |
\pdfmanagement_add:nne { Catalog / OCProperties }{OCGs }{ \pdf_object_ref:n {@@/OCG/Print} } |
| 2939 |
\pdf_object_write:nne { @@/OCG/config } { dict } |
| 2940 |
{ |
| 2941 |
/OFF[\pdf_object_ref:n { @@/OCG/Print }] |
| 2942 |
/AS[ |
| 2943 |
<< |
| 2944 |
/Event/View |
| 2945 |
/OCGs\c_space_tl \pdf_object_ref:n { @@/OCG/refarray } |
| 2946 |
/Category[/View] |
| 2947 |
>> |
| 2948 |
<< |
| 2949 |
/Event/Print |
| 2950 |
/OCGs\c_space_tl \pdf_object_ref:n { @@/OCG/refarray } |
| 2951 |
/Category[/Print] |
| 2952 |
>> |
| 2953 |
<< |
| 2954 |
/Event/Export |
| 2955 |
/OCGs\c_space_tl \pdf_object_ref:n { @@/OCG/refarray } |
| 2956 |
/Category[/Print] |
| 2957 |
>> |
| 2958 |
] |
| 2959 |
} |
| 2960 |
\pdfmanagement_add:nne { Catalog / OCProperties }{ D }{ \pdf_object_ref:n { @@/OCG/config} } |
| 2961 |
\cs_gset:Npn \@@_ocg_init: {} |
| 2962 |
} |
| 2963 |
% \end{macrocode} |
| 2964 |
% \end{macro} |
| 2965 |
% We use like with colors a hook, this allows ocgx to replace it. |
| 2966 |
% The implementation is rather simple and uses a box. |
| 2967 |
% \begin{macrocode} |
| 2968 |
\prop_map_inline:Nn \c_@@_map_hyp_annot_prop |
| 2969 |
{ |
| 2970 |
\hook_gput_code:nnn |
| 2971 |
{pdfannot/link/#2/begin} |
| 2972 |
{hyp/ocg} |
| 2973 |
{ |
| 2974 |
\bool_if:cT { l_hyp_annot_ocgcolor#1_bool } |
| 2975 |
{ |
| 2976 |
\@@_ocg_init: |
| 2977 |
\group_begin: |
| 2978 |
\hbox_set:Nw \l_@@_tmpa_box |
| 2979 |
} |
| 2980 |
} |
| 2981 |
\hook_gput_code:nnn |
| 2982 |
{pdfannot/link/#2/end} |
| 2983 |
{hyp/ocg} |
| 2984 |
{ |
| 2985 |
\bool_if:cT { l_hyp_annot_ocgcolor#1_bool } |
| 2986 |
{ |
| 2987 |
\hbox_set_end: |
| 2988 |
\mbox |
| 2989 |
{ |
| 2990 |
\pdf_bdcobject:nn {OC}{@@/OCG/Print} |
| 2991 |
\hbox_overlap_right:n { \box_use:N \l_@@_tmpa_box } |
| 2992 |
\pdf_emc: |
| 2993 |
\pdf_bdcobject:nn {OC}{@@/OCG/View} |
| 2994 |
\group_begin: |
| 2995 |
\color_select:n { hyp/color/#1 } |
| 2996 |
\box_use_drop:N \l_@@_tmpa_box |
| 2997 |
\group_end: |
| 2998 |
\pdf_emc: |
| 2999 |
} |
| 3000 |
\group_end: |
| 3001 |
} |
| 3002 |
} |
| 3003 |
} |
| 3004 |
% \end{macrocode} |
| 3005 |
% |
| 3006 |
% \begin{hypkey} |
| 3007 |
% { |
| 3008 |
% ocgcolorlinks, |
| 3009 |
% ocgcolorlink, |
| 3010 |
% ocgcolorurl, |
| 3011 |
% ocgcolorfile, |
| 3012 |
% ocgcolormenu, |
| 3013 |
% ocgcolorrun |
| 3014 |
% } |
| 3015 |
% These are the keys for ocgcolors. We try to disable it |
| 3016 |
% for pdf version below 1.5 |
| 3017 |
% \begin{macrocode} |
| 3018 |
\bool_lazy_or:nnTF |
| 3019 |
{ \pdf_version_compare_p:Nn > {1.4} } |
| 3020 |
{ \str_if_eq_p:ee{\pdf_version_major:}{-1} } |
| 3021 |
{ |
| 3022 |
\keys_define:nn { hyp } |
| 3023 |
{ |
| 3024 |
,_ocgcolorlinks .meta:n = |
| 3025 |
{ |
| 3026 |
ocgcolorlink=#1, |
| 3027 |
ocgcolorurl=#1, |
| 3028 |
ocgcolorfile=#1, |
| 3029 |
ocgcolorrun=#1, |
| 3030 |
ocgcolormenu=#1 |
| 3031 |
} |
| 3032 |
,_ocgcolorlinks .default:n = true |
| 3033 |
} |
| 3034 |
} |
| 3035 |
{ |
| 3036 |
\keys_define:nn { hyp } |
| 3037 |
{ |
| 3038 |
,_ocgcolorlinks .code:n = |
| 3039 |
{ |
| 3040 |
\msg_warning:nnee |
| 3041 |
{ hyp } |
| 3042 |
{ ignore-deprecated-or-unknown-option-in-pdf-version } |
| 3043 |
{ ocgcolorlinks } { \pdf_version_major:.\pdf_version_minor: } |
| 3044 |
} |
| 3045 |
} |
| 3046 |
} |
| 3047 |
|
| 3048 |
\keys_define:nn { hyp } |
| 3049 |
{ |
| 3050 |
,ocgcolorlinks .choice: |
| 3051 |
,ocgcolorlinks / true .meta:n = |
| 3052 |
{ |
| 3053 |
pdfborder ={0~0~0}, |
| 3054 |
pdfborderstyle ={}, |
| 3055 |
colorlinks = false, |
| 3056 |
_ocgcolorlinks = true |
| 3057 |
} |
| 3058 |
,ocgcolorlinks / false .meta:n = |
| 3059 |
{ |
| 3060 |
_ocgcolorlinks = false |
| 3061 |
} |
| 3062 |
,ocgcolorlinks .default:n = {true} |
| 3063 |
} |
| 3064 |
|
| 3065 |
\seq_map_inline:Nn \c_@@_annot_types_seq |
| 3066 |
{ |
| 3067 |
\bool_lazy_or:nnTF |
| 3068 |
{ \pdf_version_compare_p:Nn > {1.4} } |
| 3069 |
{ \str_if_eq_p:ee{\pdf_version_major:}{-1} } |
| 3070 |
{ |
| 3071 |
\keys_define:nn { hyp } |
| 3072 |
{ |
| 3073 |
,ocgcolor#1 .bool_set:c = { l_hyp_annot_ocgcolor#1_bool } |
| 3074 |
} |
| 3075 |
} |
| 3076 |
{ |
| 3077 |
\keys_define:nn { hyp } |
| 3078 |
{ |
| 3079 |
,ocgcolor#1 .code:n= |
| 3080 |
{ |
| 3081 |
\msg_warning:nnee |
| 3082 |
{ hyp } |
| 3083 |
{ ignore-deprecated-or-unknown-option-in-pdf-version } |
| 3084 |
{ ocgcolor#1 } |
| 3085 |
{ \pdf_version_major:.\pdf_version_minor: } |
| 3086 |
} |
| 3087 |
} |
| 3088 |
} |
| 3089 |
} |
| 3090 |
% \end{macrocode} |
| 3091 |
% \end{hypkey} |
| 3092 |
% \subsection{Highlighting} |
| 3093 |
% This keys set what happens if you click on a link |
| 3094 |
% \begin{macrocode} |
| 3095 |
\prop_map_inline:Nn \c_@@_map_hyp_annot_prop |
| 3096 |
{ |
| 3097 |
\keys_define:nn { hyp } |
| 3098 |
{ |
| 3099 |
,#1highlight .choices:nn = |
| 3100 |
{ /I, /N, /O, /P} |
| 3101 |
{ |
| 3102 |
\pdfannot_dict_put:nnn |
| 3103 |
{link/#2} |
| 3104 |
{ H } |
| 3105 |
{ ##1 } |
| 3106 |
|
| 3107 |
} |
| 3108 |
,#1highlight / .code:n = |
| 3109 |
{ |
| 3110 |
\pdfannot_dict_remove:nn |
| 3111 |
{link/#2} |
| 3112 |
{ H } |
| 3113 |
|
| 3114 |
} |
| 3115 |
,#1highlight / unknown .code:n = |
| 3116 |
{ |
| 3117 |
\msg_warning:nneee { hyp } { unknown-choice+empty } |
| 3118 |
{ #1highlight } |
| 3119 |
{ /I~(inverse), /N~(no effect), /O~(outline), /P~(inset) } |
| 3120 |
{ \exp_not:n {##1} } |
| 3121 |
} |
| 3122 |
} |
| 3123 |
} |
| 3124 |
|
| 3125 |
|
| 3126 |
\keys_define:nn { hyp } |
| 3127 |
{ |
| 3128 |
,pdfhighlight .choices:nn = |
| 3129 |
{ /I, /N, /O, /P} |
| 3130 |
{ |
| 3131 |
\prop_map_inline:Nn \c_@@_map_hyp_annot_prop |
| 3132 |
{ |
| 3133 |
\pdfannot_dict_put:nnn |
| 3134 |
{link/####2} |
| 3135 |
{ H } |
| 3136 |
{ #1 } |
| 3137 |
} |
| 3138 |
} |
| 3139 |
,pdfhighlight / .code:n = |
| 3140 |
{ |
| 3141 |
\prop_map_inline:Nn \c_@@_map_hyp_annot_prop |
| 3142 |
{ |
| 3143 |
\pdfannot_dict_remove:nn |
| 3144 |
{link/##2} |
| 3145 |
{ H } |
| 3146 |
} |
| 3147 |
} |
| 3148 |
,pdfhighlight .initial:n = {/I}, |
| 3149 |
,pdfhighlight / unknown .code:n = |
| 3150 |
{ |
| 3151 |
\msg_warning:nneee { hyp } { unknown-choice+empty } |
| 3152 |
{ pdfhighlight } |
| 3153 |
{ /I~(inverse), /N~(no effect), /O~(outline), /P~(inset) } |
| 3154 |
{ \exp_not:n {#1} } |
| 3155 |
} |
| 3156 |
} |
| 3157 |
% \end{macrocode} |
| 3158 |
% |
| 3159 |
% \subsection{Hiding links} |
| 3160 |
% This key disable all appearance keys. The link themselves are still there. |
| 3161 |
% \begin{hypkey}{hidelinks,hidelink,hideurl,hidefile,hiderun,hidemenu} |
| 3162 |
% \begin{macrocode} |
| 3163 |
\keys_define:nn { hyp } |
| 3164 |
{ |
| 3165 |
hidelinks .meta:n = |
| 3166 |
{ |
| 3167 |
,colorlinks = false |
| 3168 |
,ocgcolorlinks = false |
| 3169 |
,pdfborder = { 0~0~0 } |
| 3170 |
,pdfborderstyle= |
| 3171 |
} |
| 3172 |
} |
| 3173 |
|
| 3174 |
\seq_map_inline:Nn \c_@@_annot_types_seq |
| 3175 |
{ |
| 3176 |
\keys_define:nn { hyp } |
| 3177 |
{ |
| 3178 |
hide#1 .meta:n = |
| 3179 |
{ |
| 3180 |
,color#1 = false |
| 3181 |
,ocgcolor#1 = false |
| 3182 |
,#1border = { 0~0~0 } |
| 3183 |
,#1borderstyle = |
| 3184 |
} |
| 3185 |
} |
| 3186 |
} |
| 3187 |
% \end{macrocode} |
| 3188 |
% \end{hypkey} |
| 3189 |
% \subsection{color schemes and settings} |
| 3190 |
% This define the key for the color schemes and sets the default colors. |
| 3191 |
% \begin{hypkey}{colorscheme} |
| 3192 |
% \begin{macrocode} |
| 3193 |
\keys_define:nn { hyp } |
| 3194 |
{ |
| 3195 |
colorscheme .code:n = |
| 3196 |
{ |
| 3197 |
\prop_map_inline:cn { c_@@_colorscheme_#1_prop } |
| 3198 |
{ |
| 3199 |
\keys_set:nn { hyp } |
| 3200 |
{ |
| 3201 |
##1 = ##2 |
| 3202 |
} |
| 3203 |
} |
| 3204 |
} |
| 3205 |
} |
| 3206 |
\keys_set:nn { hyp } {colorscheme=phelype} |
| 3207 |
% \end{macrocode} |
| 3208 |
% \end{hypkey} |
| 3209 |
% |
| 3210 |
% \section{Keys} |
| 3211 |
% |
| 3212 |
% \subsection{Ignored keys} |
| 3213 |
% The following are ignored (with or without warnings) |
| 3214 |
% \begin{hypkey}{unicode,pdfencoding,pdfversion} |
| 3215 |
% \begin{macrocode} |
| 3216 |
\keys_define:nn { hyp } |
| 3217 |
{ |
| 3218 |
,unicode .code:n = {} |
| 3219 |
,pdfencoding .code:n = {} |
| 3220 |
,pdfversion .code:n = |
| 3221 |
{ |
| 3222 |
\msg_warning:nn { hyp }{ pdfversion-disabled } |
| 3223 |
} |
| 3224 |
} |
| 3225 |
% |
| 3226 |
% \end{macrocode} |
| 3227 |
% \end{hypkey} |
| 3228 |
% |
| 3229 |
% \subsection{Various keys for the pdf and linking behaviour} |
| 3230 |
% This keys are typically set only once. |
| 3231 |
% |
| 3232 |
% \begin{hypkey}{verbose,debug,draft,final} |
| 3233 |
% \begin{macrocode} |
| 3234 |
\keys_define:nn { hyp } |
| 3235 |
{ |
| 3236 |
,verbose .legacy_if_set:n = {Hy@verbose} |
| 3237 |
,debug .legacy_if_set:n = {Hy@verbose} |
| 3238 |
} |
| 3239 |
\keys_define:nn { hyp } |
| 3240 |
{ |
| 3241 |
,draft .code:n = |
| 3242 |
{ |
| 3243 |
\Hy@drafttrue |
| 3244 |
\PassOptionsToPackage{draft}{bookmark} |
| 3245 |
} |
| 3246 |
,final .code:n = |
| 3247 |
{ |
| 3248 |
\Hy@finaltrue |
| 3249 |
\PassOptionsToPackage{final}{bookmark} |
| 3250 |
} |
| 3251 |
} |
| 3252 |
% \end{macrocode} |
| 3253 |
% \end{hypkey} |
| 3254 |
% \begin{hypkey}{extension,hypertexnames,naturalnames, |
| 3255 |
% pageanchor,linktoc,linktocpage,plainpages,localanchorname, |
| 3256 |
% linkfileprefix} |
| 3257 |
% \begin{macrocode} |
| 3258 |
\keys_define:nn { hyp } |
| 3259 |
{ |
| 3260 |
,extension .tl_set:N = \XR@ext |
| 3261 |
,extension .initial:n= pdf |
| 3262 |
,hypertexnames .legacy_if_set:n = {Hy@hypertexnames} |
| 3263 |
,linkfileprefix .tl_set:N = \Hy@linkfileprefix |
| 3264 |
,localanchorname .legacy_if_set:n = {Hy@localanchorname} |
| 3265 |
,naturalnames .legacy_if_set:n = {Hy@naturalnames} |
| 3266 |
,pageanchor .legacy_if_set:n = {Hy@pageanchor} |
| 3267 |
,plainpages .legacy_if_set:n = {Hy@plainpages} |
| 3268 |
} |
| 3269 |
|
| 3270 |
\keys_define:nn { hyp } |
| 3271 |
{ |
| 3272 |
,linktoc .choices:nn = { none, section, all, page } |
| 3273 |
{ |
| 3274 |
\cs_set_eq:Nc \Hy@linktoc { Hy@linktoc@#1 } |
| 3275 |
} |
| 3276 |
,linktoc / unknown .code:n = |
| 3277 |
{ |
| 3278 |
\msg_warning:nneee { hyp } { unknown-choice } |
| 3279 |
{ linktoc } |
| 3280 |
{ none, section, all, page } |
| 3281 |
{ \exp_not:n {#1} } |
| 3282 |
} |
| 3283 |
,linktocpage .choice: |
| 3284 |
,linktocpage / true .meta:n = {linktoc=page} |
| 3285 |
,linktocpage / false .meta:n = {linktoc=section} |
| 3286 |
,linktocpage .default:n = true |
| 3287 |
} |
| 3288 |
|
| 3289 |
% \end{macrocode} |
| 3290 |
% \end{hypkey} |
| 3291 |
% \begin{hypkey}{link,url,file,menu,run} |
| 3292 |
% This booleans allow to disable the link types. |
| 3293 |
% \begin{macrocode} |
| 3294 |
\prop_map_inline:Nn \c_@@_map_hyp_annot_prop |
| 3295 |
{ |
| 3296 |
\keys_define:nn { hyp } |
| 3297 |
{ |
| 3298 |
,#1 .bool_set:c = {l_@@_annot_#2_bool} |
| 3299 |
} |
| 3300 |
} |
| 3301 |
% \end{macrocode} |
| 3302 |
% \end{hypkey} |
| 3303 |
% |
| 3304 |
% \begin{macrocode} |
| 3305 |
\keys_define:nn { hyp } |
| 3306 |
{ |
| 3307 |
,baseurl .code:n = |
| 3308 |
{ |
| 3309 |
\@@_text_pdfstring:noN { #1 } {\l_@@_text_enc_uri_print_tl} \l_@@_tmpa_tl |
| 3310 |
\tl_if_empty:NTF \l_@@_tmpa_tl |
| 3311 |
{ |
| 3312 |
\pdfmanagement_remove:nn {Catalog} { URI } |
| 3313 |
} |
| 3314 |
{ |
| 3315 |
\pdfmanagement_add:nne {Catalog} { URI }{ <</Base \l_@@_tmpa_tl>> } |
| 3316 |
} |
| 3317 |
\@@_store_metadata:nn {baseurl}{#1} |
| 3318 |
} |
| 3319 |
,bookmarks .choice: |
| 3320 |
,bookmarks / false .code:n = {\Hy@bookmarksfalse} |
| 3321 |
,bookmarks / true .code:n = {\Hy@bookmarkstrue} |
| 3322 |
,bookmarks .default:n = {true} |
| 3323 |
,bookmarksnumbered .code:n = {\bookmarksetup{numbered=#1}} |
| 3324 |
,bookmarksnumbered .default:n = true |
| 3325 |
,bookmarksopen .code:n = {\bookmarksetup{open=#1}} |
| 3326 |
,bookmarksopen .default:n = true |
| 3327 |
,bookmarksdepth .code:n = {\bookmarksetup{depth=#1}} |
| 3328 |
,bookmarksopenlevel .code:n = {\bookmarksetup{openlevel=#1}} |
| 3329 |
,bookmarkstype .tl_set:N = \Hy@bookmarkstype |
| 3330 |
,pdfcenterwindow .choice: |
| 3331 |
,pdfcenterwindow / false .code:n = |
| 3332 |
{ |
| 3333 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences }{ CenterWindow } |
| 3334 |
} |
| 3335 |
,pdfcenterwindow / true .code:n = |
| 3336 |
{ |
| 3337 |
\pdfmanagement_add:nnn {Catalog / ViewerPreferences } { CenterWindow }{ true } |
| 3338 |
} |
| 3339 |
,pdfcenterwindow / .code:n = |
| 3340 |
{ |
| 3341 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences }{ CenterWindow } |
| 3342 |
} |
| 3343 |
,pdfcenterwindow / unknown .code:n = |
| 3344 |
{ |
| 3345 |
\msg_warning:nnee { hyp } { no-bool } |
| 3346 |
{ pdfcenterwindow } |
| 3347 |
{ \exp_not:n {#1} } |
| 3348 |
} |
| 3349 |
,pdfcenterwindow .default:n = true |
| 3350 |
,pdfdirection .choice: |
| 3351 |
,pdfdirection / L2R .code:n = |
| 3352 |
{ |
| 3353 |
\pdfmanagement_add:nnn {Catalog / ViewerPreferences } { Direction }{ /L2R } |
| 3354 |
} |
| 3355 |
,pdfdirection / R2L .code:n = |
| 3356 |
{ |
| 3357 |
\pdfmanagement_add:nnn {Catalog / ViewerPreferences } { Direction }{ /R2L } |
| 3358 |
} |
| 3359 |
,pdfdirection / .code:n = |
| 3360 |
{ |
| 3361 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { Direction } |
| 3362 |
} |
| 3363 |
,pdfdirection / unknown .code:n = |
| 3364 |
{ |
| 3365 |
\msg_warning:nneee { hyp } { unknown-choice+empty } |
| 3366 |
{ pdfdirection } |
| 3367 |
{ L2R , R2L } |
| 3368 |
{ \exp_not:n {#1} } |
| 3369 |
} |
| 3370 |
,pdfdisplaydoctitle .choice: |
| 3371 |
,pdfdisplaydoctitle / false .code:n = |
| 3372 |
{ |
| 3373 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { DisplayDocTitle } |
| 3374 |
} |
| 3375 |
,pdfdisplaydoctitle / true .code:n = |
| 3376 |
{ |
| 3377 |
\pdfmanagement_add:nnn {Catalog / ViewerPreferences } { DisplayDocTitle } { true } |
| 3378 |
} |
| 3379 |
,pdfdisplaydoctitle .default:n = true |
| 3380 |
,pdfduplex .choices:nn = |
| 3381 |
{Simplex, DuplexFlipShortEdge, DuplexFlipLongEdge} |
| 3382 |
{ |
| 3383 |
\pdf_version_compare:NnTF > {1.6} |
| 3384 |
{ |
| 3385 |
\pdfmanagement_add:nnn {Catalog / ViewerPreferences } |
| 3386 |
{ Duplex } { /#1 } |
| 3387 |
} |
| 3388 |
{ |
| 3389 |
\msg_warning:nnee |
| 3390 |
{hyp} |
| 3391 |
{ignore-deprecated-or-unknown-option-in-pdf-version} |
| 3392 |
{pdfduplex} |
| 3393 |
{\pdf_version:} |
| 3394 |
} |
| 3395 |
}% |
| 3396 |
,pdfduplex / .code:n = |
| 3397 |
{ |
| 3398 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { Duplex } |
| 3399 |
} |
| 3400 |
,pdfduplex / unknown .code:n = |
| 3401 |
{ |
| 3402 |
\msg_warning:nneee { hyp } { unknown-choice+empty } |
| 3403 |
{ pdfduplex } |
| 3404 |
{ Simplex, DuplexFlipShortEdge, DuplexFlipLongEdge } |
| 3405 |
{ \exp_not:n {#1} } |
| 3406 |
} |
| 3407 |
,pdffitwindow .choice: |
| 3408 |
,pdffitwindow / false .code:n = |
| 3409 |
{ |
| 3410 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { FitWindow } |
| 3411 |
} |
| 3412 |
,pdffitwindow / true .code:n = |
| 3413 |
{ |
| 3414 |
\pdfmanagement_add:nnn {Catalog / ViewerPreferences } { FitWindow } { true } |
| 3415 |
} |
| 3416 |
,pdffitwindow / .code:n = |
| 3417 |
{ |
| 3418 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { FitWindow } |
| 3419 |
} |
| 3420 |
,pdffitwindow .default:n = true |
| 3421 |
,pdffitwindow / unknown .code:n = |
| 3422 |
{ |
| 3423 |
\msg_warning:nnee { hyp } { no-bool } |
| 3424 |
{ pdffitwindow } |
| 3425 |
{ \exp_not:n {#1} } |
| 3426 |
} |
| 3427 |
,pdflinkmargin .code:n = { \pdfannot_link_margin:n { #1 } } |
| 3428 |
,pdflinkmargin .initial:n = {1pt} |
| 3429 |
,pdfmenubar .choice: |
| 3430 |
,pdfmenubar / true .code:n = |
| 3431 |
{ |
| 3432 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { HideMenubar } |
| 3433 |
} |
| 3434 |
,pdfmenubar / false .code:n = |
| 3435 |
{ |
| 3436 |
\pdfmanagement_add:nn {Catalog / ViewerPreferences } |
| 3437 |
{ HideMenubar } { true } |
| 3438 |
} |
| 3439 |
,pdfmenubar / .code:n = |
| 3440 |
{ |
| 3441 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { HideMenubar } |
| 3442 |
} |
| 3443 |
,pdfmenubar .default:n = true |
| 3444 |
,pdfmenubar / unknown .code:n = |
| 3445 |
{ |
| 3446 |
\msg_warning:nnee { hyp } { no-bool } |
| 3447 |
{ pdfmenubar } |
| 3448 |
{ \exp_not:n {#1} } |
| 3449 |
} |
| 3450 |
,pdfnewwindow .choice: |
| 3451 |
,pdfnewwindow / true .code:n = |
| 3452 |
{ |
| 3453 |
\pdfdict_put:nnn {l_hyp/annot/A/GoToR}{/NewWindow}{true} |
| 3454 |
\pdfdict_put:nnn {l_hyp/annot/A/Launch}{/NewWindow}{true} |
| 3455 |
} |
| 3456 |
,pdfnewwindow / false .code:n = |
| 3457 |
{ |
| 3458 |
\pdfdict_put:nnn {l_hyp/annot/A/GoToR}{/NewWindow}{false} |
| 3459 |
\pdfdict_put:nnn {l_hyp/annot/A/Launch}{/NewWindow}{false} |
| 3460 |
} |
| 3461 |
,pdfnewwindow / .code:n = |
| 3462 |
{ |
| 3463 |
\pdfdict_remove:nn {l_hyp/annot/A/GoToR}{/NewWindow} |
| 3464 |
\pdfdict_remove:nn {l_hyp/annot/A/Launch}{/NewWindow} |
| 3465 |
} |
| 3466 |
,pdfnonfullscreenpagemode .choices:nn = |
| 3467 |
{ UseNone, UseOutlines, UseThumbs, FullScreen, UseOC } %pdf 1.5 |
| 3468 |
{ |
| 3469 |
\pdfmanagement_add:nne {Catalog / ViewerPreferences } |
| 3470 |
{ NonFullScreenPageMode} {/#1} |
| 3471 |
} |
| 3472 |
,pdfnonfullscreenpagemode / UseAttachments .code:n = |
| 3473 |
{ |
| 3474 |
\pdf_version_compare:NnTF < {1.6} |
| 3475 |
{ |
| 3476 |
%message |
| 3477 |
} |
| 3478 |
{ |
| 3479 |
\pdfmanagement_add:nne {Catalog / ViewerPreferences } |
| 3480 |
{NonFullScreenPageMode}{/UseAttachments} |
| 3481 |
} |
| 3482 |
} |
| 3483 |
,pdfnonfullscreenpagemode / .code:n = |
| 3484 |
{ |
| 3485 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { NonFullScreenPageMode } |
| 3486 |
} |
| 3487 |
,pdfnonfullscreenpagemode / unknown .code:n = |
| 3488 |
{ |
| 3489 |
\msg_warning:nneee { hyp } { unknown-choice+empty } |
| 3490 |
{ pdfnonfullscreenpagemode } |
| 3491 |
{ UseNone, UseOutlines, UseThumbs, FullScreen, UseOC, UseAttachments (PDF 1.6) } |
| 3492 |
{ \exp_not:n {#1} } |
| 3493 |
} |
| 3494 |
,pdfnumcopies .code:n = |
| 3495 |
{ |
| 3496 |
\pdf_version_compare:NnTF > {1.6} |
| 3497 |
{ |
| 3498 |
\tl_if_empty:nTF {#1} |
| 3499 |
{ |
| 3500 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { NumCopies } |
| 3501 |
} |
| 3502 |
{ |
| 3503 |
\pdfmanagement_add:nne {Catalog / ViewerPreferences } |
| 3504 |
{NumCopies}{#1} |
| 3505 |
} |
| 3506 |
} |
| 3507 |
{ |
| 3508 |
\msg_warning:nnee |
| 3509 |
{hyp} |
| 3510 |
{ignore-deprecated-or-unknown-option-in-pdf-version} |
| 3511 |
{pdfnumcopies} |
| 3512 |
{\pdf_version:} |
| 3513 |
} |
| 3514 |
} |
| 3515 |
,pdfpagelayout .choices:nn = |
| 3516 |
{ SinglePage, OneColumn, TwoColumnLeft, TwoColumnRight, TwoPageLeft, TwoPageRight} |
| 3517 |
{ \pdfmanagement_add:nne {Catalog} { PageLayout }{ /#1 } } |
| 3518 |
,pdfpagelayout / .code:n = |
| 3519 |
{ \pdfmanagement_remove:nn {Catalog} { PageLayout } } |
| 3520 |
,pdfpagelayout / unknown .code:n = |
| 3521 |
{ |
| 3522 |
\msg_warning:nneee { hyp } { unknown-choice+empty } |
| 3523 |
{ pdfpagelayout } |
| 3524 |
{ SinglePage, OneColumn, TwoColumnLeft, TwoColumnRight, TwoPageLeft, TwoPageRight } |
| 3525 |
{ \exp_not:n {#1} } |
| 3526 |
} |
| 3527 |
,pdfpagemode .choices:nn = |
| 3528 |
{ UseNone, UseOutlines, UseThumbs, FullScreen, UseOC } %pdf 1.5 |
| 3529 |
{ \pdfmanagement_add:nne {Catalog} { PageMode }{ /#1 } } |
| 3530 |
,pdfpagemode / UseAttachments .code:n = |
| 3531 |
{ |
| 3532 |
\pdf_version_compare:NnTF > {1.5} |
| 3533 |
{ |
| 3534 |
\pdfmanagement_add:nne {Catalog} { PageMode }{ /UseAttachments } |
| 3535 |
} |
| 3536 |
{ |
| 3537 |
\msg_warning:nnee |
| 3538 |
{hyp} |
| 3539 |
{ignore-deprecated-or-unknown-value-in-pdf-version} |
| 3540 |
{UseAttachments} |
| 3541 |
{\pdf_version:} |
| 3542 |
} |
| 3543 |
} |
| 3544 |
,pdfpagemode .initial:n = { UseOutlines } %for now ... |
| 3545 |
,pdfpagemode / unknown .code:n = |
| 3546 |
{ |
| 3547 |
\msg_warning:nneee { hyp } { unknown-choice+empty } |
| 3548 |
{ pdfpagemode } |
| 3549 |
{ UseNone, UseOutlines, UseThumbs, FullScreen, UseOC, UseAttachments (PDF 1.6) } |
| 3550 |
{ \exp_not:n {#1} } |
| 3551 |
} |
| 3552 |
,pdfpagescrop .code:n = |
| 3553 |
{ |
| 3554 |
\tl_if_empty:nTF {#1} %or blank? |
| 3555 |
{ |
| 3556 |
\pdfmanagement_remove:nn {Pages} { CropBox } |
| 3557 |
} |
| 3558 |
{ |
| 3559 |
\pdfmanagement_add:nne {Pages} { CropBox } { [#1] } |
| 3560 |
} |
| 3561 |
} |
| 3562 |
,pdfpicktraybypdfsize .choice: |
| 3563 |
,pdfpicktraybypdfsize / true .code:n = |
| 3564 |
{ |
| 3565 |
\pdf_version_compare:NnTF > {1.6} |
| 3566 |
{ |
| 3567 |
\pdfmanagement_add:nnn {Catalog / ViewerPreferences } |
| 3568 |
{ PickTrayByPDFSize } { true } |
| 3569 |
} |
| 3570 |
{ |
| 3571 |
\msg_warning:nnee |
| 3572 |
{hyp} |
| 3573 |
{ignore-deprecated-or-unknown-option-in-pdf-version} |
| 3574 |
{pdfpicktraybypdfsize} |
| 3575 |
{\pdf_version:} |
| 3576 |
} |
| 3577 |
} |
| 3578 |
,pdfpicktraybypdfsize / false .code:n = |
| 3579 |
{ |
| 3580 |
\pdf_version_compare:NnTF > {1.6} |
| 3581 |
{ |
| 3582 |
\pdfmanagement_add:nnn {Catalog / ViewerPreferences } |
| 3583 |
{ PickTrayByPDFSize } { false } |
| 3584 |
} |
| 3585 |
{ |
| 3586 |
\msg_warning:nnee |
| 3587 |
{hyp} |
| 3588 |
{ignore-deprecated-or-unknown-option-in-pdf-version} |
| 3589 |
{pdfpicktraybypdfsize} |
| 3590 |
{\pdf_version:} |
| 3591 |
} |
| 3592 |
} |
| 3593 |
,pdfpicktraybypdfsize / .code:n = |
| 3594 |
{ |
| 3595 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { PickTrayByPDFSize } |
| 3596 |
} |
| 3597 |
,pdfpicktraybypdfsize / unknown .code:n = |
| 3598 |
{ |
| 3599 |
\msg_warning:nnee { hyp } { no-bool } |
| 3600 |
{ picktraybypdfsize } |
| 3601 |
{ \exp_not:n {#1} } |
| 3602 |
} |
| 3603 |
,pdfprintarea .choices:nn = |
| 3604 |
{ MediaBox, CropBox, BleedBox, TrimBox, ArtBox } |
| 3605 |
{ |
| 3606 |
\pdf_version_compare:NnTF < {2.0} |
| 3607 |
{ |
| 3608 |
\pdfmanagement_add:nne {Catalog / ViewerPreferences } |
| 3609 |
{ PrintArea } { /#1 } |
| 3610 |
} |
| 3611 |
{ |
| 3612 |
\msg_warning:nnee |
| 3613 |
{hyp} |
| 3614 |
{ignore-deprecated-or-unknown-option-in-pdf-version} |
| 3615 |
{pdfprintarea} |
| 3616 |
{\pdf_version:} |
| 3617 |
} |
| 3618 |
}% |
| 3619 |
,pdfprintarea / .code:n = |
| 3620 |
{ \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { PrintArea } } |
| 3621 |
,pdfprintarea / unknown .code:n = |
| 3622 |
{ |
| 3623 |
\msg_warning:nneee { hyp } { unknown-choice+empty } |
| 3624 |
{ pdfprintarea } |
| 3625 |
{ MediaBox, CropBox, BleedBox, TrimBox, ArtBox } |
| 3626 |
{ \exp_not:n {#1} } |
| 3627 |
} |
| 3628 |
,pdfprintclip .choices:nn = |
| 3629 |
{ MediaBox, CropBox, BleedBox, TrimBox, ArtBox } |
| 3630 |
{ |
| 3631 |
\pdf_version_compare:NnTF < {2.0} |
| 3632 |
{ |
| 3633 |
\pdfmanagement_add:nne {Catalog / ViewerPreferences } |
| 3634 |
{ PrintClip } { /#1 } |
| 3635 |
} |
| 3636 |
{ |
| 3637 |
\msg_warning:nnee |
| 3638 |
{hyp} |
| 3639 |
{ignore-deprecated-or-unknown-option-in-pdf-version} |
| 3640 |
{pdfprintclip} |
| 3641 |
{\pdf_version:} |
| 3642 |
} |
| 3643 |
}% |
| 3644 |
,pdfprintclip / .code:n = |
| 3645 |
{ |
| 3646 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { PrintClip } |
| 3647 |
} |
| 3648 |
,pdfprintclip / unknown .code:n = |
| 3649 |
{ |
| 3650 |
\msg_warning:nneee |
| 3651 |
{ hyp } |
| 3652 |
{ unknown-choice+empty } |
| 3653 |
{ pdfprintclip } |
| 3654 |
{ MediaBox, CropBox, BleedBox, TrimBox, ArtBox } |
| 3655 |
{ \exp_not:n {#1} } |
| 3656 |
} |
| 3657 |
,pdfprintpagerange .code:n = |
| 3658 |
{ |
| 3659 |
\pdf_version_compare:NnTF > {1.6} |
| 3660 |
{ |
| 3661 |
\tl_if_empty:nTF { #1} |
| 3662 |
{ |
| 3663 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } |
| 3664 |
{ PrintPageRange } |
| 3665 |
} |
| 3666 |
{ |
| 3667 |
\pdfmanagement_add:nne {Catalog / ViewerPreferences } |
| 3668 |
{PrintPageRange}{[#1]} |
| 3669 |
} |
| 3670 |
} |
| 3671 |
{ |
| 3672 |
\msg_warning:nnee |
| 3673 |
{hyp} |
| 3674 |
{ignore-deprecated-or-unknown-option-in-pdf-version} |
| 3675 |
{pdfprintpagerange} |
| 3676 |
{\pdf_version:} |
| 3677 |
} |
| 3678 |
} |
| 3679 |
,pdfprintscaling .choices:nn = |
| 3680 |
{ None, AppDefault } |
| 3681 |
{ |
| 3682 |
\pdf_version_compare:NnTF > {1.5} |
| 3683 |
{ |
| 3684 |
\pdfmanagement_add:nne {Catalog / ViewerPreferences } |
| 3685 |
{ PrintScaling } { /#1 } |
| 3686 |
} |
| 3687 |
{ |
| 3688 |
\msg_warning:nnee |
| 3689 |
{hyp} |
| 3690 |
{ignore-deprecated-or-unknown-option-in-pdf-version} |
| 3691 |
{pdfprintscaling} |
| 3692 |
{\pdf_version:} |
| 3693 |
} |
| 3694 |
}% |
| 3695 |
,pdfprintscaling / .code:n = |
| 3696 |
{ |
| 3697 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } {PrintScaling } |
| 3698 |
} |
| 3699 |
,pdfprintscaling / unknown .code:n = |
| 3700 |
{ |
| 3701 |
\msg_warning:nneee { hyp } { unknown-choice+empty } |
| 3702 |
{ pdfprintarea } |
| 3703 |
{ None, AppDefault } |
| 3704 |
{ \exp_not:n {#1} } |
| 3705 |
} |
| 3706 |
,pdfremotestartview .code:n = |
| 3707 |
{ |
| 3708 |
\tl_set:Ne \l_@@_tmpa_tl {#1~null~null~null~} |
| 3709 |
\exp_args:NNV |
| 3710 |
\regex_extract_once:NnNTF \c_@@_dest_startview_regex \l_@@_tmpa_tl \l_@@_tmpa_seq |
| 3711 |
{ |
| 3712 |
\tl_set:Ne \l_@@_dest_pdfremotestartview_tl {\seq_item:Nn \l_@@_tmpa_seq {1}} |
| 3713 |
} |
| 3714 |
{ |
| 3715 |
\msg_warning:nnnn {hyp}{invalid-destination-value}{#1}{pdfremotestartview} |
| 3716 |
\tl_set:Nn \l_@@_dest_pdfremotestartview_tl {Fit} |
| 3717 |
} |
| 3718 |
} |
| 3719 |
,pdfremotestartview .initial:n = {Fit} |
| 3720 |
% pdfstartpage is special as it shares code with pdfstartview |
| 3721 |
,pdfstartpage .code:n = |
| 3722 |
{ |
| 3723 |
\tl_gset:Ne \g_@@_dest_pdfstartpage_tl { #1 } |
| 3724 |
\bool_if:nTF |
| 3725 |
{ \tl_if_empty_p:N \g_@@_dest_pdfstartpage_tl || \tl_if_empty_p:N \g_@@_dest_pdfstartview_tl } |
| 3726 |
{ |
| 3727 |
\pdfmanagement_remove:nn {Catalog} { OpenAction } |
| 3728 |
} |
| 3729 |
{ |
| 3730 |
\pdfmanagement_add:nne {Catalog} { OpenAction } |
| 3731 |
{ |
| 3732 |
[\pdf_pageobject_ref:n {\g_@@_dest_pdfstartpage_tl}~/\g_@@_dest_pdfstartview_tl] |
| 3733 |
} |
| 3734 |
} |
| 3735 |
} |
| 3736 |
,pdfstartpage .initial:n =1 |
| 3737 |
,pdfstartview .code:n = |
| 3738 |
{ |
| 3739 |
\tl_set:Ne \l_@@_tmpa_tl {#1~null~null~null~} |
| 3740 |
\exp_args:NNV |
| 3741 |
\regex_extract_once:NnNTF \c_@@_dest_startview_regex \l_@@_tmpa_tl \l_@@_tmpa_seq |
| 3742 |
{ |
| 3743 |
\tl_gset:Ne \g_@@_dest_pdfstartview_tl {\seq_item:Nn \l_@@_tmpa_seq {1}} |
| 3744 |
} |
| 3745 |
{ |
| 3746 |
\msg_warning:nnnn {hyp}{invalid-destination-value}{#1}{pdfstartview} |
| 3747 |
\tl_gset:Nn \g_@@_dest_pdfstartview_tl {Fit} |
| 3748 |
} |
| 3749 |
\bool_if:nTF |
| 3750 |
{ \tl_if_empty_p:N \g_@@_dest_pdfstartpage_tl || \tl_if_empty_p:N \g_@@_dest_pdfstartview_tl } |
| 3751 |
{ |
| 3752 |
\pdfmanagement_remove:nn {Catalog} { OpenAction } |
| 3753 |
} |
| 3754 |
{ |
| 3755 |
\pdfmanagement_add:nne {Catalog} { OpenAction } |
| 3756 |
{ |
| 3757 |
[\pdf_pageobject_ref:n {\g_@@_dest_pdfstartpage_tl}~/\g_@@_dest_pdfstartview_tl] |
| 3758 |
} |
| 3759 |
} |
| 3760 |
} |
| 3761 |
,pdfstartview .initial:n = Fit |
| 3762 |
,pdftoolbar .choice: |
| 3763 |
,pdftoolbar / true .code:n = |
| 3764 |
{ |
| 3765 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { HideToolbar } |
| 3766 |
} |
| 3767 |
,pdftoolbar / false .code:n = |
| 3768 |
{ |
| 3769 |
\pdfmanagement_add:nnn {Catalog / ViewerPreferences } |
| 3770 |
{ HideToolbar } { true } |
| 3771 |
} |
| 3772 |
,pdftoolbar / true .code:n = |
| 3773 |
{ |
| 3774 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { HideToolbar } |
| 3775 |
} |
| 3776 |
,pdftoolbar .default:n = true |
| 3777 |
,pdftoolbar / unknown .code:n = |
| 3778 |
{ |
| 3779 |
\msg_warning:nnee { hyp } { no-bool } |
| 3780 |
{ pdftoolbar } |
| 3781 |
{ \exp_not:n {#1} } |
| 3782 |
} |
| 3783 |
% pdfview see below. |
| 3784 |
,pdfviewarea .choices:nn = |
| 3785 |
{ MediaBox, CropBox, BleedBox, TrimBox, ArtBox } |
| 3786 |
{ |
| 3787 |
\pdf_version_compare:NnTF < {2.0} |
| 3788 |
{ |
| 3789 |
\pdfmanagement_add:nnn {Catalog / ViewerPreferences } |
| 3790 |
{ ViewArea } { /#1 } |
| 3791 |
} |
| 3792 |
{ |
| 3793 |
\msg_warning:nnee |
| 3794 |
{hyp} |
| 3795 |
{ignore-deprecated-or-unknown-option-in-pdf-version} |
| 3796 |
{pdfviewarea} |
| 3797 |
{\pdf_version:} |
| 3798 |
} |
| 3799 |
}% |
| 3800 |
,pdfviewarea / .code:n = |
| 3801 |
{ |
| 3802 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { ViewArea } |
| 3803 |
} |
| 3804 |
,pdfviewarea / unknown .code:n = |
| 3805 |
{ |
| 3806 |
\msg_warning:nneee { hyp } { unknown-choice+empty } |
| 3807 |
{ pdfviewarea } |
| 3808 |
{ MediaBox, CropBox, BleedBox, TrimBox, ArtBox } |
| 3809 |
{ \exp_not:n {#1} } |
| 3810 |
} |
| 3811 |
,pdfviewclip .choices:nn = |
| 3812 |
{ MediaBox, CropBox, BleedBox, TrimBox, ArtBox } |
| 3813 |
{ |
| 3814 |
\pdf_version_compare:NnTF < {2.0} |
| 3815 |
{ |
| 3816 |
\pdfmanagement_add:nnn {Catalog / ViewerPreferences } |
| 3817 |
{ ViewClip } { /#1 } |
| 3818 |
} |
| 3819 |
{ |
| 3820 |
\msg_warning:nnee |
| 3821 |
{hyp} |
| 3822 |
{ignore-deprecated-or-unknown-option-in-pdf-version} |
| 3823 |
{pdfviewclip} |
| 3824 |
{\pdf_version:} |
| 3825 |
} |
| 3826 |
}% |
| 3827 |
,pdfviewclip / .code:n = |
| 3828 |
{ |
| 3829 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { ViewClip } |
| 3830 |
} |
| 3831 |
,pdfviewclip / unknown .code:n = |
| 3832 |
{ |
| 3833 |
\msg_warning:nneee { hyp } { unknown-choice+empty } |
| 3834 |
{ pdfviewclip } |
| 3835 |
{ MediaBox, CropBox, BleedBox, TrimBox, ArtBox } |
| 3836 |
{ \exp_not:n {#1} } |
| 3837 |
} |
| 3838 |
,pdfwindowui .choice: |
| 3839 |
,pdfwindowui / true .code:n = |
| 3840 |
{ |
| 3841 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } { HideWindowUI } |
| 3842 |
} |
| 3843 |
,pdfwindowui / false .code:n = |
| 3844 |
{ |
| 3845 |
\pdfmanagement_add:nnn {Catalog / ViewerPreferences } |
| 3846 |
{ HideWindowUI } { true } |
| 3847 |
} |
| 3848 |
,pdfwindowui / .code:n = |
| 3849 |
{ |
| 3850 |
\pdfmanagement_remove:nn {Catalog / ViewerPreferences } {HideWindowUI } |
| 3851 |
} |
| 3852 |
,pdfwindowui / unknown .code:n = |
| 3853 |
{ |
| 3854 |
\msg_warning:nnee { hyp } { no-bool } |
| 3855 |
{ pdfwindowui } |
| 3856 |
{ \exp_not:n {#1} } |
| 3857 |
} |
| 3858 |
,pdfwindowui .default:n = true |
| 3859 |
} |
| 3860 |
% \end{macrocode} |
| 3861 |
% |
| 3862 |
% \begin{hypkey}{pdfview} |
| 3863 |
% Destination keys. pdfview is a bit more complicated so extra. |
| 3864 |
% \begin{macrocode} |
| 3865 |
\keys_define:nn { hyp } |
| 3866 |
{ |
| 3867 |
,pdfview .code:n = |
| 3868 |
{ |
| 3869 |
\seq_set_split:Nnn \l_@@_tmpa_seq {~}{#1} |
| 3870 |
\str_case_e:nnF { \str_lowercase:f{ \seq_item:Nn \l_@@_tmpa_seq {1} } } |
| 3871 |
{ |
| 3872 |
{ xyz } |
| 3873 |
{ |
| 3874 |
\int_compare:nNnTF {\seq_count:N \l_@@_tmpa_seq } > { 1 } |
| 3875 |
{ |
| 3876 |
\seq_get_right:NN \l_@@_tmpa_seq \l_@@_tmpa_tl |
| 3877 |
\tl_if_eq:NnTF \l_@@_tmpa_tl {null} |
| 3878 |
{ |
| 3879 |
\tl_set:Nn \l_@@_dest_pdfview_tl {xyz} |
| 3880 |
} |
| 3881 |
{ |
| 3882 |
\tl_set:Ne \l_@@_dest_pdfview_tl |
| 3883 |
{ |
| 3884 |
\fp_eval:n { \l_@@_tmpa_tl * 100 } |
| 3885 |
} |
| 3886 |
} |
| 3887 |
} |
| 3888 |
{ |
| 3889 |
\tl_set:Nn \l_@@_dest_pdfview_tl {xyz} |
| 3890 |
} |
| 3891 |
} |
| 3892 |
{ fit } { \tl_set:Nn \l_@@_dest_pdfview_tl {fit} } |
| 3893 |
{ fitb } { \tl_set:Nn \l_@@_dest_pdfview_tl {fitb} } |
| 3894 |
{ fitbh } { \tl_set:Nn \l_@@_dest_pdfview_tl {fitbh}} |
| 3895 |
{ fitbv } { \tl_set:Nn \l_@@_dest_pdfview_tl {fitbv}} |
| 3896 |
{ fith } { \tl_set:Nn \l_@@_dest_pdfview_tl {fith} } |
| 3897 |
{ fitv } { \tl_set:Nn \l_@@_dest_pdfview_tl {fitv} } |
| 3898 |
{ fitr } |
| 3899 |
{ |
| 3900 |
\int_compare:nNnTF {\seq_count:N \l_@@_tmpa_seq } = {1} |
| 3901 |
{ |
| 3902 |
\tl_set:Nn \l_@@_dest_pdfview_tl {fitr} |
| 3903 |
} |
| 3904 |
{ |
| 3905 |
%ensure 4 values ... |
| 3906 |
\tl_set:Nn \l_@@_dest_pdfview_tl {fitrbox} |
| 3907 |
\seq_put_right:Nn \l_@@_tmpa_seq {0} |
| 3908 |
\seq_put_right:Nn \l_@@_tmpa_seq {0} |
| 3909 |
\seq_put_right:Nn \l_@@_tmpa_seq {0} |
| 3910 |
\hbox_set_to_wd:Nnn \l_@@_dest_box |
| 3911 |
{ |
| 3912 |
\fp_eval:n |
| 3913 |
{ |
| 3914 |
round |
| 3915 |
( |
| 3916 |
abs |
| 3917 |
( |
| 3918 |
\seq_item:Nn\l_@@_tmpa_seq{4} |
| 3919 |
- |
| 3920 |
(\seq_item:Nn\l_@@_tmpa_seq{2}) |
| 3921 |
), |
| 3922 |
3 |
| 3923 |
) |
| 3924 |
}bp |
| 3925 |
}{} |
| 3926 |
\box_set_dp:Nn \l_@@_dest_box |
| 3927 |
{ |
| 3928 |
\fp_eval:n |
| 3929 |
{ |
| 3930 |
round(0 - (\seq_item:Nn\l_@@_tmpa_seq{3}),3) |
| 3931 |
}bp |
| 3932 |
} |
| 3933 |
\box_set_ht:Nn \l_@@_dest_box |
| 3934 |
{ |
| 3935 |
\seq_item:Nn\l_@@_tmpa_seq{5}bp |
| 3936 |
} |
| 3937 |
} |
| 3938 |
} |
| 3939 |
} |
| 3940 |
{ |
| 3941 |
\msg_warning:nnnn {hyp}{invalid-destination-value}{#1}{pdfview} |
| 3942 |
\tl_set:Nn \l_@@_dest_pdfview_tl {fit} |
| 3943 |
} |
| 3944 |
} |
| 3945 |
,pdfview .initial:n = {xyz} |
| 3946 |
} |
| 3947 |
% \end{macrocode} |
| 3948 |
% \end{hypkey} |
| 3949 |
%\subsection{\enquote{MetaData keys}} |
| 3950 |
% The following keys are relevant for the metadata: the info dictionary and |
| 3951 |
% the xmp-metadata. |
| 3952 |
% \begin{hypkey}{pdflang} |
| 3953 |
% |pdflang| should be deprecated. |
| 3954 |
% \begin{macrocode} |
| 3955 |
\keys_define:nn { hyp } |
| 3956 |
{ |
| 3957 |
,pdflang .code:n = |
| 3958 |
{ |
| 3959 |
\tl_if_empty:nF { #1 } |
| 3960 |
{ |
| 3961 |
\pdfmanagement_add:nne {Catalog} { Lang } { (#1) } |
| 3962 |
\AddToDocumentProperties[document]{lang}{#1} |
| 3963 |
} |
| 3964 |
} |
| 3965 |
} |
| 3966 |
% \end{macrocode} |
| 3967 |
% \end{hypkey} |
| 3968 |
% |
| 3969 |
% \subsubsection{\enquote{info keys}} |
| 3970 |
% \begin{hypkey}{pdfauthor,pdftitle,pdfcreator,pdfsubject,pdfproducer,pdfkeywords} |
| 3971 |
% The keys store their value also in the metadata container, so that hyperxmp can |
| 3972 |
% use them. Creator and Producer can't be removed with the pdfmanagement, |
| 3973 |
% but we allow to set an empty value. |
| 3974 |
% If the value begin with an optional argument, we assume a multilanguage clist and |
| 3975 |
% use only the first value. |
| 3976 |
% The values are expanded with \cs{text_expand:n} |
| 3977 |
% \begin{macrocode} |
| 3978 |
\regex_new:N\l_@@_optlang_regex |
| 3979 |
\regex_set:Nn\l_@@_optlang_regex {\A\[([A-Za-z\-]+)\](.*)} |
| 3980 |
\cs_generate_variant:Nn\clist_item:nn{on} |
| 3981 |
\cs_new_protected:Npn \@@_setup_info_key:nn #1 #2 |
| 3982 |
{ |
| 3983 |
\keys_define:nn { hyp } |
| 3984 |
{ |
| 3985 |
pdf#1 .code:n = |
| 3986 |
{ |
| 3987 |
\tl_set:Ne\l_@@_tmpa_tl {\text_expand:n{##1}} |
| 3988 |
\@@_store_metadata:no {pdf#1}{\l_@@_tmpa_tl} |
| 3989 |
\tl_if_empty:NTF \l_@@_tmpa_tl |
| 3990 |
{ |
| 3991 |
\str_case:nnF { #1 } |
| 3992 |
{ |
| 3993 |
{creator} |
| 3994 |
{ |
| 3995 |
\msg_info:nnn { hyp }{ empty-info-value } { pdfcreator } |
| 3996 |
\pdfmanagement_add:nne {Info}{Creator}{()} |
| 3997 |
} |
| 3998 |
{producer} |
| 3999 |
{ |
| 4000 |
\msg_info:nnn { hyp }{ empty-info-value } { pdfproducer } |
| 4001 |
\pdfmanagement_add:nne {Info}{Producer}{()} |
| 4002 |
} |
| 4003 |
} |
| 4004 |
{ |
| 4005 |
\pdfmanagement_remove:nn {Info}{#2} |
| 4006 |
} |
| 4007 |
} |
| 4008 |
{ |
| 4009 |
\tl_set:Ne\l_@@_tmpb_tl {\clist_item:on{\l_@@_tmpa_tl}{1}} |
| 4010 |
\exp_args:NNV |
| 4011 |
\regex_extract_once:NnN \l_@@_optlang_regex \l_@@_tmpb_tl\l_@@_tmpa_seq |
| 4012 |
\seq_if_empty:NTF\l_@@_tmpa_seq |
| 4013 |
{ |
| 4014 |
\@@_text_pdfstring_info:oN {\l_@@_tmpa_tl}\l_@@_tmpa_str |
| 4015 |
} |
| 4016 |
{ |
| 4017 |
\@@_text_pdfstring_info:eN {\seq_item:Nn \l_@@_tmpa_seq{3}}\l_@@_tmpa_str |
| 4018 |
} |
| 4019 |
\str_if_eq:VnF\l_@@_tmpa_str{<FEFF>} |
| 4020 |
{ |
| 4021 |
\pdfmanagement_add:nne {Info}{#2}{\l_@@_tmpa_str} |
| 4022 |
} |
| 4023 |
} |
| 4024 |
} |
| 4025 |
} |
| 4026 |
\keys_define:nn { hyp / info } |
| 4027 |
{ |
| 4028 |
#2 .code:n = |
| 4029 |
{ |
| 4030 |
\tl_set:Ne\l_@@_tmpa_tl {\text_expand:n{##1}} |
| 4031 |
\@@_store_metadata:eo {pdf\str_lowercase:n{#1}}{\l_@@_tmpa_tl} |
| 4032 |
\tl_if_blank:nTF {##1} |
| 4033 |
{ |
| 4034 |
\pdfmanagement_remove:nn {Info}{#2} |
| 4035 |
} |
| 4036 |
{ |
| 4037 |
\@@_text_pdfstring_info:oN {\l_@@_tmpa_tl}\l_@@_tmpa_str |
| 4038 |
\str_if_eq:VnF\l_@@_tmpa_str{<FEFF>} |
| 4039 |
{ |
| 4040 |
\pdfmanagement_add:nne {Info}{#2}{\l_@@_tmpa_str} |
| 4041 |
} |
| 4042 |
} |
| 4043 |
} |
| 4044 |
,unknown .code:n = |
| 4045 |
{ |
| 4046 |
\@@_text_pdfstring_info:eN {##1}\l_@@_tmpa_str |
| 4047 |
\str_if_eq:VnF\l_@@_tmpa_str{<FEFF>} |
| 4048 |
{ |
| 4049 |
\exp_args:Nno |
| 4050 |
\pdfmanagement_add:nne {Info} |
| 4051 |
{ \l_keys_key_str } {\l_@@_tmpa_str} |
| 4052 |
} |
| 4053 |
} |
| 4054 |
} |
| 4055 |
} |
| 4056 |
\@@_setup_info_key:nn {author} {Author} |
| 4057 |
\@@_setup_info_key:nn {title} {Title} |
| 4058 |
\@@_setup_info_key:nn {producer} {Producer} |
| 4059 |
\@@_setup_info_key:nn {creator} {Creator} |
| 4060 |
% ignored key: addtopdfcreator |
| 4061 |
\@@_setup_info_key:nn {subject} {Subject} |
| 4062 |
\@@_setup_info_key:nn {keywords} {Keywords} |
| 4063 |
% \end{macrocode} |
| 4064 |
% \end{hypkey} |
| 4065 |
% \begin{hypkey}{pdfcreationdate,pdfmoddate,pdfmetadate} |
| 4066 |
% These keys are not really needed. We store them too in the container. |
| 4067 |
% CreationDate and ModDate should not use the hex encoding. |
| 4068 |
% \begin{macrocode} |
| 4069 |
\cs_new_protected:Npn \@@_setup_info_date_key:nn #1 #2 |
| 4070 |
{ |
| 4071 |
\keys_define:nn { hyp } |
| 4072 |
{ |
| 4073 |
pdf#1 .code:n = |
| 4074 |
{ |
| 4075 |
\tl_if_blank:nTF {##1} |
| 4076 |
{ |
| 4077 |
\pdfmanagement_remove:nn {Info}{#2} |
| 4078 |
} |
| 4079 |
{ |
| 4080 |
\pdfmanagement_add:nne {Info}{#2}{(##1)} |
| 4081 |
} |
| 4082 |
\@@_store_metadata:nn {pdf#1}{##1} |
| 4083 |
\AddToDocumentProperties[document]{#1}{##1} |
| 4084 |
} |
| 4085 |
} |
| 4086 |
\keys_define:nn { hyp / info } |
| 4087 |
{ |
| 4088 |
#2 .code:n = |
| 4089 |
{ |
| 4090 |
\tl_if_blank:nTF {##1} |
| 4091 |
{ |
| 4092 |
\pdfmanagement_remove:nn {Info}{#2} |
| 4093 |
} |
| 4094 |
{ |
| 4095 |
\pdfmanagement_add:nne {Info}{#2}{(##1)} |
| 4096 |
} |
| 4097 |
\exp_args:Ne \@@_store_metadata:nn {pdf\str_lowercase:n{#1}}{##1} |
| 4098 |
} |
| 4099 |
} |
| 4100 |
} |
| 4101 |
|
| 4102 |
\@@_setup_info_date_key:nn {creationdate} {CreationDate} |
| 4103 |
\@@_setup_info_date_key:nn {moddate} {ModDate} |
| 4104 |
\keys_define:nn { hyp } |
| 4105 |
{ |
| 4106 |
pdfmetadate .code:n = { \@@_store_metadata:nn {pdfmetadate}{#1} } |
| 4107 |
} |
| 4108 |
% \end{macrocode} |
| 4109 |
% \end{hypkey} |
| 4110 |
% \begin{hypkey}{pdftrapped} |
| 4111 |
% Trapped is a bit curious, it has an value "unknown", and one can't suppress it ... |
| 4112 |
% \begin{macrocode} |
| 4113 |
\keys_define:nn { hyp } |
| 4114 |
{ |
| 4115 |
,pdftrapped .code:n = |
| 4116 |
{ |
| 4117 |
\exp_args:Nne |
| 4118 |
\keys_set:nn { hyp } { _pdftrapped = \str_uppercase:n { #1 } } |
| 4119 |
} |
| 4120 |
,_pdftrapped .choices:nn = {TRUE,FALSE,UNKNOWN} |
| 4121 |
{ |
| 4122 |
\pdfmanagement_add:nne {Info}{Trapped} |
| 4123 |
{/ |
| 4124 |
\str_uppercase:f { \str_head:n { #1 } } |
| 4125 |
\str_lowercase:f { \str_tail:n { #1 } } |
| 4126 |
} |
| 4127 |
\@@_store_metadata:ne {pdftrapped} |
| 4128 |
{ |
| 4129 |
\str_uppercase:f { \str_head:n { #1 } } |
| 4130 |
\str_lowercase:f { \str_tail:n { #1 } } |
| 4131 |
} |
| 4132 |
} |
| 4133 |
,_pdftrapped / unknown .code:n = |
| 4134 |
{ |
| 4135 |
\msg_warning:nneee { hyp } { unknown-choice } |
| 4136 |
{ pdftrapped } |
| 4137 |
{ true~(case~insensitive), false~(case~insensitive), unknown~(case~insensitive) } |
| 4138 |
{ \exp_not:n {#1} } |
| 4139 |
} |
| 4140 |
} |
| 4141 |
% \end{macrocode} |
| 4142 |
% \end{hypkey} |
| 4143 |
% \begin{hypkey}{pdfinfo} |
| 4144 |
% pdfinfo allows to set the info keys with keyval ... |
| 4145 |
% \begin{macrocode} |
| 4146 |
\keys_define:nn { hyp } |
| 4147 |
{ |
| 4148 |
pdfinfo .code:n = |
| 4149 |
{ |
| 4150 |
\keys_set:nn { hyp / info } { #1 } |
| 4151 |
} |
| 4152 |
} |
| 4153 |
% \end{macrocode} |
| 4154 |
% \end{hypkey} |
| 4155 |
% Now we set some default values |
| 4156 |
% \begin{macrocode} |
| 4157 |
\keys_set:nn { hyp} {pdfcreator = LaTeX~with~hyperref} |
| 4158 |
\keys_set:nn { hyp} {pdfauthor = } |
| 4159 |
\keys_set:nn { hyp} {pdftitle = } |
| 4160 |
\keys_set:nn { hyp} {pdfsubject = } |
| 4161 |
% \end{macrocode} |
| 4162 |
% |
| 4163 |
% \subsection{hyperxmp keys} |
| 4164 |
% hyperxmp defines lots of keys for \cs{hypersetup}. |
| 4165 |
% They now longer work with this driver. So we provide most of them, |
| 4166 |
% but they are only stored as metadata: |
| 4167 |
% \begin{macrocode} |
| 4168 |
\clist_map_inline:nn |
| 4169 |
{ |
| 4170 |
,pdfcopyright |
| 4171 |
,pdftype |
| 4172 |
,pdflicenseurl |
| 4173 |
,pdfauthortitle |
| 4174 |
,pdfcaptionwriter |
| 4175 |
,pdfmetalang |
| 4176 |
,pdfsource |
| 4177 |
,pdfdocumentid |
| 4178 |
,pdfinstanceid |
| 4179 |
,pdfversionid |
| 4180 |
,pdfrendition |
| 4181 |
,pdfpublication |
| 4182 |
,pdfpubtype |
| 4183 |
,pdfbytes |
| 4184 |
,pdfnumpages |
| 4185 |
,pdfissn |
| 4186 |
,pdfeissn |
| 4187 |
,pdfisbn |
| 4188 |
,pdfbookedition |
| 4189 |
,pdfpublisher |
| 4190 |
,pdfvolumenum |
| 4191 |
,pdfissuenum |
| 4192 |
,pdfpagerange |
| 4193 |
,pdfdoi |
| 4194 |
,pdfurl |
| 4195 |
,pdfidentifier |
| 4196 |
,pdfsubtitle |
| 4197 |
,pdfpubstatus |
| 4198 |
,pdfcontactaddress |
| 4199 |
,pdfcontactcity |
| 4200 |
,pdfcontactregion |
| 4201 |
,pdfcontactpostcode |
| 4202 |
,pdfcontactcountry |
| 4203 |
,pdfcontactphone |
| 4204 |
,pdfcontactemail |
| 4205 |
,pdfcontacturl |
| 4206 |
,pdfdate |
| 4207 |
% \end{macrocode} |
| 4208 |
% these are not hyperxmp but new keys |
| 4209 |
% \begin{macrocode} |
| 4210 |
,pdftdmreservation |
| 4211 |
,pdftdmpolicy |
| 4212 |
} |
| 4213 |
{ |
| 4214 |
\keys_define:nn { hyp } |
| 4215 |
{ |
| 4216 |
#1 .code:n= { \@@_store_metadata:nn {#1}{##1}} |
| 4217 |
} |
| 4218 |
} |
| 4219 |
|
| 4220 |
% \end{macrocode} |
| 4221 |
% |
| 4222 |
% \subsection{Transitions} |
| 4223 |
% pdfpageduration sets the duration a page is shown in full screen mode. |
| 4224 |
% \begin{macrocode} |
| 4225 |
\keys_define:nn { hyp } |
| 4226 |
{ |
| 4227 |
pdfpageduration .code:n = |
| 4228 |
{ |
| 4229 |
\tl_if_blank:nTF { #1 } |
| 4230 |
{ |
| 4231 |
\pdfmanagement_remove:nn {Page}{Dur} |
| 4232 |
} |
| 4233 |
{ |
| 4234 |
\pdfmanagement_add:nnn {Page}{Dur}{#1} |
| 4235 |
} |
| 4236 |
} |
| 4237 |
} |
| 4238 |
% \end{macrocode} |
| 4239 |
% Transition settings are used by (some) pdf viewers when presenting a |
| 4240 |
% pdf in full screen mode. They are added to the page settings and describe the |
| 4241 |
% transition from the previous page to current page. Transition setting can be |
| 4242 |
% set in the preamble for all pages or in the document for the current and the |
| 4243 |
% following pages. Due to the asynchronous page breaking one has to be careful |
| 4244 |
% to set it on the right page, e.g. only after a |\newpage|. |
| 4245 |
% The generic driver uses a different syntax than the other \pkg{hyperref} drivers: |
| 4246 |
% various transition options can be set by a keyval syntax in the value of |
| 4247 |
% |pdfpagetransition|. A typical setting looks e.g. like this\\ |
| 4248 |
% |\hypersetup{pdfpagetransition={style=Fly,duration=2,direction=90,opaque=false}}| |
| 4249 |
% |
| 4250 |
% The keys allowed in the argument of |pdfpagetransition| are |
| 4251 |
% |
| 4252 |
% \begin{tabular}{l>{\raggedright\arraybackslash}p{6cm}} |
| 4253 |
% style & one of Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade\\ |
| 4254 |
% duration & a number, describes the duration of the transition\\ |
| 4255 |
% direction& \begin{tabular}[t]{l} |
| 4256 |
% H~(horizontal,~only~Split,~Blinds)\\ |
| 4257 |
% V~(vertical,~only~Split,~Blinds)\\ |
| 4258 |
% 0~(left~to~right,~only~Wipe,~Glitter,~Fly,~Cover,~Uncover,~Push)\\ |
| 4259 |
% 90~(bottom~to~top,~only~Wipe)\\ |
| 4260 |
% 180~(right~to~left,~only~Wipe)\\ |
| 4261 |
% 270~(top~to~bottom,~only~Wipe,~Glitter,~Fly,~Cover,~Uncover,~Push)\\ |
| 4262 |
% 315~(top~left~to~bottom,~only~Glitter)\\ |
| 4263 |
% None~(only~Fly) |
| 4264 |
% \end{tabular}\\ |
| 4265 |
% motion & one of I, O, only relevant for Split, Box and Fly\\ |
| 4266 |
% scale & a number, only relevant for Fly style \\ |
| 4267 |
% opaque & true or false, only relevant for Fly style |
| 4268 |
% \end{tabular} |
| 4269 |
% \begin{macrocode} |
| 4270 |
\keys_define:nn { hyp } |
| 4271 |
{ |
| 4272 |
pdfpagetransition .code:n = |
| 4273 |
{ |
| 4274 |
\tl_if_blank:nTF {#1} |
| 4275 |
{ |
| 4276 |
\pdfmanagement_remove:nn {Page}{Trans} |
| 4277 |
} |
| 4278 |
{ |
| 4279 |
\group_begin: |
| 4280 |
\keys_set:nn { hyp / trans }{style=R,#1} |
| 4281 |
\pdf_object_unnamed_write:ne { dict } |
| 4282 |
{ |
| 4283 |
\pdfdict_use:n {l_@@_page/Trans} |
| 4284 |
} |
| 4285 |
\pdfmanagement_add:nne {Page}{Trans}{\pdf_object_ref_last:} |
| 4286 |
\group_end: |
| 4287 |
} |
| 4288 |
} |
| 4289 |
} |
| 4290 |
\keys_define:nn { hyp / trans } |
| 4291 |
{ |
| 4292 |
,style .choices:nn = |
| 4293 |
{Split,Blinds,Box,Wipe,Dissolve,Glitter,R,Fly,Push,Cover,Uncover,Fade} |
| 4294 |
{ \pdfdict_put:nnn {l_@@_page/Trans}{ S }{/#1} } |
| 4295 |
,style / unknown .code:n = |
| 4296 |
{ |
| 4297 |
\msg_warning:nneee { hyp } { unknown-choice } |
| 4298 |
{ trans / style } |
| 4299 |
{ Split,Blinds,Box,Wipe,Dissolve,Glitter,R,Fly,Push,Cover,Uncover,Fade } |
| 4300 |
{ \exp_not:n {#1} } |
| 4301 |
} |
| 4302 |
,duration .code:n = |
| 4303 |
{ |
| 4304 |
\pdfdict_put:nnn {l_@@_page/Trans}{ D }{#1} |
| 4305 |
} |
| 4306 |
,direction .choices:nn = |
| 4307 |
{H,V} |
| 4308 |
{ \pdfdict_put:nnn {l_@@_page/Trans}{ Dm }{/#1} } |
| 4309 |
,direction .choices:nn = |
| 4310 |
{0,90,180,270,315} |
| 4311 |
{ \pdfdict_put:nnn {l_@@_page/Trans}{ Di }{ #1 } } |
| 4312 |
,direction / None .code:n = |
| 4313 |
{ \pdfdict_put:nnn {l_@@_page/Trans}{ Di }{ /None } } |
| 4314 |
,direction / unknown .code:n = |
| 4315 |
{ |
| 4316 |
\msg_warning:nneee { hyp } { unknown-choice } |
| 4317 |
{ trans / direction } |
| 4318 |
{ |
| 4319 |
H~(horizontal,~only~Split,~Blinds), |
| 4320 |
V~(vertical,~only~Split,~Blinds), |
| 4321 |
0~(left~to~right,~only~Wipe,~Glitter,~Fly,~Cover,~Uncover,~Push), |
| 4322 |
90~(bottom~to~top,~only~Wipe), |
| 4323 |
180~(right~to~left,~only~Wipe), |
| 4324 |
270~(top~to~bottom,~only~Wipe,~Glitter,~Fly,~Cover,~Uncover,~Push), |
| 4325 |
315~(top~left~to~bottom,~only~Glitter), |
| 4326 |
None~(only~Fly) |
| 4327 |
} |
| 4328 |
{ \exp_not:n {#1} } |
| 4329 |
} |
| 4330 |
,motion .choices:nn = |
| 4331 |
{I,O} |
| 4332 |
{ \pdfdict_put:nnn {l_@@_page/Trans}{ M }{/#1} } |
| 4333 |
,motion / unknown .code:n = |
| 4334 |
{ |
| 4335 |
\msg_warning:nneee { hyp } { unknown-choice } |
| 4336 |
{ trans / motion } |
| 4337 |
{ I~(inwards) , O~(outwards) } |
| 4338 |
{ \exp_not:n {#1} } |
| 4339 |
} |
| 4340 |
,scale .code:n = |
| 4341 |
{ \pdfdict_put:nnn { l_@@_page/Trans }{ SS }{ #1 } } |
| 4342 |
,opaque .choices:nn = {true,false} |
| 4343 |
{ \pdfdict_put:nnn { l_@@_page/Trans }{ B } { #1} } |
| 4344 |
,opaque / unknown .code:n = |
| 4345 |
{ |
| 4346 |
\msg_warning:nneee { hyp } { unknown-choice } |
| 4347 |
{ trans / B } |
| 4348 |
{ true~(opaque~back,~only~Fly), false~(opaque~back,~only~Fly) } |
| 4349 |
{ \exp_not:n {#1} } |
| 4350 |
} |
| 4351 |
% try to set unknown keys as style |
| 4352 |
,unknown .code:n = |
| 4353 |
{ |
| 4354 |
% warning ... |
| 4355 |
\exp_args:Nne\keys_set:nn {hyp/trans}{ style=\l_keys_key_str } |
| 4356 |
} |
| 4357 |
} |
| 4358 |
% \end{macrocode} |
| 4359 |
% |
| 4360 |
% Finally we process the package option list, to get most keys working |
| 4361 |
% \begin{macrocode} |
| 4362 |
\keys_set_known:nv{ hyp }{[email protected]} |
| 4363 |
% \end{macrocode} |
| 4364 |
% |
| 4365 |
% Unfinished, from here on @@ notation is disabled |
| 4366 |
%% Form field code |
| 4367 |
% \begin{macrocode} |
| 4368 |
%<@@=> |
| 4369 |
\NewDocumentCommand \MakeFieldObject { m m } |
| 4370 |
{ |
| 4371 |
\pdfxform_new:nnn { #2 }{} { #1 } |
| 4372 |
} |
| 4373 |
|
| 4374 |
|
| 4375 |
\prop_new:N \g__hyp_AcroForm_CoFields_prop |
| 4376 |
\prop_new:N \g__hyp_AcroForm_Fields_prop |
| 4377 |
|
| 4378 |
\let\HyField@afields\@empty |
| 4379 |
\let\HyField@cofields\@empty |
| 4380 |
\def\HyField@AfterAuxOpen{\Hy@AtBeginDocument}% |
| 4381 |
|
| 4382 |
% the value doesn't matter, but with a prop we avoid duplicates and it is |
| 4383 |
% clearly faster than removing them from a sequence |
| 4384 |
\def\HyField@AuxAddToFields#1 |
| 4385 |
{ |
| 4386 |
\prop_gput:Nnn \g__hyp_AcroForm_Fields_prop {#1}{F} |
| 4387 |
}% |
| 4388 |
|
| 4389 |
%fields with empty key get a value too -- lets hope that |
| 4390 |
%this give the expected behaviour |
| 4391 |
\def\HyField@AuxAddToCoFields #1 #2 |
| 4392 |
{ |
| 4393 |
\prop_gput:Nnn \g__hyp_AcroForm_CoFields_prop {a#1}{#2} |
| 4394 |
} |
| 4395 |
|
| 4396 |
\Hy@AtBeginDocument |
| 4397 |
{ |
| 4398 |
\if@filesw |
| 4399 |
\immediate\write\@mainaux{% |
| 4400 |
\string\providecommand\string\HyField@AuxAddToFields[1]{}% |
| 4401 |
}% |
| 4402 |
\immediate\write\@mainaux{% |
| 4403 |
\string\providecommand\string\HyField@AuxAddToCoFields[2]{}% |
| 4404 |
}% |
| 4405 |
\fi |
| 4406 |
\let\HyField@AfterAuxOpen\@firstofone |
| 4407 |
}% |
| 4408 |
|
| 4409 |
\def\HyField@AddToFields |
| 4410 |
{ |
| 4411 |
\exp_args:Ne\HyField@@AddToFields |
| 4412 |
{ |
| 4413 |
\pdfannot_box_ref_last: |
| 4414 |
} |
| 4415 |
\ifx\Fld@calculate@code\@empty |
| 4416 |
\else |
| 4417 |
\begingroup |
| 4418 |
\Hy@safe@activestrue |
| 4419 |
\edef\Hy@temp{% |
| 4420 |
\endgroup |
| 4421 |
\if@filesw |
| 4422 |
\write\@mainaux |
| 4423 |
{ |
| 4424 |
\string\HyField@AuxAddToCoFields |
| 4425 |
{ |
| 4426 |
\Fld@calculate@sortkey |
| 4427 |
} |
| 4428 |
{ |
| 4429 |
\pdfannot_box_ref_last: |
| 4430 |
} |
| 4431 |
} |
| 4432 |
\fi |
| 4433 |
}% |
| 4434 |
\Hy@temp |
| 4435 |
\fi |
| 4436 |
}% |
| 4437 |
|
| 4438 |
\def\HyField@@AddToFields#1{ |
| 4439 |
\HyField@AfterAuxOpen{% |
| 4440 |
\if@filesw |
| 4441 |
\write\@mainaux{% |
| 4442 |
\string\HyField@AuxAddToFields{#1}% |
| 4443 |
}% |
| 4444 |
\fi |
| 4445 |
}% |
| 4446 |
}% |
| 4447 |
|
| 4448 |
\ExplSyntaxOff |
| 4449 |
\ExplSyntaxOn |
| 4450 |
|
| 4451 |
\def\@Form[#1] |
| 4452 |
{ |
| 4453 |
\kvsetkeys{Form}{#1} |
| 4454 |
\pdf@ifdraftmode{} |
| 4455 |
{ |
| 4456 |
\Hy@FormObjects |
| 4457 |
\prop_map_inline:Nn \g__hyp_AcroForm_Fields_prop |
| 4458 |
{ |
| 4459 |
\pdfmanagement_add:nne { Catalog / AcroForm } { Fields }{##1} |
| 4460 |
%\pdfmanagement_show:n { Catalog / AcroForm } |
| 4461 |
} |
| 4462 |
\prop_if_empty:NF \g__hyp_AcroForm_CoFields_prop |
| 4463 |
{ |
| 4464 |
\prop_map_inline:Nn \g__hyp_AcroForm_CoFields_prop |
| 4465 |
{ |
| 4466 |
\seq_put_right:Nn \l__hyp_tmpa_seq {##1} |
| 4467 |
} |
| 4468 |
\seq_sort:Nn \l__hyp_tmpa_seq |
| 4469 |
{ |
| 4470 |
\str_compare:nNnTF {##1} > {##2} |
| 4471 |
{ \sort_return_swapped: } |
| 4472 |
{ \sort_return_same: } |
| 4473 |
} |
| 4474 |
\seq_map_inline:Nn \l__hyp_tmpa_seq |
| 4475 |
{ |
| 4476 |
\pdfmanagement_add:nne { Catalog / AcroForm } |
| 4477 |
{ CO } |
| 4478 |
{ |
| 4479 |
\prop_item:Nn \g__hyp_AcroForm_CoFields_prop {##1} |
| 4480 |
} |
| 4481 |
} |
| 4482 |
} |
| 4483 |
\pdfmanagement_add:nne {Catalog / AcroForm/DR/Font } |
| 4484 |
{ZaDb} {\pdf_object_ref:n {__hyp/Font/ZaDb} } |
| 4485 |
\pdfmanagement_add:nne {Catalog / AcroForm/DR/Font } |
| 4486 |
{Helv} {\pdf_object_ref:n {__hyp/Font/Helv} } |
| 4487 |
\pdfmanagement_add:nne {Catalog /AcroForm} |
| 4488 |
{DA}{(/Helv~10~Tf~0~g)} |
| 4489 |
\pdfmeta_standard_verify:nTF {form_no_NeedAppearance} |
| 4490 |
{ |
| 4491 |
\legacy_if:nT { HyField@NeedAppearances } |
| 4492 |
{ |
| 4493 |
\pdfmanagement_add:nnn {Catalog / AcroForm }{NeedAppearances}{true} |
| 4494 |
} |
| 4495 |
} |
| 4496 |
{ |
| 4497 |
\pdfmanagement_remove:nn {Catalog / AcroForm }{NeedAppearances} |
| 4498 |
} |
| 4499 |
} |
| 4500 |
} |
| 4501 |
\ExplSyntaxOff |
| 4502 |
\let\@endForm\@empty |
| 4503 |
\let\HyAnn@AbsPageLabel\@empty |
| 4504 |
\let\Fld@pageobjref\@empty |
| 4505 |
|
| 4506 |
\ExplSyntaxOn |
| 4507 |
\newcount\HyAnn@Count |
| 4508 |
\HyAnn@Count=\z@ |
| 4509 |
\def\HyAnn@AbsPageLabel |
| 4510 |
{ |
| 4511 |
\global\advance\HyAnn@Count by\@ne |
| 4512 |
\__hyp_property_record:ee {HyAnn@\the\HyAnn@Count}{abspage} |
| 4513 |
\property_ref_undefined_warn:ee {HyAnn@\the\HyAnn@Count}{abspage} |
| 4514 |
}% |
| 4515 |
\prg_generate_conditional_variant:Nnn \property_if_recorded:nn {ee} {T} |
| 4516 |
\def\Fld@pageobjref |
| 4517 |
{ |
| 4518 |
\property_if_recorded:eeT {HyAnn@\the\HyAnn@Count}{abspage} |
| 4519 |
{ |
| 4520 |
/P~\pdf_pageobject_ref:e |
| 4521 |
{ |
| 4522 |
\property_ref:ee{HyAnn@\the\HyAnn@Count}{abspage} |
| 4523 |
} |
| 4524 |
} |
| 4525 |
} |
| 4526 |
%% check if the attr should be set through |
| 4527 |
%% hooks. |
| 4528 |
%% check if options are missing. |
| 4529 |
\def\@TextField[#1]#2{% parameters, label |
| 4530 |
\def\Fld@name{#2}% |
| 4531 |
\let\Fld@default\@empty |
| 4532 |
\let\Fld@value\@empty |
| 4533 |
\def\Fld@width{\DefaultWidthofText}% |
| 4534 |
\def\Fld@height{% |
| 4535 |
\ifFld@multiline |
| 4536 |
\DefaultHeightofTextMultiline |
| 4537 |
\else |
| 4538 |
\DefaultHeightofText |
| 4539 |
\fi |
| 4540 |
}% |
| 4541 |
\begingroup |
| 4542 |
\expandafter\HyField@SetKeys\expandafter{% |
| 4543 |
\DefaultOptionsofText,#1% |
| 4544 |
}% |
| 4545 |
\PDFForm@Name |
| 4546 |
\HyField@FlagsText |
| 4547 |
\ifFld@hidden\def\Fld@width{1sp}\fi |
| 4548 |
\ifx\Fld@value\@empty\def\Fld@value{\Fld@default}\fi |
| 4549 |
\LayoutTextField{#2}{% |
| 4550 |
\leavevmode |
| 4551 |
\HyAnn@AbsPageLabel |
| 4552 |
\Hy@escapeform\PDFForm@Text |
| 4553 |
\pdfannot_box:nnnn |
| 4554 |
{\Fld@width} |
| 4555 |
{\Fld@height} |
| 4556 |
{0pt} %is this correct? |
| 4557 |
{\PDFForm@Text} |
| 4558 |
\MakeTextField{\Fld@width}{\Fld@height} |
| 4559 |
\HyField@AddToFields |
| 4560 |
}% |
| 4561 |
\endgroup |
| 4562 |
} |
| 4563 |
\providecommand\@curropt{} |
| 4564 |
\def\@ChoiceMenu[#1]#2#3{% parameters, label, choices |
| 4565 |
\def\Fld@name{#2} |
| 4566 |
\let\Fld@default\relax |
| 4567 |
\let\Fld@value\relax |
| 4568 |
\def\Fld@width{\DefaultWidthofChoiceMenu} |
| 4569 |
\def\Fld@height{\DefaultHeightofChoiceMenu} |
| 4570 |
\begingroup |
| 4571 |
\Fld@menulength=0 % |
| 4572 |
\@tempdima\z@ |
| 4573 |
\clist_map_variable:nNn { #3 } \@curropt |
| 4574 |
%\@for\@curropt:=#3\do |
| 4575 |
{% |
| 4576 |
\expandafter\Fld@checkequals\@curropt==\\% |
| 4577 |
\Hy@StepCount\Fld@menulength |
| 4578 |
\settowidth{\@tempdimb}{\@currDisplay}% |
| 4579 |
\ifdim\@tempdimb>\@tempdima\@tempdima\@tempdimb\fi |
| 4580 |
}% |
| 4581 |
\advance\@tempdima by~15\p@ |
| 4582 |
\begingroup |
| 4583 |
\HyField@SetKeys{#1} |
| 4584 |
\edef\x{\endgroup |
| 4585 |
\noexpand\expandafter |
| 4586 |
\noexpand\HyField@SetKeys |
| 4587 |
\noexpand\expandafter{% |
| 4588 |
\expandafter\noexpand\csname DefaultOptionsof% |
| 4589 |
\ifFld@radio |
| 4590 |
Radio% |
| 4591 |
\else |
| 4592 |
\ifFld@combo |
| 4593 |
\ifFld@popdown |
| 4594 |
PopdownBox% |
| 4595 |
\else |
| 4596 |
ComboBox% |
| 4597 |
\fi |
| 4598 |
\else |
| 4599 |
ListBox% |
| 4600 |
\fi |
| 4601 |
\fi |
| 4602 |
\endcsname |
| 4603 |
}% |
| 4604 |
}\x |
| 4605 |
\HyField@SetKeys{#1}% |
| 4606 |
\PDFForm@Name |
| 4607 |
\ifFld@hidden\def\Fld@width{1sp}\fi |
| 4608 |
\ifx\Fld@value\relax |
| 4609 |
\let\Fld@value\Fld@default |
| 4610 |
\fi |
| 4611 |
\LayoutChoiceField{#2}{% |
| 4612 |
\ifFld@radio |
| 4613 |
\HyField@FlagsRadioButton |
| 4614 |
\@@Radio{#3}% |
| 4615 |
\else |
| 4616 |
\begingroup |
| 4617 |
\HyField@FlagsChoice |
| 4618 |
\ifdim\Fld@width<\@tempdima |
| 4619 |
\ifdim\@tempdima<1cm\@tempdima1cm\fi |
| 4620 |
\edef\Fld@width{\the\@tempdima}% |
| 4621 |
\fi |
| 4622 |
\ifFld@combo |
| 4623 |
\else |
| 4624 |
\@tempdima=\the\Fld@menulength\Fld@charsize |
| 4625 |
\advance\@tempdima by~\Fld@borderwidth bp % |
| 4626 |
\advance\@tempdima by~\Fld@borderwidth bp % |
| 4627 |
\edef\Fld@height{\the\@tempdima}% |
| 4628 |
\fi |
| 4629 |
\@@Listbox{#3}% |
| 4630 |
\endgroup |
| 4631 |
\fi |
| 4632 |
}% |
| 4633 |
\endgroup |
| 4634 |
} |
| 4635 |
|
| 4636 |
\def\@@Radio#1{% |
| 4637 |
\Fld@listcount=0~% |
| 4638 |
\EdefEscapeName\Fld@default{\Fld@default}% |
| 4639 |
\clist_map_variable:nNn { #1 } \@curropt |
| 4640 |
{% |
| 4641 |
\expandafter\Fld@checkequals\@curropt==\\% |
| 4642 |
\EdefEscapeName\@currValue{\@currValue}% |
| 4643 |
\Hy@StepCount\Fld@listcount |
| 4644 |
\@currDisplay\space |
| 4645 |
\leavevmode |
| 4646 |
\HyAnn@AbsPageLabel |
| 4647 |
\Hy@escapeform\PDFForm@Radio |
| 4648 |
\pdfxform_if_exist:nF { __hyp_xform_Ding } |
| 4649 |
{ |
| 4650 |
\pdfxform_new:nnn { __hyp_xform_Ding } {} |
| 4651 |
{ |
| 4652 |
\group_begin: |
| 4653 |
\fontfamily{pzd} |
| 4654 |
\fontencoding{U} |
| 4655 |
\fontseries{m} |
| 4656 |
\fontshape{n} |
| 4657 |
\selectfont |
| 4658 |
\char123 |
| 4659 |
\group_end: |
| 4660 |
} |
| 4661 |
} |
| 4662 |
\pdfannot_box:nnne |
| 4663 |
{\Fld@width} |
| 4664 |
{\Fld@height} |
| 4665 |
{0pt} %is this correct? |
| 4666 |
{ |
| 4667 |
\PDFForm@Radio |
| 4668 |
/AP |
| 4669 |
<< |
| 4670 |
/N |
| 4671 |
<< |
| 4672 |
/\@currValue\c_space_tl \pdfxform_ref:n {__hyp_xform_Ding} |
| 4673 |
%/Off \c_space_tl \pdfxform_ref:n {__hyp_xform_DingOff} %hm |
| 4674 |
>> |
| 4675 |
>> |
| 4676 |
} |
| 4677 |
{\fbox{ \MakeRadioField{\Fld@width}{\Fld@height}} } |
| 4678 |
\int_compare:nNnT { \Fld@listcount} = { 1 } |
| 4679 |
{ \HyField@AddToFields } |
| 4680 |
\c_space_tl % deliberate space between radio buttons |
| 4681 |
% to do: --> should be configurable |
| 4682 |
}% |
| 4683 |
} |
| 4684 |
|
| 4685 |
\newcount\Fld@listcount |
| 4686 |
\def\@@Listbox#1 |
| 4687 |
{ |
| 4688 |
\HyField@PDFChoices{#1} |
| 4689 |
\mode_leave_vertical: |
| 4690 |
\HyAnn@AbsPageLabel |
| 4691 |
\Hy@escapeform\PDFForm@List |
| 4692 |
\pdfannot_box:nnnn |
| 4693 |
{\Fld@width}{\Fld@height}{0pt} |
| 4694 |
{\PDFForm@List} |
| 4695 |
\MakeChoiceField{\Fld@width}{\Fld@height} |
| 4696 |
\HyField@AddToFields |
| 4697 |
} |
| 4698 |
|
| 4699 |
|
| 4700 |
\def\@PushButton[#1]#2{% parameters, label |
| 4701 |
\def\Fld@name{#2}% |
| 4702 |
\group_begin: |
| 4703 |
\exp_args:No\HyField@SetKeys |
| 4704 |
{ |
| 4705 |
\DefaultOptionsofPushButton,#1 |
| 4706 |
} |
| 4707 |
\PDFForm@Name |
| 4708 |
\pdfmeta_standard_verify:nnTF {annot_action_A}{JavaScript} |
| 4709 |
{ |
| 4710 |
\HyField@FlagsPushButton |
| 4711 |
\legacy_if:nT {Fld@hidden} |
| 4712 |
{ |
| 4713 |
\def\Fld@width{1sp} |
| 4714 |
} |
| 4715 |
\LayoutPushButtonField |
| 4716 |
{ |
| 4717 |
\mode_leave_vertical: |
| 4718 |
\HyAnn@AbsPageLabel |
| 4719 |
\Hy@escapeform\PDFForm@Push |
| 4720 |
\hbox_set:Nn \l_tmpa_box { \MakeButtonField {#2}} |
| 4721 |
\pdfannot_box:nnnn |
| 4722 |
{\box_wd:N\l_tmpa_box} |
| 4723 |
{\box_ht:N\l_tmpa_box} |
| 4724 |
{\box_dp:N\l_tmpa_box} %is this correct? |
| 4725 |
{\PDFForm@Push} |
| 4726 |
{\box_use:N\l_tmpa_box} |
| 4727 |
\HyField@AddToFields |
| 4728 |
} |
| 4729 |
} |
| 4730 |
{ |
| 4731 |
\msg_error:nn { hyp }{ pdfa-no-push-button } |
| 4732 |
\LayoutPushButtonField |
| 4733 |
{ |
| 4734 |
\mode_leave_vertical: |
| 4735 |
\MakeButtonField{#2} |
| 4736 |
} |
| 4737 |
} |
| 4738 |
\group_end: |
| 4739 |
} |
| 4740 |
|
| 4741 |
\def\@Submit[#1]#2 |
| 4742 |
{ |
| 4743 |
\def\Fld@width {\DefaultWidthofSubmit} |
| 4744 |
\def\Fld@height{\DefaultHeightofSubmit} |
| 4745 |
\group_begin: |
| 4746 |
\exp_args:No\HyField@SetKeys |
| 4747 |
{ |
| 4748 |
\DefaultOptionsofSubmit,#1 |
| 4749 |
} |
| 4750 |
\HyField@FlagsPushButton |
| 4751 |
\HyField@FlagsSubmit |
| 4752 |
\legacy_if:nT { Fld@hidden } |
| 4753 |
{ |
| 4754 |
\def\Fld@width{1sp} |
| 4755 |
} |
| 4756 |
\mode_leave_vertical: |
| 4757 |
\HyAnn@AbsPageLabel |
| 4758 |
\Hy@escapeform\PDFForm@Submit |
| 4759 |
\hbox_set:Nn \l_tmpa_box { \MakeButtonField {#2}} |
| 4760 |
\pdfxform_if_exist:nF |
| 4761 |
{ __hyp_xform_Submit } |
| 4762 |
{ |
| 4763 |
\pdfxform_new:nnn { __hyp_xform_Submit }{} |
| 4764 |
{ |
| 4765 |
\fbox{\color_select:n{yellow}\textsf{Submit}} |
| 4766 |
} |
| 4767 |
\pdfxform_new:nnn { __hyp_xform_SubmitP }{} |
| 4768 |
{ |
| 4769 |
\fbox{\color_select:n{yellow}\textsf{SubmitP}} |
| 4770 |
} |
| 4771 |
} |
| 4772 |
\pdfannot_box:nnnn |
| 4773 |
{\box_wd:N\l_tmpa_box} |
| 4774 |
{\box_ht:N\l_tmpa_box} |
| 4775 |
{\box_dp:N\l_tmpa_box} %is this correct? |
| 4776 |
{ |
| 4777 |
\PDFForm@Submit |
| 4778 |
/AP<< |
| 4779 |
/N~\pdfxform_ref:n {__hyp_xform_Submit}~ |
| 4780 |
/D~\pdfxform_ref:n {__hyp_xform_SubmitP} |
| 4781 |
>> |
| 4782 |
} |
| 4783 |
\HyField@AddToFields |
| 4784 |
\box_use:N\l_tmpa_box |
| 4785 |
|
| 4786 |
\group_end: |
| 4787 |
} |
| 4788 |
|
| 4789 |
\def\@Reset[#1]#2 |
| 4790 |
{ |
| 4791 |
\def\Fld@width {\DefaultWidthofReset} |
| 4792 |
\def\Fld@height{\DefaultHeightofReset} |
| 4793 |
\group_begin: |
| 4794 |
\exp_args:No\HyField@SetKeys |
| 4795 |
{ |
| 4796 |
\DefaultOptionsofReset,#1 |
| 4797 |
} |
| 4798 |
\mode_leave_vertical: |
| 4799 |
\pdfmeta_standard_verify:nnTF {annot_action_A}{ResetForm} |
| 4800 |
{ |
| 4801 |
\HyField@FlagsPushButton |
| 4802 |
\legacy_if:nT { Fld@hidden } |
| 4803 |
{ \def\Fld@width{1sp} } |
| 4804 |
\HyAnn@AbsPageLabel |
| 4805 |
\Hy@escapeform\PDFForm@Reset |
| 4806 |
\hbox_set:Nn \l_tmpa_box { \MakeButtonField {#2}} |
| 4807 |
\pdfannot_box:nnnn |
| 4808 |
{\box_wd:N\l_tmpa_box} |
| 4809 |
{\box_ht:N\l_tmpa_box} |
| 4810 |
{\box_dp:N\l_tmpa_box} %is this correct? |
| 4811 |
{ \PDFForm@Reset } |
| 4812 |
\HyField@AddToFields |
| 4813 |
\box_use:N \l_tmpa_box |
| 4814 |
} |
| 4815 |
{ |
| 4816 |
\msg_error:nn { hyp }{ pdfa-no-reset-button } |
| 4817 |
\MakeButtonField{#2} |
| 4818 |
} |
| 4819 |
\group_end: |
| 4820 |
} |
| 4821 |
|
| 4822 |
\def\@CheckBox[#1]#2 |
| 4823 |
{% parameters, label |
| 4824 |
\def\Fld@name{#2} |
| 4825 |
\def\Fld@default{0} |
| 4826 |
\group_begin: |
| 4827 |
\def\Fld@width {\DefaultWidthofCheckBox} |
| 4828 |
\def\Fld@height{\DefaultHeightofCheckBox} |
| 4829 |
\exp_args:No\HyField@SetKeys |
| 4830 |
{ |
| 4831 |
\DefaultOptionsofCheckBox,#1 |
| 4832 |
} |
| 4833 |
\PDFForm@Name |
| 4834 |
\HyField@FlagsCheckBox |
| 4835 |
\legacy_if:nT { Fld@hidden } |
| 4836 |
{ |
| 4837 |
\def\Fld@width{1sp} |
| 4838 |
} |
| 4839 |
\LayoutCheckField{#2} |
| 4840 |
{ |
| 4841 |
\mode_leave_vertical: |
| 4842 |
\HyAnn@AbsPageLabel |
| 4843 |
\Hy@escapeform\PDFForm@Check |
| 4844 |
\pdfxform_if_exist:nF { __hyp_xform_CheckMarkYes } |
| 4845 |
{ |
| 4846 |
\pdfxform_new:nnn |
| 4847 |
{__hyp_xform_CheckMarkYes}{} |
| 4848 |
{ |
| 4849 |
\group_begin: |
| 4850 |
\fontfamily{pzd} |
| 4851 |
\fontencoding{U} |
| 4852 |
\fontseries{m} |
| 4853 |
\fontshape{n} |
| 4854 |
\selectfont |
| 4855 |
\char51 |
| 4856 |
\group_end: |
| 4857 |
} |
| 4858 |
\pdfxform_new:nnn |
| 4859 |
{__hyp_xform_CheckMarkOff}{} |
| 4860 |
{ |
| 4861 |
\group_begin: |
| 4862 |
\fontfamily{pzd} |
| 4863 |
\fontencoding{U} |
| 4864 |
\fontseries{m} |
| 4865 |
\fontshape{n} |
| 4866 |
\selectfont |
| 4867 |
\phantom{\char51} %perhaps xetex needs some small glyph .. |
| 4868 |
\group_end: |
| 4869 |
} |
| 4870 |
} |
| 4871 |
\pdfannot_box:nnnn |
| 4872 |
{\Fld@width} |
| 4873 |
{\Fld@height} |
| 4874 |
{0pt} %is this correct? |
| 4875 |
{\PDFForm@Check} |
| 4876 |
\HyField@AddToFields %check if this works with xelatex ... |
| 4877 |
} |
| 4878 |
\group_end: |
| 4879 |
} |
| 4880 |
%hm. Should a luatex driver use type1 fonts in fields???? |
| 4881 |
\def\Hy@FormObjects |
| 4882 |
{ |
| 4883 |
\pdf_object_new:n {__hyp/Encoding/pdfdoc } |
| 4884 |
\pdf_object_new:n {__hyp/Font/ZaDb } |
| 4885 |
\pdf_object_new:n {__hyp/Font/Helv } |
| 4886 |
\pdf_object_write:nne {__hyp/Encoding/pdfdoc } { dict } |
| 4887 |
{ |
| 4888 |
/Type/Encoding |
| 4889 |
/Differences[ |
| 4890 |
24/breve/caron/circumflex/dotaccent/hungarumlaut/ogonek |
| 4891 |
/ring/tilde |
| 4892 |
\c_space_tl |
| 4893 |
39/quotesingle |
| 4894 |
\c_space_tl |
| 4895 |
96/grave % |
| 4896 |
\iow_newline: |
| 4897 |
128/bullet/dagger/daggerdbl/ellipsis/emdash/endash/florin |
| 4898 |
/fraction/guilsinglleft/guilsinglright/minus/perthousand |
| 4899 |
/quotedblbase/quotedblleft/quotedblright/quoteleft |
| 4900 |
/quoteright/quotesinglbase/trademark/fi/fl/Lslash/OE |
| 4901 |
/Scaron/Ydieresis/Zcaron/dotlessi/lslash/oe/scaron/zcaron |
| 4902 |
\iow_newline: |
| 4903 |
164/currency |
| 4904 |
\c_space_tl |
| 4905 |
166/brokenbar |
| 4906 |
\c_space_tl |
| 4907 |
168/dieresis/copyright/ordfeminine |
| 4908 |
\c_space_tl |
| 4909 |
172/logicalnot/.notdef/registered/macron/degree/plusminus |
| 4910 |
/twosuperior/threesuperior/acute/mu |
| 4911 |
\c_space_tl |
| 4912 |
183/periodcentered/cedilla/onesuperior/ordmasculine |
| 4913 |
\c_space_tl |
| 4914 |
188/onequarter/onehalf/threequarters |
| 4915 |
\iow_newline: |
| 4916 |
192/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE |
| 4917 |
/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave |
| 4918 |
/Iacute/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute |
| 4919 |
/Ocircumflex/Otilde/Odieresis/multiply/Oslash/Ugrave |
| 4920 |
/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls |
| 4921 |
/agrave/aacute/acircumflex/atilde/adieresis/aring/ae |
| 4922 |
/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave |
| 4923 |
/iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute |
| 4924 |
/ocircumflex/otilde/odieresis/divide/oslash/ugrave |
| 4925 |
/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis |
| 4926 |
] |
| 4927 |
} |
| 4928 |
\pdf_object_write:nnn {__hyp/Font/ZaDb } { dict } |
| 4929 |
{ |
| 4930 |
/Type/Font |
| 4931 |
/Subtype/Type1 |
| 4932 |
/Name/ZaDb |
| 4933 |
/BaseFont/ZapfDingbats |
| 4934 |
} |
| 4935 |
\pdf_object_write:nne {__hyp/Font/Helv } { dict } |
| 4936 |
{ |
| 4937 |
/Type/Font |
| 4938 |
/Subtype/Type1 |
| 4939 |
/Name/Helv |
| 4940 |
/BaseFont/Helvetica |
| 4941 |
/Encoding~\pdf_object_ref:n { __hyp/Encoding/pdfdoc } |
| 4942 |
} |
| 4943 |
\global\let\Hy@FormObjects\relax |
| 4944 |
} |
| 4945 |
\ExplSyntaxOff |
| 4946 |
\providecommand*{\Fld@pageobjref}{} |
| 4947 |
\ifcsname pdf@escapestring\endcsname |
| 4948 |
\def\Hy@escapeform#1{% |
| 4949 |
\ifHy@pdfescapeform |
| 4950 |
\let\Hy@escapestring\pdfescapestring |
| 4951 |
\else |
| 4952 |
\let\Hy@escapestring\@firstofone |
| 4953 |
\fi |
| 4954 |
}% |
| 4955 |
\Hy@escapeform{}% |
| 4956 |
\else |
| 4957 |
\let\Hy@escapestring\@firstofone |
| 4958 |
\def\Hy@escapeform#1{% |
| 4959 |
\ifHy@pdfescapeform |
| 4960 |
\def\Hy@escapestring##1{% |
| 4961 |
\noexpand\Hy@escapestring{\noexpand##1}% |
| 4962 |
}% |
| 4963 |
\edef\Hy@temp{#1}% |
| 4964 |
\expandafter\Hy@@escapeform\Hy@temp\Hy@escapestring{}\@nil |
| 4965 |
\def\Hy@escapestring##1{% |
| 4966 |
\@ifundefined{Hy@esc@\string##1}{% |
| 4967 |
##1% |
| 4968 |
\ThisShouldNotHappen |
| 4969 |
}{% |
| 4970 |
\csname Hy@esc@\string##1\endcsname |
| 4971 |
}% |
| 4972 |
}% |
| 4973 |
\else |
| 4974 |
\let\Hy@escapestring\@firstofone |
| 4975 |
\fi |
| 4976 |
}% |
| 4977 |
\def\Hy@@escapeform#1\Hy@escapestring#2#3\@nil{% |
| 4978 |
\ifx\\#3\\% |
| 4979 |
\else |
| 4980 |
\expandafter |
| 4981 |
\Hy@pstringdef\csname Hy@esc@\string#2\endcsname{#2}% probably string-hex |
| 4982 |
\Hy@ReturnAfterFi{% |
| 4983 |
\Hy@@escapeform#3\@nil |
| 4984 |
}% |
| 4985 |
\fi |
| 4986 |
}% |
| 4987 |
\fi |
| 4988 |
\def\PDFForm@Name{% |
| 4989 |
\PDFForm@@Name\Fld@name |
| 4990 |
\ifx\Fld@altname\relax |
| 4991 |
\else |
| 4992 |
\PDFForm@@Name\Fld@altname |
| 4993 |
\fi |
| 4994 |
\ifx\Fld@mappingname\relax |
| 4995 |
\else |
| 4996 |
\PDFForm@@Name\Fld@mappingname |
| 4997 |
\fi |
| 4998 |
} |
| 4999 |
\def\PDFForm@@Name#1{% |
| 5000 |
\begingroup |
| 5001 |
\ifnum\Hy@pdfversion<5 % implementation note 117, PDF spec 1.7 |
| 5002 |
\ifHy@unicode |
| 5003 |
\Hy@unicodefalse |
| 5004 |
\fi |
| 5005 |
\fi |
| 5006 |
\pdfstringdef\Hy@gtemp#1% |
| 5007 |
\endgroup |
| 5008 |
\let#1\Hy@gtemp |
| 5009 |
} |
| 5010 |
\def\Fld@X@additionalactions{% |
| 5011 |
\ifx\Fld@keystroke@code\@empty |
| 5012 |
\else |
| 5013 |
/K<</S/JavaScript/JS(\Hy@escapestring{\Fld@keystroke@code})>>% |
| 5014 |
\fi |
| 5015 |
\ifx\Fld@format@code\@empty |
| 5016 |
\else |
| 5017 |
/F<</S/JavaScript/JS(\Hy@escapestring{\Fld@format@code})>>% |
| 5018 |
\fi |
| 5019 |
\ifx\Fld@validate@code\@empty |
| 5020 |
\else |
| 5021 |
/V<</S/JavaScript/JS(\Hy@escapestring{\Fld@validate@code})>>% |
| 5022 |
\fi |
| 5023 |
\ifx\Fld@calculate@code\@empty |
| 5024 |
\else |
| 5025 |
/C<</S/JavaScript/JS(\Hy@escapestring{\Fld@calculate@code})>>% |
| 5026 |
\fi |
| 5027 |
\ifx\Fld@onfocus@code\@empty |
| 5028 |
\else |
| 5029 |
/Fo<</S/JavaScript/JS(\Hy@escapestring{\Fld@onfocus@code})>>% |
| 5030 |
\fi |
| 5031 |
\ifx\Fld@onblur@code\@empty |
| 5032 |
\else |
| 5033 |
/Bl<</S/JavaScript/JS(\Hy@escapestring{\Fld@onblur@code})>>% |
| 5034 |
\fi |
| 5035 |
\ifx\Fld@onmousedown@code\@empty |
| 5036 |
\else |
| 5037 |
/D<</S/JavaScript/JS(\Hy@escapestring{\Fld@onmousedown@code})>>% |
| 5038 |
\fi |
| 5039 |
\ifx\Fld@onmouseup@code\@empty |
| 5040 |
\else |
| 5041 |
/U<</S/JavaScript/JS(\Hy@escapestring{\Fld@onmouseup@code})>>% |
| 5042 |
\fi |
| 5043 |
\ifx\Fld@onenter@code\@empty |
| 5044 |
\else |
| 5045 |
/E<</S/JavaScript/JS(\Hy@escapestring{\Fld@onenter@code})>>% |
| 5046 |
\fi |
| 5047 |
\ifx\Fld@onexit@code\@empty |
| 5048 |
\else |
| 5049 |
/X<</S/JavaScript/JS(\Hy@escapestring{\Fld@onexit@code})>>% |
| 5050 |
\fi |
| 5051 |
} |
| 5052 |
\ExplSyntaxOn |
| 5053 |
\def\Fld@additionalactions |
| 5054 |
{% |
| 5055 |
\exp_args:Ne\str_if_eq:nnF {\Fld@X@additionalactions}{} |
| 5056 |
{ |
| 5057 |
\pdfmeta_standard_verify:nT {annot_widget_no_AA} |
| 5058 |
{/AA<<\Fld@X@additionalactions>>} |
| 5059 |
} |
| 5060 |
} |
| 5061 |
\def\Fld@annotnames{% |
| 5062 |
/T(\Fld@name)% |
| 5063 |
\ifx\Fld@altname\relax |
| 5064 |
\else |
| 5065 |
/TU(\Fld@altname)% |
| 5066 |
\fi |
| 5067 |
\ifx\Fld@mappingname\relax |
| 5068 |
\else |
| 5069 |
/TM(\Fld@mappingname)% |
| 5070 |
\fi |
| 5071 |
} |
| 5072 |
|
| 5073 |
\def\PDFForm@Check |
| 5074 |
{ |
| 5075 |
/Subtype/Widget |
| 5076 |
~\Fld@annotflags |
| 5077 |
~\Fld@pageobjref |
| 5078 |
~\Fld@annotnames |
| 5079 |
/FT/Btn |
| 5080 |
\Fld@flags |
| 5081 |
/Q~\Fld@align |
| 5082 |
/BS<</W~\Fld@borderwidth /S/\Fld@borderstyle>> |
| 5083 |
/AP |
| 5084 |
<< |
| 5085 |
/N |
| 5086 |
<< |
| 5087 |
/Yes~\pdfxform_ref:n{__hyp_xform_CheckMarkYes} |
| 5088 |
/Off~\pdfxform_ref:n{__hyp_xform_CheckMarkOff} |
| 5089 |
>> |
| 5090 |
>> |
| 5091 |
/MK<< |
| 5092 |
\int_compare:nNnF {\Fld@rotation}={0} |
| 5093 |
{ |
| 5094 |
/R~\Fld@rotation |
| 5095 |
} |
| 5096 |
\tl_if_empty:NF\Fld@bordercolor |
| 5097 |
{ |
| 5098 |
/BC[\Fld@bordercolor] |
| 5099 |
} |
| 5100 |
\tl_if_empty:NF\Fld@bcolor |
| 5101 |
{ |
| 5102 |
/BG[\Fld@bcolor] |
| 5103 |
} |
| 5104 |
/CA(\Hy@escapestring{\Fld@cbsymbol})% |
| 5105 |
>> |
| 5106 |
/DA |
| 5107 |
( |
| 5108 |
/ZaDb~\strip@pt\Fld@charsize\c_space_tl Tf |
| 5109 |
\tl_if_empty:NF \Fld@color |
| 5110 |
{ |
| 5111 |
\c_space_tl \Fld@color |
| 5112 |
} |
| 5113 |
) |
| 5114 |
/H/P |
| 5115 |
\legacy_if:nTF {Fld@checked} |
| 5116 |
{ |
| 5117 |
/V/Yes /AS/Yes |
| 5118 |
} |
| 5119 |
{ |
| 5120 |
/V/Off /AS/Off |
| 5121 |
} |
| 5122 |
\Fld@additionalactions |
| 5123 |
} |
| 5124 |
|
| 5125 |
\def\PDFForm@Push |
| 5126 |
{ |
| 5127 |
/Subtype/Widget |
| 5128 |
~\Fld@annotflags |
| 5129 |
~\Fld@pageobjref |
| 5130 |
~\Fld@annotnames |
| 5131 |
/FT/Btn |
| 5132 |
~\Fld@flags |
| 5133 |
/H/P |
| 5134 |
/BS<</W~\Fld@borderwidth/S/\Fld@borderstyle>> |
| 5135 |
\bool_if:nT |
| 5136 |
{ |
| 5137 |
!\int_compare_p:nNn {\Fld@rotation} = {0} |
| 5138 |
|| |
| 5139 |
\tl_if_exist_p:N \Fld@bordercolor |
| 5140 |
} |
| 5141 |
{ |
| 5142 |
/MK |
| 5143 |
<< |
| 5144 |
\int_compare:nNnF {\Fld@rotation} = {0} |
| 5145 |
{ |
| 5146 |
/R~\Fld@rotation |
| 5147 |
} |
| 5148 |
\tl_if_exist:NT \Fld@bordercolor |
| 5149 |
{ |
| 5150 |
/BC[\Fld@bordercolor] |
| 5151 |
} |
| 5152 |
>> |
| 5153 |
} |
| 5154 |
/A<</S/JavaScript/JS(\Hy@escapestring{\Fld@onclick@code})>> |
| 5155 |
\Fld@additionalactions |
| 5156 |
} |
| 5157 |
|
| 5158 |
\ExplSyntaxOff |
| 5159 |
\def\PDFForm@List{% |
| 5160 |
/Subtype/Widget% |
| 5161 |
\Fld@annotflags |
| 5162 |
\Fld@pageobjref |
| 5163 |
\Fld@annotnames |
| 5164 |
/FT/Ch% |
| 5165 |
\Fld@flags |
| 5166 |
/Q \Fld@align |
| 5167 |
/BS<</W \Fld@borderwidth/S/\Fld@borderstyle>>% |
| 5168 |
\ifcase0\ifnum\Fld@rotation=\z@ \else 1\fi |
| 5169 |
\ifx\Fld@bordercolor\relax\else 1\fi |
| 5170 |
\ifx\fld@bcolor\relax \else 1\fi |
| 5171 |
\space |
| 5172 |
\else |
| 5173 |
/MK<<% |
| 5174 |
\ifnum\Fld@rotation=\z@ |
| 5175 |
\else |
| 5176 |
/R \Fld@rotation |
| 5177 |
\fi |
| 5178 |
\ifx\Fld@bordercolor\relax |
| 5179 |
\else |
| 5180 |
/BC[\Fld@bordercolor]% |
| 5181 |
\fi |
| 5182 |
\ifx\Fld@bcolor\relax |
| 5183 |
\else |
| 5184 |
/BG[\Fld@bcolor]% |
| 5185 |
\fi |
| 5186 |
>>% |
| 5187 |
\fi |
| 5188 |
/DA(/Helv \strip@pt\Fld@charsize\space Tf% |
| 5189 |
\ifx\Fld@color\@empty\else\space\Fld@color\fi)% |
| 5190 |
\Fld@choices |
| 5191 |
\Fld@additionalactions |
| 5192 |
} |
| 5193 |
\ExplSyntaxOn |
| 5194 |
\def\PDFForm@Radio |
| 5195 |
{ |
| 5196 |
/Subtype/Widget |
| 5197 |
~\Fld@annotflags |
| 5198 |
~\Fld@pageobjref |
| 5199 |
~\Fld@annotnames |
| 5200 |
/FT/Btn |
| 5201 |
\Fld@flags |
| 5202 |
/H/P |
| 5203 |
/BS<</W~\Fld@borderwidth/S/\Fld@borderstyle>> |
| 5204 |
/MK<< |
| 5205 |
\ifnum\Fld@rotation=\z@ |
| 5206 |
\else |
| 5207 |
/R~\Fld@rotation |
| 5208 |
\fi |
| 5209 |
\ifx\Fld@bordercolor\relax |
| 5210 |
\else |
| 5211 |
/BC[\Fld@bordercolor]% |
| 5212 |
\fi |
| 5213 |
\ifx\Fld@bcolor\relax |
| 5214 |
\else |
| 5215 |
/BG[\Fld@bcolor]% |
| 5216 |
\fi |
| 5217 |
/CA(\Hy@escapestring{\Fld@radiosymbol})% |
| 5218 |
>> |
| 5219 |
/DA(/ZaDb~\strip@pt\Fld@charsize\space Tf% |
| 5220 |
\ifx\Fld@color\@empty\else\space\Fld@color\fi)% |
| 5221 |
\ifx\Fld@default\@empty |
| 5222 |
/V/Off% |
| 5223 |
/DV/Off% |
| 5224 |
\else |
| 5225 |
/V/\Fld@default |
| 5226 |
/DV/\Fld@default |
| 5227 |
\fi |
| 5228 |
\Fld@additionalactions |
| 5229 |
} |
| 5230 |
|
| 5231 |
% Does an appearance dict make sense here? |
| 5232 |
\def\PDFForm@Text |
| 5233 |
{ |
| 5234 |
/Subtype/Widget |
| 5235 |
~\Fld@annotflags |
| 5236 |
~\Fld@pageobjref |
| 5237 |
~\Fld@annotnames |
| 5238 |
/FT/Tx |
| 5239 |
~\Fld@flags |
| 5240 |
/Q~\Fld@align |
| 5241 |
/BS<</W~\Fld@borderwidth\c_space_tl /S /\Fld@borderstyle>> |
| 5242 |
\bool_if:nT |
| 5243 |
{ |
| 5244 |
!\int_compare_p:nNn {\Fld@rotation} = {0} |
| 5245 |
|| |
| 5246 |
\tl_if_exist_p:N \Fld@bordercolor |
| 5247 |
|| |
| 5248 |
\tl_if_exist_p:N \Fld@bcolor |
| 5249 |
} |
| 5250 |
{ |
| 5251 |
/MK |
| 5252 |
<< |
| 5253 |
\int_compare:nNnF {\Fld@rotation} = {0} |
| 5254 |
{ |
| 5255 |
/R~\Fld@rotation |
| 5256 |
} |
| 5257 |
\tl_if_exist:NT \Fld@bordercolor |
| 5258 |
{ |
| 5259 |
/BC[\Fld@bordercolor] |
| 5260 |
} |
| 5261 |
\tl_if_exist:NT \Fld@bcolor |
| 5262 |
{ |
| 5263 |
/BG[\Fld@bcolor] |
| 5264 |
} |
| 5265 |
>> |
| 5266 |
} |
| 5267 |
/DA |
| 5268 |
( |
| 5269 |
/Helv~\strip@pt\Fld@charsize\c_space_tl Tf |
| 5270 |
\tl_if_empty:NF {\c_space_tl\Fld@color} |
| 5271 |
) |
| 5272 |
/DV(\Hy@escapestring{\Fld@default}) |
| 5273 |
/V(\Hy@escapestring{\Fld@value}) |
| 5274 |
~\Fld@additionalactions |
| 5275 |
\int_compare:nNnT { \Fld@maxlen}>{0} |
| 5276 |
{ |
| 5277 |
/MaxLen~\Fld@maxlen |
| 5278 |
} |
| 5279 |
} |
| 5280 |
\ExplSyntaxOff |
| 5281 |
|
| 5282 |
\def\PDFForm@Submit{% |
| 5283 |
/Subtype/Widget% |
| 5284 |
\Fld@annotflags |
| 5285 |
\Fld@pageobjref |
| 5286 |
\Fld@annotnames |
| 5287 |
/FT/Btn% |
| 5288 |
\Fld@flags |
| 5289 |
/H/P% |
| 5290 |
/BS<</W \Fld@borderwidth/S/\Fld@borderstyle>>% |
| 5291 |
\ifcase0\ifnum\Fld@rotation=\z@ \else 1\fi |
| 5292 |
\ifx\Fld@bordercolor\relax\else 1\fi |
| 5293 |
\space |
| 5294 |
\else |
| 5295 |
/MK<<% |
| 5296 |
\ifnum\Fld@rotation=\z@ |
| 5297 |
\else |
| 5298 |
/R \Fld@rotation |
| 5299 |
\fi |
| 5300 |
\ifx\Fld@bordercolor\relax |
| 5301 |
\else |
| 5302 |
/BC[\Fld@bordercolor]% |
| 5303 |
\fi |
| 5304 |
>>% |
| 5305 |
\fi |
| 5306 |
/A<<% |
| 5307 |
/S/SubmitForm% |
| 5308 |
/F<<% |
| 5309 |
/FS/URL% |
| 5310 |
/F(\Hy@escapestring{\Form@action})% |
| 5311 |
>>% |
| 5312 |
\Fld@submitflags |
| 5313 |
>>% |
| 5314 |
\Fld@additionalactions |
| 5315 |
} |
| 5316 |
\ExplSyntaxOn |
| 5317 |
\def\PDFForm@Reset{% |
| 5318 |
/Subtype/Widget% |
| 5319 |
\Fld@annotflags |
| 5320 |
\Fld@pageobjref |
| 5321 |
\Fld@annotnames |
| 5322 |
/FT/Btn% |
| 5323 |
\Fld@flags |
| 5324 |
/H/P% |
| 5325 |
/DA(/Helv~\strip@pt\Fld@charsize\space Tf~0~0~1~rg)% |
| 5326 |
\ifcase0\ifnum\Fld@rotation=\z@ \else 1\fi |
| 5327 |
\ifx\Fld@bordercolor\relax\else 1\fi |
| 5328 |
\space |
| 5329 |
\else |
| 5330 |
/MK<<% |
| 5331 |
\ifnum\Fld@rotation=\z@ |
| 5332 |
\else |
| 5333 |
/R~\Fld@rotation |
| 5334 |
\fi |
| 5335 |
\ifx\Fld@bordercolor\relax |
| 5336 |
\else |
| 5337 |
/BC[\Fld@bordercolor]% |
| 5338 |
\fi |
| 5339 |
>>% |
| 5340 |
\fi |
| 5341 |
/BS<</W \Fld@borderwidth/S/\Fld@borderstyle>>% |
| 5342 |
/A<</S/ResetForm>>% |
| 5343 |
\Fld@additionalactions |
| 5344 |
}% |
| 5345 |
|
| 5346 |
|
| 5347 |
%these patterns are used in hyperref checks. |
| 5348 |
%it is unclear if they are really useful and if a backend support is |
| 5349 |
%needed. |
| 5350 |
\str_case:VnF \c_sys_backend_str |
| 5351 |
{ |
| 5352 |
{ pdfmode } |
| 5353 |
{ |
| 5354 |
\def\HyPat@ObjRef |
| 5355 |
{ |
| 5356 |
[0-9]*[1-9][0-9]*~0~R |
| 5357 |
} |
| 5358 |
} |
| 5359 |
{ dvipdfmx } |
| 5360 |
{ |
| 5361 |
\def\HyPat@ObjRef |
| 5362 |
{ |
| 5363 |
@[^~]+ |
| 5364 |
} |
| 5365 |
} |
| 5366 |
{ xdvipdfmx } |
| 5367 |
{ |
| 5368 |
\def\HyPat@ObjRef |
| 5369 |
{ |
| 5370 |
@[^~]+ |
| 5371 |
} |
| 5372 |
} |
| 5373 |
} |
| 5374 |
{ %also set in hyperref sty, so probably not needed. |
| 5375 |
\def\HyPat@ObjRef/{.+} |
| 5376 |
} |
| 5377 |
|
| 5378 |
|
| 5379 |
\ExplSyntaxOff |
| 5380 |
% UF: removed Hy@writebookmark |
| 5381 |
% \Hy@currentbookmarklevel{0} |
| 5382 |
% \Hy@numberline |
| 5383 |
% \@@writetorep |
| 5384 |
% counter{bookmark@seq@number} |
| 5385 |
% removed \HyPsd@SanitizeForOutFile, not needed |
| 5386 |
% removed \currentpdfbookmark, defined by bookmark, |
| 5387 |
% should use \newcommand there |
| 5388 |
% removed \subpdfbookmark, defined by bookmark, |
| 5389 |
% should use \newcommand there |
| 5390 |
% removed \belowpdfbookmark, defined by bookmark, |
| 5391 |
% should use \newcommand there |
| 5392 |
% removed \pdfbookmark, defined by bookmark, |
| 5393 |
% \BOOKMARK |
| 5394 |
% \@BOOKMARK |
| 5395 |
%% \RequirePackage{rerunfilecheck}[2009/12/10] |
| 5396 |
%% removed \Hy@OutlineRerunCheck, unneeded with bookmark |
| 5397 |
%% removed \ReadBookmarks / unneeded with bookmark. |
| 5398 |
%% removed \Hy@OutlineName |
| 5399 |
%% removed \check@bm@number |
| 5400 |
%% removed \calc@bm@number |
| 5401 |
|
| 5402 |
\ifHy@implicit |
| 5403 |
\else |
| 5404 |
\expandafter\endinput |
| 5405 |
\fi |
| 5406 |
\newlength\Hy@SectionHShift |
| 5407 |
\def\Hy@SectionAnchorHref#1{% |
| 5408 |
\ifx\protect\@typeset@protect |
| 5409 |
\Hy@@SectionAnchor{#1}% |
| 5410 |
\fi |
| 5411 |
} |
| 5412 |
\DeclareRobustCommand*{\Hy@@SectionAnchor}[1]{% |
| 5413 |
\leavevmode |
| 5414 |
\hbox to 0pt{% |
| 5415 |
\kern-\Hy@SectionHShift |
| 5416 |
\Hy@raisedlink{% |
| 5417 |
\hyper@anchorstart{#1}\hyper@anchorend |
| 5418 |
}% |
| 5419 |
\hss |
| 5420 |
}% |
| 5421 |
} |
| 5422 |
\@ifundefined{hyper@nopatch@sectioning} |
| 5423 |
{ |
| 5424 |
\let\H@old@ssect\@ssect |
| 5425 |
\def\@ssect#1#2#3#4#5{% |
| 5426 |
\Hy@MakeCurrentHrefAuto{section*}% |
| 5427 |
\setlength{\Hy@SectionHShift}{#1}% |
| 5428 |
\begingroup |
| 5429 |
\toks@{\H@old@ssect{#1}{#2}{#3}{#4}}% |
| 5430 |
\toks\tw@\expandafter{% |
| 5431 |
\expandafter\Hy@SectionAnchorHref\expandafter{\@currentHref}% |
| 5432 |
#5% |
| 5433 |
}% |
| 5434 |
\edef\x{\endgroup |
| 5435 |
\the\toks@{\the\toks\tw@}% |
| 5436 |
}\x |
| 5437 |
} |
| 5438 |
\let\H@old@schapter\@schapter |
| 5439 |
\def\@schapter#1{% |
| 5440 |
\begingroup |
| 5441 |
\let\@mkboth\@gobbletwo |
| 5442 |
\Hy@MakeCurrentHrefAuto{\Hy@chapapp*}% |
| 5443 |
\Hy@raisedlink{% |
| 5444 |
\hyper@anchorstart{\@currentHref}\hyper@anchorend |
| 5445 |
}% |
| 5446 |
\endgroup |
| 5447 |
\H@old@schapter{#1}% |
| 5448 |
} |
| 5449 |
\@ifundefined{@chapter}{}{% |
| 5450 |
\let\Hy@org@chapter\@chapter |
| 5451 |
\def\@chapter{% |
| 5452 |
\def\Hy@next{% |
| 5453 |
\Hy@MakeCurrentHrefAuto{\Hy@chapapp*}% |
| 5454 |
\Hy@raisedlink{% |
| 5455 |
\hyper@anchorstart{\@currentHref}\hyper@anchorend |
| 5456 |
}% |
| 5457 |
}% |
| 5458 |
\ifnum\c@secnumdepth>\m@ne |
| 5459 |
\@ifundefined{if@mainmatter}% |
| 5460 |
\iftrue{\csname if@mainmatter\endcsname}% |
| 5461 |
\let\Hy@next\relax |
| 5462 |
\fi |
| 5463 |
\fi |
| 5464 |
\Hy@next |
| 5465 |
\Hy@org@chapter |
| 5466 |
}% |
| 5467 |
} |
| 5468 |
\let\H@old@part\@part |
| 5469 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 5470 |
\expandafter\ifx\csname chapter\endcsname\relax |
| 5471 |
\let\Hy@secnum@part\z@ |
| 5472 |
\else |
| 5473 |
\let\Hy@secnum@part\m@ne |
| 5474 |
\fi |
| 5475 |
\def\@part{% |
| 5476 |
\ifnum\Hy@secnum@part>\c@secnumdepth |
| 5477 |
\phantomsection |
| 5478 |
\fi |
| 5479 |
\H@old@part |
| 5480 |
} |
| 5481 |
\let\H@old@spart\@spart |
| 5482 |
\def\@spart#1{% |
| 5483 |
\Hy@MakeCurrentHrefAuto{part*}% |
| 5484 |
\Hy@raisedlink{% |
| 5485 |
\hyper@anchorstart{\@currentHref}\hyper@anchorend |
| 5486 |
}% |
| 5487 |
\H@old@spart{#1}% |
| 5488 |
} |
| 5489 |
\let\H@old@sect\@sect |
| 5490 |
\def\@sect#1#2#3#4#5#6[#7]#8{% |
| 5491 |
\ifnum #2>\c@secnumdepth |
| 5492 |
\expandafter\@firstoftwo |
| 5493 |
\else |
| 5494 |
\expandafter\@secondoftwo |
| 5495 |
\fi |
| 5496 |
{% |
| 5497 |
\Hy@MakeCurrentHrefAuto{section*}% |
| 5498 |
\setlength{\Hy@SectionHShift}{#3}% |
| 5499 |
\begingroup |
| 5500 |
\toks@{\H@old@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]}% |
| 5501 |
\toks\tw@\expandafter{% |
| 5502 |
\expandafter\Hy@SectionAnchorHref\expandafter{\@currentHref}% |
| 5503 |
#8% |
| 5504 |
}% |
| 5505 |
\edef\x{\endgroup |
| 5506 |
\the\toks@{\the\toks\tw@}% |
| 5507 |
}\x |
| 5508 |
}{% |
| 5509 |
\H@old@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{#8}% |
| 5510 |
}% |
| 5511 |
} |
| 5512 |
}{} |
| 5513 |
\expandafter\def\csname Parent-4\endcsname{} |
| 5514 |
\expandafter\def\csname Parent-3\endcsname{} |
| 5515 |
\expandafter\def\csname Parent-2\endcsname{} |
| 5516 |
\expandafter\def\csname Parent-1\endcsname{} |
| 5517 |
\expandafter\def\csname Parent0\endcsname{} |
| 5518 |
\expandafter\def\csname Parent1\endcsname{} |
| 5519 |
\expandafter\def\csname Parent2\endcsname{} |
| 5520 |
\expandafter\def\csname Parent3\endcsname{} |
| 5521 |
\expandafter\def\csname Parent4\endcsname{} |
| 5522 |
%% |
| 5523 |
%</package> |
| 5524 |
% \end{macrocode} |
| 5525 |
% \begin{macrocode} |
| 5526 |
%<@@=hyp> |
| 5527 |
%<*colorscheme> |
| 5528 |
% collected from https://tex.stackexchange.com/questions/525261/better-default-colors-for-hyperref-links |
| 5529 |
% cite color ignored, as it doesn't fit ... should be done by cite packages ? |
| 5530 |
% linkcolor= |
| 5531 |
%,filecolor= |
| 5532 |
%,urlcolor= |
| 5533 |
%,menucolor= |
| 5534 |
%,runcolor= |
| 5535 |
%,linkbordercolor= |
| 5536 |
%,filebordercolor= |
| 5537 |
%,urlbordercolor= |
| 5538 |
%,menubordercolor= |
| 5539 |
%,runbordercolor= |
| 5540 |
|
| 5541 |
\prop_const_from_keyval:cn { c_@@_colorscheme_primary-colors_prop } |
| 5542 |
{ |
| 5543 |
linkcolor = [rgb]{1,0,0}, %red |
| 5544 |
filecolor = [rgb]{0,1,1}, %cyan |
| 5545 |
urlcolor = [rgb]{1,0,1}, %magenta |
| 5546 |
menucolor = [rgb]{1, 0, 0}, %red |
| 5547 |
runcolor = [rgb]{0,1,1}, %cyan |
| 5548 |
%------------- |
| 5549 |
linkbordercolor = [rgb]{1, 0 ,0 }, |
| 5550 |
filebordercolor = [rgb]{0, .5, .5}, |
| 5551 |
urlbordercolor = [rgb]{0, 1, 1}, |
| 5552 |
menubordercolor = [rgb]{1, 0, 0}, |
| 5553 |
runbordercolor = [rgb]{0, .7, .7} |
| 5554 |
} |
| 5555 |
|
| 5556 |
\prop_const_from_keyval:Nn \c_@@_colorscheme_daleif_prop |
| 5557 |
{ |
| 5558 |
linkcolor = [rgb]{0,0.2,0.6}, |
| 5559 |
filecolor = [rgb]{0.8,0,0.8}, |
| 5560 |
urlcolor = [rgb]{0.8,0,0.8}, |
| 5561 |
menucolor = [rgb]{0,0.2,0.6}, |
| 5562 |
runcolor = [rgb]{0.8,0,0.8}, |
| 5563 |
%------------- %-------- |
| 5564 |
linkbordercolor = [rgb]{0,0.2,0.6}, |
| 5565 |
filebordercolor = [rgb]{0.8,0,0.8}, |
| 5566 |
urlbordercolor = [rgb]{0.8,0,0.8}, |
| 5567 |
menubordercolor = [rgb]{0,0.2,0.6}, |
| 5568 |
runbordercolor = [rgb]{0.8,0,0.8} |
| 5569 |
} |
| 5570 |
|
| 5571 |
\prop_const_from_keyval:Nn \c_@@_colorscheme_julian_prop |
| 5572 |
{ %two colors: intern/extern |
| 5573 |
linkcolor = [rgb]{0.79216, 0, 0.12549}, |
| 5574 |
filecolor = [rgb]{0.01961, 0.44314, 0.6902}, |
| 5575 |
urlcolor = [rgb]{0.01961, 0.44314, 0.6902}, |
| 5576 |
menucolor = [rgb]{0.79216, 0, 0.12549 }, |
| 5577 |
runcolor = [rgb]{0.01961, 0.44314, 0.6902 }, |
| 5578 |
%------------- %-------- |
| 5579 |
linkbordercolor = [rgb]{0.79216, 0, 0.12549}, |
| 5580 |
filebordercolor = [rgb]{0.01961, 0.44314, 0.6902}, |
| 5581 |
urlbordercolor = [rgb]{0.01961, 0.44314, 0.6902}, |
| 5582 |
menubordercolor = [rgb]{0.79216, 0, 0.12549 }, |
| 5583 |
runbordercolor = [rgb]{0.01961, 0.44314, 0.6902 } |
| 5584 |
} |
| 5585 |
|
| 5586 |
\prop_const_from_keyval:Nn \c_@@_colorscheme_tivv_prop |
| 5587 |
{ %all darkgray |
| 5588 |
linkcolor = [rgb]{0.4 ,0.4 ,0.4 }, |
| 5589 |
filecolor = [rgb]{0.4 ,0.4 ,0.4 }, |
| 5590 |
urlcolor = [rgb]{0.4 ,0.4 ,0.4 }, |
| 5591 |
menucolor = [rgb]{0.4 ,0.4 ,0.4 }, |
| 5592 |
runcolor = [rgb]{0.4 ,0.4 ,0.4 }, |
| 5593 |
%------------- %-------- |
| 5594 |
linkbordercolor = [rgb]{0.4 ,0.4 ,0.4 }, |
| 5595 |
filebordercolor = [rgb]{0.4 ,0.4 ,0.4 }, |
| 5596 |
urlbordercolor = [rgb]{0.4 ,0.4 ,0.4 }, |
| 5597 |
menubordercolor = [rgb]{0.4 ,0.4 ,0.4 }, |
| 5598 |
runbordercolor = [rgb]{0.4 ,0.4 ,0.4 } |
| 5599 |
} |
| 5600 |
|
| 5601 |
\prop_const_from_keyval:Nn \c_@@_colorscheme_szabolcsA_prop |
| 5602 |
{ %dvipsnam.def |
| 5603 |
linkcolor = [rgb]{0.06, 0.46, 1}, %NavyBlue |
| 5604 |
filecolor = [rgb]{1, 0, 0}, %Red |
| 5605 |
urlcolor = [rgb]{0.06, 0.46, 1}, %NavyBlue |
| 5606 |
menucolor = [rgb]{1, 0, 0}, %Red |
| 5607 |
runcolor = [rgb]{1, 0, 0}, %Red |
| 5608 |
%------------- %------------------ |
| 5609 |
linkbordercolor = [rgb]{0.06, 0.46, 1}, %NavyBlue |
| 5610 |
filebordercolor = [rgb]{1, 0, 0}, %Red |
| 5611 |
urlbordercolor = [rgb]{0.06, 0.46, 1}, %NavyBlue |
| 5612 |
menubordercolor = [rgb]{1, 0, 0}, %Red |
| 5613 |
runbordercolor = [rgb]{1, 0, 0} %Red |
| 5614 |
} |
| 5615 |
|
| 5616 |
\prop_const_from_keyval:Nn \c_@@_colorscheme_szabolcsB_prop |
| 5617 |
{ %dvipsnam.def |
| 5618 |
linkcolor = [rgb]{0.72, 0, 0}, %BrickRed |
| 5619 |
filecolor = [rgb]{0, 1, 0}, %Green |
| 5620 |
urlcolor = [rgb]{0.64, 0.08, 0.98}, %Mulberry |
| 5621 |
menucolor = [rgb]{0.06, 0.46, 1}, %NavyBlue |
| 5622 |
runcolor = [rgb]{0.64, 0.08, 0.98}, %Mulberry |
| 5623 |
%------------- %------------------ |
| 5624 |
linkbordercolor = [rgb]{0.72, 0, 0}, %BrickRed |
| 5625 |
filebordercolor = [rgb]{0, 1, 0}, %Green |
| 5626 |
urlbordercolor = [rgb]{0.64, 0.08, 0.98}, %Mulberry |
| 5627 |
menubordercolor = [rgb]{0.06, 0.46, 1}, %NavyBlue |
| 5628 |
runbordercolor = [rgb]{0.64, 0.08, 0.98} %Mulberry |
| 5629 |
} |
| 5630 |
|
| 5631 |
|
| 5632 |
\prop_const_from_keyval:Nn \c_@@_colorscheme_phelype_prop |
| 5633 |
{ |
| 5634 |
linkcolor = [rgb]{0.50196, 0, 0.02353}, |
| 5635 |
filecolor = [rgb]{0.07451, 0.09412, 0.46667}, |
| 5636 |
urlcolor = [rgb]{0.54118, 0, 0.52941}, |
| 5637 |
menucolor = [rgb]{0.44706, 0.45882, 0}, |
| 5638 |
runcolor = [rgb]{0.07451, 0.46667, 0.46275}, |
| 5639 |
%------------- %------------- |
| 5640 |
linkbordercolor = [rgb]{0.701176, 0.4, 0.414118}, |
| 5641 |
filebordercolor = [rgb]{0.444706, 0.456472, 0.680002}, |
| 5642 |
urlbordercolor = [rgb]{0.724708, 0.4, 0.717646}, |
| 5643 |
menubordercolor = [rgb]{0.668236, 0.675292, 0.4}, |
| 5644 |
runbordercolor = [rgb]{0.444706, 0.680002, 0.67765} |
| 5645 |
} |
| 5646 |
|
| 5647 |
\prop_const_from_keyval:Nn \c_@@_colorscheme_henryford_prop |
| 5648 |
{ |
| 5649 |
linkcolor = [rgb]{0,0,0}, |
| 5650 |
filecolor = [rgb]{0,0,0}, |
| 5651 |
urlcolor = [rgb]{0,0,0}, |
| 5652 |
menucolor = [rgb]{0,0,0}, |
| 5653 |
runcolor = [rgb]{0,0,0}, |
| 5654 |
%------------- %-------- |
| 5655 |
linkbordercolor = [rgb]{0,0,0}, |
| 5656 |
filebordercolor = [rgb]{0,0,0}, |
| 5657 |
urlbordercolor = [rgb]{0,0,0}, |
| 5658 |
menubordercolor = [rgb]{0,0,0}, |
| 5659 |
runbordercolor = [rgb]{0,0,0} |
| 5660 |
} |
| 5661 |
%</colorscheme> |
| 5662 |
% \end{macrocode} |
| 5663 |
% \end{implementation} |
| 5664 |
% \newpage |
| 5665 |
% \PrintIndex |