diff options
author | Karl Berry <karl@freefriends.org> | 2018-06-30 21:05:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-06-30 21:05:48 +0000 |
commit | 04e12813c532714126644d39d0c355baca9e1ccd (patch) | |
tree | 14173a37425c74e6e8f4bdf0a3001e2a0acc9e1d | |
parent | ffcff21880425e124f4f923c1ba306000c81b392 (diff) |
xbmks (30jun18)
git-svn-id: svn://tug.org/texlive/trunk@48116 c570f23f-e606-0410-a88d-b1316a301751
18 files changed, 759 insertions, 257 deletions
diff --git a/Master/texmf-dist/doc/latex/xbmks/README.md b/Master/texmf-dist/doc/latex/xbmks/README.md index fc53fd66899..c74431f82ef 100644 --- a/Master/texmf-dist/doc/latex/xbmks/README.md +++ b/Master/texmf-dist/doc/latex/xbmks/README.md @@ -1,6 +1,6 @@ The xbmks Package Author: D. P. Story -Dated: 2018/06/13 +Dated: 2018/06/25 Short description: Create a cross-document bookmark tree. @@ -15,6 +15,10 @@ the bundle. PDF Creator: no restrictions, use dvips->distiller|ps2pdf, pdflatex, lualatex, or xelatex. + +What's New (2018/06/25) Defined new commands for creating bookmarks for which +arbitrary actions, color and style can be applied. These commands build on +hyperref's bookmark commands. What's New (2018/06/13) Corrected a misspelling in the driver specification for pdfmark. Now allow the docbundle key to be empty or missing; in this diff --git a/Master/texmf-dist/doc/latex/xbmks/docs/xbmks.pdf b/Master/texmf-dist/doc/latex/xbmks/docs/xbmks.pdf Binary files differindex 4cbeca1dd3d..85e05e14400 100644 --- a/Master/texmf-dist/doc/latex/xbmks/docs/xbmks.pdf +++ b/Master/texmf-dist/doc/latex/xbmks/docs/xbmks.pdf diff --git a/Master/texmf-dist/doc/latex/xbmks/docs/xbmksman.pdf b/Master/texmf-dist/doc/latex/xbmks/docs/xbmksman.pdf Binary files differindex c6fd8d39a0c..cfbd36a2e44 100644 --- a/Master/texmf-dist/doc/latex/xbmks/docs/xbmksman.pdf +++ b/Master/texmf-dist/doc/latex/xbmks/docs/xbmksman.pdf diff --git a/Master/texmf-dist/doc/latex/xbmks/docs/xbmksman.tex b/Master/texmf-dist/doc/latex/xbmks/docs/xbmksman.tex index 149e707b375..aadc17e76a5 100644 --- a/Master/texmf-dist/doc/latex/xbmks/docs/xbmksman.tex +++ b/Master/texmf-dist/doc/latex/xbmks/docs/xbmksman.tex @@ -17,7 +17,9 @@ %\usepackage{calibri} \usepackage[altbullet]{lucidbry} -\xbmksetup{colors={intdoc=red},style={intbf}} +\DeclareInitView{layoutmag={navitab:UseOutlines}} + +\xbmksetup{colors={int=red},styles={intbf}} \addtolength{\marginparwidth}{20pt} @@ -39,7 +41,7 @@ \def\echgCurrLblName#1{\edef\@currentlabelname{#1}} \makeatother -\getDimsFromGraphic{graphics/dpsweb}{\dpswebW}{\dpswebH} +%\getDimsFromGraphic{graphics/dpsweb}{\dpswebW}{\dpswebH} %\urlstyle{rm} @@ -47,7 +49,8 @@ \let\uif\textsf \let\app\textsf \def\psf#1{\textbf{\textsf{#1}}} -\let\amtIndent\leftmargini +%\let\amtIndent\leftmargini +\edef\amtIndent{\the\parindent} \renewcommand*\descriptionlabel[1]{\hspace\labelsep \normalfont #1} @@ -56,13 +59,13 @@ \DeclareDocInfo { university={Acro\negthinspace\TeX.Net}, - title={The \textsf{xbmks} package\texorpdfstring{\\}{:}Cross-document bookmarks}, + title={The \textsf{xbmks} package\texorpdfstring{\\}{: }Cross-document bookmarks}, author={D. P. Story}, email={dpstory@acrotex.net}, - subject={Documentation for the richtext package from AcroTeX}, + subject={Documentation for the xbmks package from AcroTeX: cross-document bookmarks}, talksite={\url{www.acrotex.net}}, - version={v1.1, 2018/06/13}, - keywords={AcroTeX, rich text strings}, + version={2.0.1, 2018/06/25}, + Keywords={AcroTeX, bookmarks, cross-document, document bundle}, copyrightStatus=True, copyrightNotice={Copyright (C) \the\year, D. P. Story}, copyrightInfoURL={http://www.acrotex.net} @@ -132,6 +135,15 @@ _path=_path.substring(0,pos)+"/"+manualfilename; \maketitle +\pdfbookmarkx[1]{Title Page}[action={\Named{FirstPage}}]{TitlePage} +\pdfbookmarkx[1]{Links to AcroTeX.Net}[action={/S/GoTo/D(undefined)},% + color=magenta,style={bf}]{acrotex} +\belowpdfbookmarkx{http://www.acrotex.net}[action={\URI{http://www.acrotex.net}},% + color=magenta,style={bf}]{home} +\belowpdfbookmarkx{http://blog.acrotex.net}[action={\URI{http://blog.acrotex.net}},% + color=magenta,style={bf}]{blog} + + \selectColors{linkColor=black} \tableofcontents \selectColors{linkColor=webgreen} @@ -143,7 +155,6 @@ _path=_path.substring(0,pos)+"/"+manualfilename; \hypersetup{linktocpage} - \section{Introduction} It has been more than a couple decades ago (counting back from 2018), I wrote @@ -175,15 +186,15 @@ need to be used. The package auto-detects \app{pdftex} and \app{xetex}, and \opt{dvips} is the default, so there is actually no need to pass the driver option. -\section{The preamble command \texorpdfstring{\protect\cs{xbmksetup}}{\textbackslash{xbmksetup}}} +\section{The preamble command \texorpdfstring{\protect\cs{xbmksetup}}{\textbackslash{xbmksetup}}}\label{s:xbmksetup} The only user command is \cs{xbmksetup}: -\bVerb\def\1{\qquad}\takeMeasure{\1colors=\darg{intdoc=\ameta{color},extdoc=\ameta{color}},}% +\bVerb\def\1{\qquad}\takeMeasure{\1docbundle=\darg{\ameta{doc\SUB1},\ameta{doc\SUB2},...,\ameta{doc\SUB{n}}},}% \begin{dCmd}[commandchars=!()]{\bxSize} \xbmksetup{% !1docbundle={!ameta(doc!SUB1),!ameta(doc!SUB2),...,!ameta(doc!SUB(n))}, -!1colors={intdoc=!ameta(color),extdoc=!ameta(color)}, -!1style={intbf,extbf,intit,extit} +!1colors={int=!ameta(color),ext=!ameta(color)}, +!1styles={intbf,extbf,intit,extit} } \end{dCmd} \eVerb You have a collection of files (as specified by the \texttt{docbundle} @@ -222,38 +233,38 @@ to check the spelling of each file listed. \textbf{Empty or missing \texttt{docbundle} key.} If this key is missing, then it is assigned a value of \cs{jobname}. As a result, normal bookmarks are generated for the document \cs{jobname}; however, as an extra benefit, -the other keys are obeyed (\texttt{colors} and \texttt{style}). See the +the other keys are obeyed (\texttt{colors} and \texttt{styles}). See the sample file \texttt{stand-alone.tex} found in the \texttt{examples} file. This manual uses the \pkg{xbmks} package with, \begin{Verbatim}[xleftmargin=\amtIndent] -\xbmksetup{colors={intdoc=red},style={intbf}} +\xbmksetup{colors={int=red},styles={intbf}} \end{Verbatim} \item[\texttt{colors}] (Optional) For any given document in the bundle, there are two types of links in the bookmarks, a link to an item in the current (or internal) document, or a link to an external document (within the bundle of documents). \begin{itemize} - \item \texttt{intdoc=\ameta{color}}, where \ameta{color} is an rgb + \item \texttt{int=\ameta{color}}, where \ameta{color} is an rgb color. This specifies the color of the link for an internal jump within the current document. Specify the color using the syntax \texttt{\darg{[rgb]{\ameta{r},\ameta{g},\ameta{b}}}}; for example, \begin{Verbatim}[xleftmargin=\amtIndent] -colors={intdoc={[rgb]{0,.6,0}} +colors={int={[rgb]{0,.6,0}} \end{Verbatim} or, if the \pkg{xcolor} package is loaded, \emph{named colors} may be used. - \item\texttt{extdoc=\ameta{color}}, where \ameta{color} is an rgb + \item\texttt{ext=\ameta{color}}, where \ameta{color} is an rgb color. This specifies the color of the link for an external jump to another member of the document bundle. Color specification is the - same as for \texttt{intdoc}: + same as for \texttt{int}: \begin{Verbatim}[xleftmargin=\amtIndent] -colors={intdoc=red,extdoc=blue} +colors={int=red,ext=blue} \end{Verbatim} In the above example, we assume \pkg{xcolor} is loaded and specify the colors accordingly. -\textbf{The default color.} If you declare \texttt{intdoc} (or -\texttt{extdoc}) without a value, you get the default, which is the color +\textbf{The default color.} If you declare \texttt{int} (or +\texttt{ext}) without a value, you get the default, which is the color key is not specified within the PDF document. The \texttt{color} key is optional, in which case, you get the default color. What is the default color? Well, its either white or black, depending on the \textsf{Display @@ -263,34 +274,33 @@ automatically switch colors when the theme is changed). When you specify a color, be aware that what looks good in the \emph{light theme} may not be so visible in a \emph{dark theme}. \end{itemize} - \item[\texttt{style}] (Optional) The Adobe PDF viewer applications also + \item[\texttt{styles}] (Optional) The Adobe PDF viewer applications also support a bold and italics style. These can be specified for the internal and external documents. \begin{itemize} - \item Internal style (valueless) keys are \texttt{intbf} and \texttt{intit}; zero, one, or + \item Internal styles (valueless) keys are \texttt{intbf} and \texttt{intit}; zero, one, or two of these may be specified, \begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] -style={intbf} % !normalfont(bold font) -style={intit} % !normalfont(italics font) -style={intbf,intit} % !normalfont(bold and italics font) +styles={intbf} % !normalfont(bold font) +styles={intit} % !normalfont(italics font) +styles={intbf,intit} % !normalfont(bold and italics font) \end{Verbatim} - \item External style (valueless) keys are \texttt{extbf} and \texttt{extit}; zero, one, or + \item External styles (valueless) keys are \texttt{extbf} and \texttt{extit}; zero, one, or two of these may be specified, \begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] -style={extbf} % !normalfont(bold font) -style={extit} % !normalfont(italics font) -style={extbf,extit} % !normalfont(bold and italics font) +styles={extbf} % !normalfont(bold font) +styles={extit} % !normalfont(italics font) +styles={extbf,extit} % !normalfont(bold and italics font) \end{Verbatim} \end{itemize} -Of course, all these keys are specified or not, in the \texttt{style} key: +Of course, all these keys are specified or not, in the \texttt{styles} key: \begin{Verbatim}[xleftmargin=\amtIndent] -style={intbf,extit} +styles={intbf,extit} \end{Verbatim} Here, we specify bold font for the current document and an italics for an internal document. \end{description} - \newtopic\noindent\textbf{Point of personal preference.} After experimenting with various combinations of colors and styles with combinations of themes (light and dark) I prefer no color specified with bold font for the current @@ -300,11 +310,114 @@ external. The bold font tells the same story independent of theme. Thus,\def\1{\ \begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] \xbmksetup{% !1docbundle={!ameta(doc!SUB1),!ameta(doc!SUB2),...,!ameta(doc!SUB(n))}, -!1style={intbf} +!1styles={intbf} } \end{Verbatim} seems to be a reasonable choice of key-values. +\section{Creating bookmarks with other actions} + +The \pkg{hyperref} package provides commands (\cs{pdfbookmark}, +\cs{currentpdfbookmark}, \cs{subpdfbookmark}, and \cs{belowpdfbookmark}) +designed to create bookmarks that jump to a specified destination in the +current document. The \pkg{xbmks} package now defines similar commands in +which arbitrary actions may be defined. +\bVerb\def\1{\qquad}\takeMeasure{\string\pdfbookmarkx[\ameta{level}]\darg{\ameta{text}}[\ameta{KV-pairs}]\darg{\ameta{name}}}% +\begin{dCmd}[commandchars=!()]{\bxSize} +\pdfbookmarkx[!ameta(level)]{!ameta(text)}[!ameta(KV-pairs)]{!ameta(name)} +\currentpdfbookmarkx{!ameta(text)}[!ameta(KV-pairs)]{!ameta(name)} +\subpdfbookmarkx{!ameta(text)}[!ameta(KV-pairs)]{!ameta(name)} +\belowpdfbookmarkx{!ameta(text)}[!ameta(KV-pairs)]{!ameta(name)} +\end{dCmd} +\bVerb If the optional \ameta{KV-pairs} argument is not present, the command +behaves just like its \pkg{hyperref} counterpart; \ameta{name} is used to +create a destination (or anchor) for the ordinary bookmark link. If +\ameta{KV-pairs} is specified, no anchor is created, but \ameta{name} is used +to associate the \ameta{action} with the bookmark. + +\paragraph*{Description of the commands}\leavevmode +\begin{aebDescript} + \item[\cs{pdfbookmarkx}] Creates a bookmark at level \ameta{level} in the + outline tree hierarchy. + \item[\cs{currentpdfbookmarkx}] The command creates a bookmark at the current + bookmark level in the outline tree. + \item[\cs{subpdfbookmarkx}] Reduces the current bookmark level by one, + then creates the bookmark at that level. The reduced level is the + new current bookmark level. + \item[\cs{belowpdfbookmarkx}] Creates a bookmark at one level below the + current bookmark level without changing the value of the current + bookmark level. +\end{aebDescript} + +\paragraph*{Description of the \ameta{KV-pairs} argument.} The \ameta{KV-pairs} argument +accepts up to three key-value pairs: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +action=!ameta(PDF-action),color=!ameta(color),style=!ameta(!upshape(bf|it)) +\end{Verbatim} +Notice that \texttt{color} and \texttt{style} are in the singular, as opposed to the plural +as they were in description of the key-value pairs for \cs{xbmksetup}, back on page~\pageref{s:xbmksetup}. +\begin{aebDescript} + \item[\texttt{action=\ameta{PDF-action}}] \ameta{PDF-action} +is raw PDF action code. I decided to just keep it simple. Consult Section 8.5 titled `Actions', +in particular, read Section~8.5.3 on `Action Types' of the \textsl{PDF Reference Sixth Edition, Version 1.7}.\footnote +{\url{https://www.adobe.com/devnet/pdf/pdf_reference_archive.html}} A general +syntax for the \ameta{action} is, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +/S!ameta(action-type)!ameta(other-key-values) +\end{Verbatim} +Common action-types are \texttt{/URI}, \texttt{/JavaScript}, \texttt{/Named}, and \texttt{/GoToR}. +Below are some examples, the ones that appear in the demo files. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\belowpdfbookmarkx{http://www.acrotex.net} + [action={/S/URI/URI(http://www.acrotex.net)}]{home} +\currentpdfbookmarkx{Current: Hello world!} + [action={/S/JavaScript/JS(app.alert("Hello World!");)}]{bmk1} +\subpdfbookmarkx{Sub: First Page}[/S/Named/N/FirstPage]{bmk2} +\belowpdfbookmarkx{Go to doc1, page 1} + [action={/S/GoToR/F(doc1.pdf)/D[1 /Fit]}]{gotor} +\end{Verbatim} + +\textbf{When \pkg{eforms} is loaded.} The \pkg{eforms} package defines +some helper commands for common action types, these are \cs{URI}, \cs{JS}, +\cs{Named}, and \cs{GoToR}. The above examples are then written as, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\belowpdfbookmarkx{http://www.acrotex.net} + [action={\URI{http://www.acrotex.net}}]{home} +\currentpdfbookmarkx{Current: Hello world!} + [action={\JS{app.alert("Hello World!");}}]{bmk1} +\subpdfbookmarkx{Sub: First Page} + [action={\Named{FirstPage}{]{bmk2} +\belowpdfbookmarkx{Go to doc1, page 1} + [action={\GoToR/F(doc1.pdf)/D[1 /Fit]}]{gotor} +\end{Verbatim} + +\item[\texttt{color=\ameta{color}}] The value of this key determines the + color of the link. The value of \ameta{color} was described in the + \texttt{colors} key. If this key is not specified, the value \texttt{int} + or \texttt{ext} of the \texttt{colors} key is used, as appropriate. When + the value of the \texttt{color} key is specified, the link receives the + \ameta{color} across all documents in the bundle. + +\item[\texttt{style=\ameta{\upshape{bf|it}}}] The value of this key + determines the style (\texttt{bf} -- bold, \texttt{it} -- italics); the + keys may be used together \texttt{style=\darg{bf,it}} gives bold italics + font. When \texttt{style} is not specified, the value of the \texttt{styles} + key is used. When \texttt{style} is specified, the same style is assigned + across all documents in the bundle. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\belowpdfbookmarkx{http://www.acrotex.net} + [action={\URI{http://www.acrotex.net}}, + color=magenta,style=bf]{home} +\end{Verbatim} +This bookmark is colored magenta in bold across all documents in the bundle. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\belowpdfbookmarkx{http://www.acrotex.net} + [action={\URI{http://www.acrotex.net}}]{home} +\end{Verbatim} +This bookmark takes on the colors and styles declared by the \texttt{colors} +and \texttt{styles} keys. +\end{aebDescript} + \section{Workflow} Given that you have a collection of files that are to contain a common set of diff --git a/Master/texmf-dist/doc/latex/xbmks/examples/doc1.pdf b/Master/texmf-dist/doc/latex/xbmks/examples/doc1.pdf Binary files differindex df5d6497a3a..77ef2e1ccc2 100644 --- a/Master/texmf-dist/doc/latex/xbmks/examples/doc1.pdf +++ b/Master/texmf-dist/doc/latex/xbmks/examples/doc1.pdf diff --git a/Master/texmf-dist/doc/latex/xbmks/examples/doc1.tex b/Master/texmf-dist/doc/latex/xbmks/examples/doc1.tex index e45c5d894b5..1c5da0183c2 100644 --- a/Master/texmf-dist/doc/latex/xbmks/examples/doc1.tex +++ b/Master/texmf-dist/doc/latex/xbmks/examples/doc1.tex @@ -1,7 +1,7 @@ \documentclass[12pt]{article} \usepackage{xcolor} %\usepackage{xr-hyper} -\usepackage[bookmarksopen]{hyperref} +\usepackage[bookmarksopen,bookmarksnumbered]{hyperref} \usepackage{xbmks} @@ -10,7 +10,8 @@ %\externaldocument[m-]{master} %\externaldocument[d2-]{doc2} - +% just for laughs, we transfer the last section number from master +\setcounter{section}{2} \begin{document} @@ -18,6 +19,11 @@ Some content goes here. +\belowpdfbookmarkx{Home page}[action={/S/URI/URI(http://www.acrotex.net)},% + color=magenta,style={it} +]{home} + + \newpage \subsection{Doc 1: subSec 1} diff --git a/Master/texmf-dist/doc/latex/xbmks/examples/doc2.pdf b/Master/texmf-dist/doc/latex/xbmks/examples/doc2.pdf Binary files differindex 331bffa81d9..8870ca29400 100644 --- a/Master/texmf-dist/doc/latex/xbmks/examples/doc2.pdf +++ b/Master/texmf-dist/doc/latex/xbmks/examples/doc2.pdf diff --git a/Master/texmf-dist/doc/latex/xbmks/examples/doc2.tex b/Master/texmf-dist/doc/latex/xbmks/examples/doc2.tex index 9f033fefe80..8bc8ebb8337 100644 --- a/Master/texmf-dist/doc/latex/xbmks/examples/doc2.tex +++ b/Master/texmf-dist/doc/latex/xbmks/examples/doc2.tex @@ -1,9 +1,13 @@ \documentclass[12pt]{article} \usepackage{xcolor} %\usepackage{xr-hyper} -\usepackage[bookmarksopen]{hyperref} +\usepackage[bookmarksopen,bookmarksnumbered]{hyperref} \usepackage{xbmks} +% just for laughs, we transfer the last section number from doc2 +\setcounter{section}{4} + + % the xr-hyper package may also be used if you have % cross document links within the body of the doc %\externaldocument[m-]{master} @@ -13,6 +17,9 @@ \section{Doc 2: Sec 1} +\belowpdfbookmarkx{Home page}[action={/S/URI/URI(http://www.acrotex.net)},% + color=magenta,style={bf}]{home} + Some content goes here. \newpage diff --git a/Master/texmf-dist/doc/latex/xbmks/examples/master.pdf b/Master/texmf-dist/doc/latex/xbmks/examples/master.pdf Binary files differindex 63d6ad0cc0c..433ff95ac33 100644 --- a/Master/texmf-dist/doc/latex/xbmks/examples/master.pdf +++ b/Master/texmf-dist/doc/latex/xbmks/examples/master.pdf diff --git a/Master/texmf-dist/doc/latex/xbmks/examples/master.tex b/Master/texmf-dist/doc/latex/xbmks/examples/master.tex index 1b0806a3ad6..5dc32e59675 100644 --- a/Master/texmf-dist/doc/latex/xbmks/examples/master.tex +++ b/Master/texmf-dist/doc/latex/xbmks/examples/master.tex @@ -1,7 +1,8 @@ \documentclass[12pt]{article} \usepackage{xcolor} %\usepackage{xr-hyper} -\usepackage[bookmarksopen]{hyperref} +\usepackage[bookmarksopen,bookmarksnumbered]{hyperref} +%\usepackage{eforms} \usepackage{xbmks} % the xr-hyper package may also be used if you have @@ -18,22 +19,70 @@ % of option choices. \xbmksetup{% docbundle={master,doc1,doc2}, - colors={intdoc=red,extdoc}, - style={intbf} + colors={int=red,ext}, + styles={intbf} } \begin{document} \maketitle +\tableofcontents + +% color and style specified. This will be how these entries are displayed across +% all documents in the bundle +\pdfbookmarkx[1]{http://blog.acrotex.net}[action={/S/URI/URI(http://blog.acrotex.net)},% + color=magenta,style={bf}]{blog} +\currentpdfbookmarkx{http://www.acrotex.net}[action={/S/URI/URI(http://www.acrotex.net)},% + color=magenta,style={bf}]{home} +\currentpdfbookmarkx{First page}[action={/S/Named/N/FirstPage},% + color=magenta,style={bf}]{First} +\currentpdfbookmarkx{Last page}[action={/S/Named/N/LastPage},% + color=magenta,style={bf}]{Last} + +% the eforms versions of the above +%\pdfbookmarkx[1]{http://blog.acrotex.net}[action={\URI{http://blog.acrotex.net}},% +% color=magenta,style={bf}]{blog} +%\currentpdfbookmarkx{http://www.acrotex.net}[action={\URI{http://www.acrotex.net}},% +% color=magenta,style={bf}]{home} +%\currentpdfbookmarkx{First page}[action={\Named{FirstPage}},% +% color=magenta,style={bf}]{First} +%\currentpdfbookmarkx{Last page}[action={\Named{LastPage}},% +% color=magenta,style={bf}]{Last} + \section{Master One} Some content goes here. +% color and style not specified, this bookmark will take on the default +% color and style as declared in the \xbmksetup command. +\belowpdfbookmarkx{JavaScript Action}[% + action={/S/JavaScript/JS(app.alert("Hello World!\\n\\nAnnounced from the document " + + this.documentFileName);)}]{jsa} + +% eforms version +%\belowpdfbookmarkx{JavaScript Action}[ +% action={\JS{app.alert("Hello World!\\n\\nAnnounced from the document " +% + this.documentFileName);}]{jsa} + +% color and style not specified, this bookmark will take on the default +% color and style as declared in the \xbmksetup command. +\belowpdfbookmarkx{Go to doc1, page 2}[action={/S/GoToR/F(doc1.pdf)/D[1 /Fit]}]{gotor1} +% eforms version +%\belowpdfbookmarkx{Go to doc1, page 2}[action={\GoToR/F(doc1.pdf)/D[1 /Fit]}]{gotor} + +\hypersetup{bookmarksopen=false} +% This next bookmark is a title only, the actions is to jump to an destination not defined +\subpdfbookmarkx{Sub: Optional Bookmarks}[action={/S/GoTo/D(undefined)}]{optBmks} +\belowpdfbookmarkx{doc1, page 3}[action={/S/GoToR/F(doc1.pdf)/D[2 /Fit]}]{gotor2} +\belowpdfbookmarkx{doc2, page 2}[action={/S/GoToR/F(doc2.pdf)/D[1 /Fit]}]{gotor3} +\hypersetup{bookmarksopen=true} + \subsection{Master One: subSec 1} Some content goes here. + \newpage @@ -41,7 +90,6 @@ Some content goes here. Some content goes here. - \subsection{Master Two: subSec 1} Some content goes here. diff --git a/Master/texmf-dist/doc/latex/xbmks/examples/stand-alone.tex b/Master/texmf-dist/doc/latex/xbmks/examples/stand-alone.tex index cb2a34fe0b6..44cf83374d6 100644 --- a/Master/texmf-dist/doc/latex/xbmks/examples/stand-alone.tex +++ b/Master/texmf-dist/doc/latex/xbmks/examples/stand-alone.tex @@ -8,8 +8,8 @@ \xbmksetup{% % docbundle={\jobname}, - colors={intdoc=red,extdoc}, - style={intbf} + colors={int=red,ext}, + styles={intbf} } \begin{document} @@ -18,11 +18,11 @@ \section{Section One} -When the \texttt{docbundle} key is either empty or is not present, \textsf{xbmks} sets it -to \verb~\jobname~. No cross-document bookmarks are generated because there was no specification -for creating (multiple values for \texttt{docbundle}); instead, we obtain a standard document +When the \texttt{docbundle} key is either empty or is not present, \textsf{xbmks} sets its value +to \verb~\jobname~. No cross-document bookmarks are generated because there is no ``bundle'' specified +(multiple values for \texttt{docbundle} are needed); instead, we obtain a standard document with bookmarks, but the color and style of of the bookmarks are controlled by the \texttt{colors} -and \texttt{style} keys, as seen in the preamble. +and \texttt{styles} keys, as seen in the preamble. \subsection{Section One: subSec 1} diff --git a/Master/texmf-dist/source/latex/xbmks/xbmks.dtx b/Master/texmf-dist/source/latex/xbmks/xbmks.dtx index 65c3eae17ef..63e4cfd8b3d 100644 --- a/Master/texmf-dist/source/latex/xbmks/xbmks.dtx +++ b/Master/texmf-dist/source/latex/xbmks/xbmks.dtx @@ -16,14 +16,14 @@ %</copyright> %<package>\NeedsTeXFormat{LaTeX2e}[1997/12/01] %<package>\ProvidesPackage{xbmks} -%<package> [2018/06/13 v1.1 xbmks: Cross-document bookmarks (dps)] +%<package> [2018/06/25 v2.0.1 xbmks: Cross-document bookmarks (dps)] %<*driver> \documentclass{ltxdoc} \usepackage{xcolor} \usepackage[colorlinks,hyperindex=false,bookmarksopen]{hyperref} \usepackage{fancyvrb,array,calc} \usepackage{xbmks} -\xbmksetup{colors={intdoc=red},style={intbf}} +\xbmksetup{colors={int=red},styles={intbf}} %\pdfstringdefDisableCommands{\let\\\textbackslash} \EnableCrossrefs \CodelineIndex @@ -145,8 +145,8 @@ %\begin{quote}\ttfamily\obeylines %\string\xbmksetup\darg{% %\qquad docbundle=\darg{\ameta{doc\SUB1},\ameta{doc\SUB2},...,\ameta{doc\SUB{n}}}, -%\qquad colors=\darg{intdoc=\ameta{color},extdoc=\ameta{color}}, -%\qquad style=\darg{intbf,extbf,intit,extit} +%\qquad colors=\darg{int=\ameta{color},ext=\ameta{color}}, +%\qquad styles=\darg{intbf,extbf,intit,extit} %} %\end{quote} %This command must appear in one and only one of the document bundle, perhaps one @@ -155,32 +155,59 @@ %members of the document bundle, as specified by the \texttt{dobundle} key. The base names %of the document bundle must match the name given to it by \cs{jobname}, exact spelling, case %sensitive. +% +%\paragraph*{Key-values for \cs{xbmksetup}.} The keys belonging to the \texttt{xbmksetup} family: +%\IndexOpt{docbundle}\texttt{docbundle}, \IndexOpt{colors}\texttt{colors}, and \IndexOpt{styles}\texttt{styles}. % \begin{macrocode} \define@key{xbmksetup}{docbundle}[]{\def\x@bmks@docs{#1}} \let\x@bmks@docs\@empty \define@key{xbmksetup}{colors}[]{\def\x@bmks@colors{#1}} \let\x@bmks@colors\@empty -\define@key{xbmksetup}{style}[]{\def\x@bmks@style{#1}} -\let\x@bmks@style\@empty -\define@key{xbmk@colors}{intdoc}[]{% - \HyColor@BookmarkColor{#1}{\xbmks@intdoc}{xbmks}{intdoc}% - \ifx\xbmks@intdoc\@empty\else - \edef\xbmks@intdoc{/C[\xbmks@intdoc]}\fi +\define@key{xbmksetup}{styles}[]{\def\x@bmks@styles{#1}} +\let\x@bmks@styles\@empty +% \end{macrocode} +%\subparagraph*{Values for the key \texttt{colors}.} The value recognized are +%\begin{quote}\ttfamily +% colors=\darg{int=\ameta{color},ext=\ameta{color}} +%\end{quote} +%If the value of \texttt{int} or \texttt{ext} is empty, then the PDF viewer's default +%colors are using (black). +% \begin{macrocode} +\define@key{xbmk@colors}{int}[]{% + \HyColor@BookmarkColor{#1}{\xbmks@intC}{xbmks}{int}% + \ifx\xbmks@intC\@empty\else + \edef\xbmks@intC{/C[\xbmks@intC]}\fi } -\let\xbmks@intdoc\@empty -\define@key{xbmk@colors}{extdoc}[]{% - \HyColor@BookmarkColor{#1}{\xbmks@extdoc}{xbmks}{extdoc}% - \ifx\xbmks@extdoc\@empty\else - \edef\xbmks@extdoc{/C[\xbmks@extdoc]}\fi +\let\xbmks@intC\@empty +\define@key{xbmk@colors}{ext}[]{% + \HyColor@BookmarkColor{#1}{\xbmks@extC}{xbmks}{ext}% + \ifx\xbmks@extC\@empty\else + \edef\xbmks@extC{/C[\xbmks@extC]}\fi } -\let\xbmks@extdoc\@empty +\let\xbmks@extC\@empty \let\xbmks@Yes=y \let\xbmks@No=n -\define@boolkey{xbmk@style}{intbf}[true]{} %\ifKV@xbmk@style@intbf -\define@boolkey{xbmk@style}{extbf}[true]{} -\define@boolkey{xbmk@style}{intit}[true]{} -\define@boolkey{xbmk@style}{extit}[true]{} +% \end{macrocode} +%\subparagraph*{Values for the key \texttt{colors}.} The value recognized are +%\begin{quote}\ttfamily +% styles=\darg{intbf,intit,extbf,extit} +%\end{quote} +%These are valueless keys (Boolean keys, actually). \texttt{intbf} means the interior document bookmarks +%are set in bold while \texttt{intbf,intit} creates bold and italic font. +% \begin{macrocode} +\define@boolkey{xbmk@styles}{intbf}[true]{} +\define@boolkey{xbmk@styles}{extbf}[true]{} +\define@boolkey{xbmk@styles}{intit}[true]{} +\define@boolkey{xbmk@styles}{extit}[true]{} +% \end{macrocode} +% We evaluate the values of \cs{xbmksetup} by getting the values of +% the \texttt{xbmksetup} family. +% \begin{macrocode} \newcommand{\xbmksetup}[1]{\setkeys{xbmksetup}{#1}% \ifx\x@bmks@docs\@empty +% \end{macrocode} +% If there is no \texttt{docbundle} is specified, we use \cs{jobname} as its +% value. +% \begin{macrocode} \PackageInfo{xbmks}{The docbundle key of \string\xbmksetup\space is empty,\MessageBreak I will give it a value of `\jobname',\MessageBreak @@ -188,6 +215,12 @@ \def\xbmks@next{\write@xbmks@cfg{docbundle={\jobname},#1}}\else \def\xbmks@next{\write@xbmks@cfg{#1}}\fi\xbmks@next } +% \end{macrocode} +% We write the key-values of \cs{xbmksetup} to the hard drive in the file +% \texttt{xbmks.cfg}, this is \cs{xbmksetupi\darg{\ameta{KVPairs}}}. \cs{xbmksetupi} +% is defined below, it is the command that actually does the heavy lifting in +% processing the key-values. +% \begin{macrocode} \def\write@xbmks@cfg#1{% \newwrite\xbmks@setup \immediate\openout \xbmks@setup xbmks.cfg \set@display@protect @@ -195,63 +228,226 @@ \set@typeset@protect \immediate\closeout\xbmks@setup } +% \end{macrocode} +% \cs{xbmksetupi} is an internal command that sets the key-values across all files in the \texttt{docbundle}. +% \begin{macrocode} \newcommand{\xbmksetupi}[1]{% \setkeys{xbmksetup}{#1}% - \edef\@exp@for{\noexpand\docbundle{\x@bmks@docs}}\expandafter - \@exp@for - \edef\@exp@keys{\noexpand - \setkeys{xbmk@colors}{\x@bmks@colors}}\@exp@keys - \edef\@exp@keys{\noexpand - \setkeys{xbmk@style}{\x@bmks@style}}\@exp@keys - \def\xbmk@intF{}% - \ifKV@xbmk@style@intit - \ifKV@xbmk@style@intbf - \def\xbmk@intF{/F 3}% - \else - \def\xbmk@intF{/F 1}% - \fi - \else - \ifKV@xbmk@style@intbf - \def\xbmk@intF{/F 2}% - \fi - \fi - \def\xbmk@extF{}% - \ifKV@xbmk@style@extit - \ifKV@xbmk@style@extbf - \def\xbmk@extF{/F 3}% - \else - \def\xbmk@extF{/F 1}% - \fi - \else - \ifKV@xbmk@style@extbf - \def\xbmk@extF{/F 2}% - \fi - \fi + \edef\x{\noexpand\x@docbundle{\x@bmks@docs}}\x + \edef\x{\noexpand + \setkeys{xbmk@colors}{\x@bmks@colors}}\x + \edef\x{\noexpand + \setkeys{xbmk@styles}{\x@bmks@styles}}\x + \let\xbmk@intF\@empty + \ifKV@xbmk@styles@intit + \ifKV@xbmk@styles@intbf + \def\xbmk@intF{/F 3}\else + \def\xbmk@intF{/F 1}\fi + \else + \ifKV@xbmk@styles@intbf + \def\xbmk@intF{/F 2}\fi + \fi + \let\xbmk@extF\@empty + \ifKV@xbmk@styles@extit + \ifKV@xbmk@styles@extbf + \def\xbmk@extF{/F 3}\else + \def\xbmk@extF{/F 1}\fi + \else + \ifKV@xbmk@styles@extbf + \def\xbmk@extF{/F 2}\fi + \fi } % \end{macrocode} % \end{macro} -% \begin{macro}{\docbundle} +% \begin{macro}{\x@docbundle} % is a comma-delimited list of document base names: %\begin{quote}\ttfamily\obeylines -%\string\docbundle\darg{\ameta{doc\SUB1},\ameta{doc\SUB2},...,\ameta{doc\SUB{n}}} +%\string\x@docbundle\darg{\ameta{doc\SUB1},\ameta{doc\SUB2},...,\ameta{doc\SUB{n}}} %\end{quote} -%This command is called internally by \cs{xbmksetup}. +%This command is called internally by \cs{xbmksetupi}. % \begin{macrocode} -\def\xbmk@csarg#1#2{\expandafter#1\csname#2\endcsname} +\def\xbmkcsarg#1#2{\expandafter#1\csname#2\endcsname} \xdef\xbmk@cnt{0} -\newcommand{\docbundle}[1]{\bgroup +\newcommand{\x@docbundle}[1]{\bgroup \def\thisDoc{\jobname}\count\z@=0 % \edef\@tmpexp{\noexpand\@for\noexpand\@arg:=#1}% - \@tmpexp\do{% - \advance\count\z@ by 1\relax - \edef\@tmpexp{\noexpand\xbmk@recordDoc{\@arg}}\@tmpexp + \@tmpexp\do{\advance\count\z@ by 1\relax + \edef\x{\noexpand\xbmk@recordDoc{\@arg}}\x + \edef\x{\noexpand\xbmk@docID{\@arg}}\x }% \xdef\xbmk@cnt{\the\count\z@}\egroup } \newcommand{\xbmk@recordDoc}[1]{% - \xbmk@csarg\xdef{xbmk@doc\the\count\z@}{#1}} + \xbmkcsarg\xdef{xbmk@doc\the\count\z@}{#1}} +% \end{macrocode} +% Because we are bringing in multiple outline files, there may be duplicate anchor names. +% We assign each file in the document bundle a unique ID `\texttt{x1\ameta{anchor}}', `\texttt{x2\ameta{anchor}}', etc. +% The IDs are ultimately assigned through \cs{pdfbookmarkx}. +% \begin{macrocode} +\newcommand{\xbmk@docID}[1]{% + \xbmkcsarg\xdef{x#1}{x\the\count\z@}} +\xbmkcsarg\xdef{x\jobname}{x0} % \end{macrocode} % \end{macro} +% +% \section{Extending bookmarks to arbitrary actions} +% +% It is possible to create bookmarks with arbitrary actions, just as the \pkg{bookmark} +% package, does. Here we try to use \pkg{hyperref}'s native bookmark support. The +% \pkg{hyperref} commands \cs{pdfbookmark}, \cs{currentbookmark}, \cs{subpdfbookmark}, and +% \cs{belowpdfbookmark} are modified. +% \begin{macro}{\pdfbookmarkx}\hskip-\marginparsep\, +% \texttt{[\ameta{level}]\darg{\ameta{text}}[\ameta{xbmkskeys-kvp}]\darg{\ameta{name}}}\\ +% Defines a bookmark at \ameta{level}. If \ameta{level} is not provided, the level 1 is assumed. +% We write to the outline file the action desired for this bookmark. +% \cs{currentAction} is defined below. We do not set an anchor; if the +% document author wants an anchor, he should use \cs{pdfbookmark}. As with +% \cs{pdfbookmark}, the \cs{pdfbookmarkx} should not normally be directly +% used. +% \paragraph*{Key-values for the `\cs{...bookmarkx}' commands.} Recognized keys are +% \IndexKey{action}\texttt{action}, \IndexKey{color}\texttt{color}, and \IndexKey{style}\texttt{style}. +% Note that these keys are singular, as opposed to \texttt{colors} and \texttt{styles} defined in the +% \texttt{xbmksetup} family. This is the \texttt{xbmkskeys} family. +% \changes{v2.0}{2018/06/21}{Added `\string\cs{...bookmarkx} commands} +% \changes{v2.0.1}{2018/06/25}{Added key-values for action, color, and style for custom `\string\cs{...bookmarkx} commands} +% \begin{macrocode} +\define@key{xbmkskeys}{action}{\def\x@bmks@action{#1}} +\let\x@bmks@action\@empty +\define@key{xbmkskeys}{color}[]{% + \HyColor@BookmarkColor{#1}{\x@bmks@C}{xbmks}{color}% + \ifx\x@bmks@C\@empty\else + \edef\x@bmks@C{/C[\x@bmks@C]}\fi +} +\let\x@bmks@C\@empty +\define@key{xbmkskeys}{style}[]{% + \edef\x{\noexpand\setkeys{xbmks@style}{#1}}\x + \let\x@bmks@F\@empty + \ifKV@xbmks@style@it + \ifKV@xbmks@style@bf + \def\x@bmks@F{/F 3}\else + \def\x@bmks@F{/F 1}\fi + \else + \ifKV@xbmks@style@bf + \def\x@bmks@F{/F 2}\fi + \fi +} +\let\x@bmks@F\@empty +% \end{macrocode} +% The \texttt{style} key takes zero, one, or two values, these are \texttt{bf} and \texttt{it}. +% \begin{macrocode} +\define@boolkey{xbmks@style}{bf}[true]{} +\define@boolkey{xbmks@style}{it}[true]{} +\def\x@rollCFIntoActionBmrk#1{% + \xbmkcsarg\ifx{X_#1}\relax + \let\x@bmks@C\@empty\let\x@bmks@F\@empty\fi + \ifx\xbmk@J\xbmk@filename + \ifx\x@bmks@C\@empty\let\thisCol\xbmks@intC\else + \let\thisCol\x@bmks@C\fi + \ifx\x@bmks@F\@empty\let\thisF\xbmk@intF\else + \let\thisF\x@bmks@F\fi + \else + \ifx\x@bmks@C\@empty\let\thisCol\xbmks@extC\else + \let\thisCol\x@bmks@C\fi + \ifx\x@bmks@F\@empty\let\thisF\xbmk@extF\else + \let\thisF\x@bmks@F\fi + \fi + \global\let\x@bmks@C\@empty\global\let\x@bmks@F\@empty +} +% \end{macrocode} +% We finally arrive at \cs{pdfbookmarkx} command. +% \begin{macrocode} +\newcommand\pdfbookmarkx[2][0]{% + \@ifnextchar[%] + {\pdfbookmarkx@i{#1}{#2}} + {\pdfbookmarkx@i{#1}{#2}[]}} +\def\pdfbookmarkx@i#1#2[#3]#4{% level, title, action, name + \def\x@rgiii{#3}\ifx\x@rgiii\@empty +% \end{macrocode} +% if there is no action, treat as a destination +% \begin{macrocode} + \Hy@writebookmark{}{#2}{#4.#1}{#1}{toc}% + \hyper@anchorstart{#4.#1}\hyper@anchorend + \else + \protected@write\@outlinefile{}{% + \string\nextAction% assign doc ID + {\@nameuse{x\jobname}#4.#1}{#3}}% + \Hy@writebookmark{}{#2}{\@nameuse{x\jobname}#4.#1}{#1}{toc}% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\currentpdfbookmarkx} +% \hskip-\marginparsep\,\texttt{\darg{\ameta{text}}[\ameta{xbmkskeys-kvp}]\darg{\ameta{name}}}\\ +% The \texttt{action=\ameta{action}} is raw PDF code, for example, +%\begin{quote}\ttfamily +%\string\currentpdfbookmarkx[/S/URI/URI(http://www.acrotex.net)]\\\null +%\qquad\darg{http://www.acrotex.net}\darg{home} +%\end{quote} +% The command creates a bookmark at the current +% bookmark level in the outline tree and associates the specified \ameta{action}. The argument +% \ameta{text} appears in the bookmark panel. The \ameta{name} is used for identification purposes. +% \begin{macrocode} +\newcommand{\currentpdfbookmarkx}[1]{% + \@ifnextchar[%] + {\currentpdfbookmarkx@i{#1}} + {\currentpdfbookmarkx@i{#1}[]}} +\def\currentpdfbookmarkx@i#1[#2]#3{% + \pdfbookmarkx[\Hy@currentbookmarklevel]{#1}[{#2}]{#3}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\subpdfbookmarkx} +% \hskip-\marginparsep\,\texttt{\darg{\ameta{text}}[\ameta{\ameta{xbmkskeys-kvp}}]\darg{\ameta{name}}}\\ +% Reduces the current bookmark level by one, then creates +% the bookmark at that level. The reduced level is the new current +% bookmark level. +% \begin{macrocode} +\newcommand{\subpdfbookmarkx}[1]{% + \@ifnextchar[%] + {\subpdfbookmarkx@i{#1}} + {\subpdfbookmarkx@i{#1}[]}} +\def\subpdfbookmarkx@i#1[#2]#3{% + \@tempcnta\Hy@currentbookmarklevel + \Hy@StepCount\@tempcnta + \expandafter + \pdfbookmarkx\expandafter[\the\@tempcnta]{#1}[{#2}]{#3}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\belowpdfbookmarkx} +% \hskip-\marginparsep\,\texttt{\darg{\ameta{text}}[\ameta{xbmkskeys-kvp}]\darg{\ameta{name}}}\\ +% Creates a bookmark at one level below the current +% bookmark level without changing the value of the current bookmark +% level. +% \begin{macrocode} +\newcommand{\belowpdfbookmarkx}[1]{% + \@ifnextchar[%] + {\belowpdfbookmarkx@i{#1}} + {\belowpdfbookmarkx@i{#1}[]}} +\def\belowpdfbookmarkx@i#1[#2]#3{% + \@tempcnta\Hy@currentbookmarklevel + \Hy@StepCount\@tempcnta + \expandafter + \pdfbookmarkx\expandafter[\the\@tempcnta]{#1}[{#2}]{#3}% + \advance\@tempcnta by -1 % + \xdef\Hy@currentbookmarklevel{\the\@tempcnta}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\nextAction@i} +% \hskip-\marginparsep\,\texttt{\darg{\ameta{anchor.level}}\darg{\ameta{xbmkskeys-kvp}}}\\ +% This command is used internally, the document author need not do anything. +% The command \cs{nextAction} is \cs{let} to \cs{nextAction@i} just prior to when +% the outline file is input; and is \cs{let} to \cs{@gobbletwo}, otherwise. +% \begin{macrocode} +\def\nextAction@i#1#2{\@ifundefined{X_#1}{% + \setkeys{xbmkskeys}{#2}% + \xbmkcsarg\xdef{X_#1}{\x@bmks@action}% + }{\global\xbmkcsarg\let{X_#1}\relax + \PackageWarning{xbmks} + {The anchor name `#1' is already defined,\MessageBreak + change this name, the bookmark will be created\MessageBreak + but it will have no associated action}}} +% \end{macrocode} +% \end{macro} +% These commands are implemented in the driver dependent sections. % \begin{macrocode} % End package %</package> @@ -264,7 +460,7 @@ % \begin{macrocode} \def\ReadBookmarks{% \pdf@ifdraftmode{}{% - \begingroup + \begingroup\def\\{\@backslashchar\@backslashchar}% dps \def\calc@bm@number##1{% \@tempcnta=\check@bm@number{##1}\relax \advance\@tempcnta by 1 % @@ -298,29 +494,48 @@ \def\@@BOOKMARK[##1][##2]##3##4##5{% \calc@bm@number{##5}% }% + \let\nextAction\@gobbletwo \InputIfFileExists{\xbmk@filename.out}{}{}% \def\@@BOOKMARK[##1][##2]##3##4##5{% \def\Hy@temp{##4}% - \ifx\xbmk@J\xbmk@filename - \pdfmark{% - pdfmark=/OUT,% - Count={##2\check@bm@number{##3}},% - Raw={\xbmks@intdoc\xbmk@intF},% - Dest={##3},% - Title=\expandafter\strip@prefix\meaning\Hy@temp - }% +% \end{macrocode} +% If `\texttt{X\_\#\#3}' is undefined (\cs{relax}), it is a normal bookmark. +% \begin{macrocode} + \xbmkcsarg\ifx{X_##3}\relax + \ifx\xbmk@J\xbmk@filename + \pdfmark{% + pdfmark=/OUT,% + Count={##2\check@bm@number{##3}},% + Raw={\xbmks@intC\xbmk@intF},% + Dest={##3},% + Title=\expandafter\strip@prefix\meaning\Hy@temp + }% + \else + \pdfmark{% + pdfmark=/OUT,% + Count={##2\check@bm@number{##3}},% + Raw={\xbmks@extC\xbmk@extF},% + Action=/GoToR,% + File={\xbmk@filename.pdf},% + Dest={##3},% + Title=\expandafter\strip@prefix\meaning\Hy@temp + }% + \fi \else +% \end{macrocode} +% The anchor has an `\texttt{X\_}' definition, it is a bookmark created +% from one of the `\texttt{bookmarkx}' commands. We treat this as a separate case. +% \begin{macrocode} + \x@rollCFIntoActionBmrk{##3}% \pdfmark{% pdfmark=/OUT,% Count={##2\check@bm@number{##3}},% - Raw={\xbmks@extdoc\xbmk@extF},% - Action=/GoToR,% - File={\xbmk@filename.pdf},% - Dest={##3},% + Raw={/Action<<\@nameuse{X_##3}>>\thisCol\thisF},% Title=\expandafter\strip@prefix\meaning\Hy@temp }% \fi - }% + }% bookmark + \let\nextAction\nextAction@i \InputIfFileExists{\xbmk@filename.out}{}{}% \egroup }% \@whilenum @@ -347,7 +562,7 @@ %<*pdftex> \def\ReadBookmarks{% \pdf@ifdraftmode{}{% - \begingroup + \begingroup\def\\{\@backslashchar\@backslashchar}% dps \def\calc@bm@number##1{% \@tempcnta=\check@bm@number{##1}\relax \advance\@tempcnta by 1 % @@ -377,8 +592,6 @@ \begingroup \def\WriteBookmarks{0}% \count\z@=0\relax -% \toks0=\expandafter{\jobname}% -% \edef\xbmk@J{\the\toks0}% \edef\xbmk@J{\jobname}% \@whilenum \count\z@<\xbmk@cnt\relax\do{% \advance\count\z@ by 1 % @@ -389,26 +602,44 @@ \gdef\@@BOOKMARK[##1][##2]##3##4##5{% \calc@bm@number{##5}% }% + \let\nextAction\@gobbletwo \InputIfFileExists{\xbmk@filename.out}{}{}% \gdef\@@BOOKMARK[##1][##2]##3##4##5{% \def\Hy@temp{##4}% \Hy@pstringdef\Hy@pstringName{\HyperDestNameFilter{##3}}% - \ifx\xbmk@J\xbmk@filename - \Hy@OutlineName{\xbmks@intdoc\xbmk@intF}{<</S/GoTo% - /D(\Hy@pstringName)>>}{% - ##2\check@bm@number{\Hy@pstringName}% - }{% - \expandafter\strip@prefix\meaning\Hy@temp - }% + \xbmkcsarg\ifx{X_##3}\relax +% \end{macrocode} +% Ordinary bookmark +% \begin{macrocode} + \ifx\xbmk@J\xbmk@filename + \Hy@OutlineName{\xbmks@intC\xbmk@intF}{<</S/GoTo% + /D(\Hy@pstringName)>>}{% + ##2\check@bm@number{\Hy@pstringName}% + }{% + \expandafter\strip@prefix\meaning\Hy@temp + }% + \else + \Hy@OutlineName{\xbmks@extC\xbmk@extF}{<</S/GoToR% + /F(\xbmk@filename.pdf)/D(\Hy@pstringName)>>}{% + ##2\check@bm@number{##3}% + }{% + \expandafter\strip@prefix\meaning\Hy@temp + }% + \fi \else - \Hy@OutlineName{\xbmks@extdoc\xbmk@extF}{<</S/GoToR% - /F(\xbmk@filename.pdf)/D(\Hy@pstringName)>>}{% - ##2\check@bm@number{##3}% +% \end{macrocode} +% Bookmark created by one of the `\texttt{...bookmarkx} commands +% \begin{macrocode} + \x@rollCFIntoActionBmrk{##3}% + \Hy@OutlineName{\thisCol\thisF} + {<<\@nameuse{X_##3}>>}{% + ##2\check@bm@number{\Hy@pstringName}% }{% \expandafter\strip@prefix\meaning\Hy@temp }% \fi }% bookmark + \let\nextAction\nextAction@i \InputIfFileExists{\xbmk@filename.out}{}{}% \egroup } % \@whilenum @@ -435,7 +666,7 @@ % \begin{macrocode} \def\ReadBookmarks{% \pdf@ifdraftmode{}{% - \begingroup + \begingroup\def\\{\@backslashchar\@backslashchar}% dps \def\calc@bm@number##1{% \@tempcnta=\check@bm@number{##1}\relax \advance\@tempcnta by 1 % @@ -469,37 +700,44 @@ \def\@@BOOKMARK[##1][##2]##3##4##5{% \calc@bm@number{##5}% }% + \let\nextAction\@gobbletwo \InputIfFileExists{\xbmk@filename.out}{}{}% \def\@@BOOKMARK[##1][##2]##3##4##5{% \def\Hy@temp{##4}% \Hy@pstringdef\Hy@pstringName{\HyperDestNameFilter{##3}}% + \x@rollCFIntoActionBmrk{##3}% \@pdfm@mark{% outline \ifHy@DvipdfmxOutlineOpen - [% - \ifnum##21>\z@ - \else - -% - \fi - ] % - \fi + [\ifnum##21>\z@\else-\fi] \fi ##1<<% - /Title(\expandafter\strip@prefix\meaning\Hy@temp)% + /Title(\expandafter\strip@prefix\meaning\Hy@temp)% + \xbmkcsarg\ifx{X_##3}\relax +% \end{macrocode} +% Ordinary bookmark +% \begin{macrocode} \ifx\xbmk@J\xbmk@filename /A<<% /S/GoTo% /D(\Hy@pstringName)% >>% - \xbmks@intdoc\xbmk@intF \else /A<<% /S/GoToR/F(\xbmk@filename.pdf)% /D(\Hy@pstringName)% >>% - \xbmks@extdoc\xbmk@extF \fi + \else +% \end{macrocode} +% Bookmark created by one of the \texttt{\string\...bookmarkx} commands +% \begin{macrocode} + /A<<\@nameuse{X_##3}>> + \fi + \thisCol\thisF >>% }% \@pdfm@mark + \let\thisC\@empty\let\thisF\@empty }% bookmark + \let\nextAction\nextAction@i \InputIfFileExists{\xbmk@filename.out}{}{}% \egroup }% \@whilenum diff --git a/Master/texmf-dist/source/latex/xbmks/xbmks.ins b/Master/texmf-dist/source/latex/xbmks/xbmks.ins index a86889a8b67..c23326bbf0d 100644 --- a/Master/texmf-dist/source/latex/xbmks/xbmks.ins +++ b/Master/texmf-dist/source/latex/xbmks/xbmks.ins @@ -46,7 +46,6 @@ \file{xbmks.sty}{\from{xbmks.dtx}{copyright,package}} \file{xbmks-pdfmark.def}{\from{xbmks.dtx}{copyright,pdfmark}} \file{xbmks-pdftex.def}{\from{xbmks.dtx}{copyright,pdftex}} - \file{xbmks-luatex.def}{\from{xbmks.dtx}{copyright,luatex}} \file{xbmks-xetex.def}{\from{xbmks.dtx}{copyright,xetex}} } diff --git a/Master/texmf-dist/tex/latex/xbmks/xbmks-luatex.def b/Master/texmf-dist/tex/latex/xbmks/xbmks-luatex.def deleted file mode 100644 index 6f3d50316aa..00000000000 --- a/Master/texmf-dist/tex/latex/xbmks/xbmks-luatex.def +++ /dev/null @@ -1,22 +0,0 @@ -%% -%% This is file `xbmks-luatex.def', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% xbmks.dtx (with options: `copyright,luatex') -%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% xbmks.sty package, %% -%% Copyright (C) 2016--2018 %% -%% dpstory@uakron.edu %% -%% %% -%% This program can redistributed and/or modified under %% -%% the terms of the LaTeX Project Public License %% -%% Distributed from CTAN archives in directory %% -%% macros/latex/base/lppl.txt; either version 1.2 of the %% -%% License, or (at your option) any later version. %% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\endinput -%% -%% End of file `xbmks-luatex.def'. diff --git a/Master/texmf-dist/tex/latex/xbmks/xbmks-pdfmark.def b/Master/texmf-dist/tex/latex/xbmks/xbmks-pdfmark.def index d769e3436eb..4471d3dd5d4 100644 --- a/Master/texmf-dist/tex/latex/xbmks/xbmks-pdfmark.def +++ b/Master/texmf-dist/tex/latex/xbmks/xbmks-pdfmark.def @@ -19,7 +19,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\ReadBookmarks{% \pdf@ifdraftmode{}{% - \begingroup + \begingroup\def\\{\@backslashchar\@backslashchar}% dps \def\calc@bm@number##1{% \@tempcnta=\check@bm@number{##1}\relax \advance\@tempcnta by 1 % @@ -53,29 +53,41 @@ \def\@@BOOKMARK[##1][##2]##3##4##5{% \calc@bm@number{##5}% }% + \let\nextAction\@gobbletwo \InputIfFileExists{\xbmk@filename.out}{}{}% \def\@@BOOKMARK[##1][##2]##3##4##5{% \def\Hy@temp{##4}% - \ifx\xbmk@J\xbmk@filename - \pdfmark{% - pdfmark=/OUT,% - Count={##2\check@bm@number{##3}},% - Raw={\xbmks@intdoc\xbmk@intF},% - Dest={##3},% - Title=\expandafter\strip@prefix\meaning\Hy@temp - }% + \xbmkcsarg\ifx{X_##3}\relax + \ifx\xbmk@J\xbmk@filename + \pdfmark{% + pdfmark=/OUT,% + Count={##2\check@bm@number{##3}},% + Raw={\xbmks@intC\xbmk@intF},% + Dest={##3},% + Title=\expandafter\strip@prefix\meaning\Hy@temp + }% + \else + \pdfmark{% + pdfmark=/OUT,% + Count={##2\check@bm@number{##3}},% + Raw={\xbmks@extC\xbmk@extF},% + Action=/GoToR,% + File={\xbmk@filename.pdf},% + Dest={##3},% + Title=\expandafter\strip@prefix\meaning\Hy@temp + }% + \fi \else + \x@rollCFIntoActionBmrk{##3}% \pdfmark{% pdfmark=/OUT,% Count={##2\check@bm@number{##3}},% - Raw={\xbmks@extdoc\xbmk@extF},% - Action=/GoToR,% - File={\xbmk@filename.pdf},% - Dest={##3},% + Raw={/Action<<\@nameuse{X_##3}>>\thisCol\thisF},% Title=\expandafter\strip@prefix\meaning\Hy@temp }% \fi - }% + }% bookmark + \let\nextAction\nextAction@i \InputIfFileExists{\xbmk@filename.out}{}{}% \egroup }% \@whilenum diff --git a/Master/texmf-dist/tex/latex/xbmks/xbmks-pdftex.def b/Master/texmf-dist/tex/latex/xbmks/xbmks-pdftex.def index 2adc7f171c6..9931f2259b3 100644 --- a/Master/texmf-dist/tex/latex/xbmks/xbmks-pdftex.def +++ b/Master/texmf-dist/tex/latex/xbmks/xbmks-pdftex.def @@ -19,7 +19,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\ReadBookmarks{% \pdf@ifdraftmode{}{% - \begingroup + \begingroup\def\\{\@backslashchar\@backslashchar}% dps \def\calc@bm@number##1{% \@tempcnta=\check@bm@number{##1}\relax \advance\@tempcnta by 1 % @@ -59,26 +59,38 @@ \gdef\@@BOOKMARK[##1][##2]##3##4##5{% \calc@bm@number{##5}% }% + \let\nextAction\@gobbletwo \InputIfFileExists{\xbmk@filename.out}{}{}% \gdef\@@BOOKMARK[##1][##2]##3##4##5{% \def\Hy@temp{##4}% \Hy@pstringdef\Hy@pstringName{\HyperDestNameFilter{##3}}% - \ifx\xbmk@J\xbmk@filename - \Hy@OutlineName{\xbmks@intdoc\xbmk@intF}{<</S/GoTo% - /D(\Hy@pstringName)>>}{% - ##2\check@bm@number{\Hy@pstringName}% - }{% - \expandafter\strip@prefix\meaning\Hy@temp - }% + \xbmkcsarg\ifx{X_##3}\relax + \ifx\xbmk@J\xbmk@filename + \Hy@OutlineName{\xbmks@intC\xbmk@intF}{<</S/GoTo% + /D(\Hy@pstringName)>>}{% + ##2\check@bm@number{\Hy@pstringName}% + }{% + \expandafter\strip@prefix\meaning\Hy@temp + }% + \else + \Hy@OutlineName{\xbmks@extC\xbmk@extF}{<</S/GoToR% + /F(\xbmk@filename.pdf)/D(\Hy@pstringName)>>}{% + ##2\check@bm@number{##3}% + }{% + \expandafter\strip@prefix\meaning\Hy@temp + }% + \fi \else - \Hy@OutlineName{\xbmks@extdoc\xbmk@extF}{<</S/GoToR% - /F(\xbmk@filename.pdf)/D(\Hy@pstringName)>>}{% - ##2\check@bm@number{##3}% + \x@rollCFIntoActionBmrk{##3}% + \Hy@OutlineName{\thisCol\thisF} + {<<\@nameuse{X_##3}>>}{% + ##2\check@bm@number{\Hy@pstringName}% }{% \expandafter\strip@prefix\meaning\Hy@temp }% \fi }% bookmark + \let\nextAction\nextAction@i \InputIfFileExists{\xbmk@filename.out}{}{}% \egroup } % \@whilenum diff --git a/Master/texmf-dist/tex/latex/xbmks/xbmks-xetex.def b/Master/texmf-dist/tex/latex/xbmks/xbmks-xetex.def index 18622b9ee3c..eea0df0aae1 100644 --- a/Master/texmf-dist/tex/latex/xbmks/xbmks-xetex.def +++ b/Master/texmf-dist/tex/latex/xbmks/xbmks-xetex.def @@ -19,7 +19,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\ReadBookmarks{% \pdf@ifdraftmode{}{% - \begingroup + \begingroup\def\\{\@backslashchar\@backslashchar}% dps \def\calc@bm@number##1{% \@tempcnta=\check@bm@number{##1}\relax \advance\@tempcnta by 1 % @@ -53,37 +53,38 @@ \def\@@BOOKMARK[##1][##2]##3##4##5{% \calc@bm@number{##5}% }% + \let\nextAction\@gobbletwo \InputIfFileExists{\xbmk@filename.out}{}{}% \def\@@BOOKMARK[##1][##2]##3##4##5{% \def\Hy@temp{##4}% \Hy@pstringdef\Hy@pstringName{\HyperDestNameFilter{##3}}% + \x@rollCFIntoActionBmrk{##3}% \@pdfm@mark{% outline \ifHy@DvipdfmxOutlineOpen - [% - \ifnum##21>\z@ - \else - -% - \fi - ] % - \fi + [\ifnum##21>\z@\else-\fi] \fi ##1<<% - /Title(\expandafter\strip@prefix\meaning\Hy@temp)% + /Title(\expandafter\strip@prefix\meaning\Hy@temp)% + \xbmkcsarg\ifx{X_##3}\relax \ifx\xbmk@J\xbmk@filename /A<<% /S/GoTo% /D(\Hy@pstringName)% >>% - \xbmks@intdoc\xbmk@intF \else /A<<% /S/GoToR/F(\xbmk@filename.pdf)% /D(\Hy@pstringName)% >>% - \xbmks@extdoc\xbmk@extF \fi + \else + /A<<\@nameuse{X_##3}>> + \fi + \thisCol\thisF >>% }% \@pdfm@mark + \let\thisC\@empty\let\thisF\@empty }% bookmark + \let\nextAction\nextAction@i \InputIfFileExists{\xbmk@filename.out}{}{}% \egroup }% \@whilenum diff --git a/Master/texmf-dist/tex/latex/xbmks/xbmks.sty b/Master/texmf-dist/tex/latex/xbmks/xbmks.sty index 700bd082eeb..8fa488964e2 100644 --- a/Master/texmf-dist/tex/latex/xbmks/xbmks.sty +++ b/Master/texmf-dist/tex/latex/xbmks/xbmks.sty @@ -19,7 +19,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e}[1997/12/01] \ProvidesPackage{xbmks} - [2018/06/13 v1.1 xbmks: Cross-document bookmarks (dps)] + [2018/06/25 v2.0.1 xbmks: Cross-document bookmarks (dps)] \RequirePackage{xkeyval} \RequirePackage{ifpdf}[2006/02/20] \RequirePackage{ifxetex}[2006/08/21] @@ -44,25 +44,25 @@ \let\x@bmks@docs\@empty \define@key{xbmksetup}{colors}[]{\def\x@bmks@colors{#1}} \let\x@bmks@colors\@empty -\define@key{xbmksetup}{style}[]{\def\x@bmks@style{#1}} -\let\x@bmks@style\@empty -\define@key{xbmk@colors}{intdoc}[]{% - \HyColor@BookmarkColor{#1}{\xbmks@intdoc}{xbmks}{intdoc}% - \ifx\xbmks@intdoc\@empty\else - \edef\xbmks@intdoc{/C[\xbmks@intdoc]}\fi +\define@key{xbmksetup}{styles}[]{\def\x@bmks@styles{#1}} +\let\x@bmks@styles\@empty +\define@key{xbmk@colors}{int}[]{% + \HyColor@BookmarkColor{#1}{\xbmks@intC}{xbmks}{int}% + \ifx\xbmks@intC\@empty\else + \edef\xbmks@intC{/C[\xbmks@intC]}\fi } -\let\xbmks@intdoc\@empty -\define@key{xbmk@colors}{extdoc}[]{% - \HyColor@BookmarkColor{#1}{\xbmks@extdoc}{xbmks}{extdoc}% - \ifx\xbmks@extdoc\@empty\else - \edef\xbmks@extdoc{/C[\xbmks@extdoc]}\fi +\let\xbmks@intC\@empty +\define@key{xbmk@colors}{ext}[]{% + \HyColor@BookmarkColor{#1}{\xbmks@extC}{xbmks}{ext}% + \ifx\xbmks@extC\@empty\else + \edef\xbmks@extC{/C[\xbmks@extC]}\fi } -\let\xbmks@extdoc\@empty +\let\xbmks@extC\@empty \let\xbmks@Yes=y \let\xbmks@No=n -\define@boolkey{xbmk@style}{intbf}[true]{} %\ifKV@xbmk@style@intbf -\define@boolkey{xbmk@style}{extbf}[true]{} -\define@boolkey{xbmk@style}{intit}[true]{} -\define@boolkey{xbmk@style}{extit}[true]{} +\define@boolkey{xbmk@styles}{intbf}[true]{} +\define@boolkey{xbmk@styles}{extbf}[true]{} +\define@boolkey{xbmk@styles}{intit}[true]{} +\define@boolkey{xbmk@styles}{extit}[true]{} \newcommand{\xbmksetup}[1]{\setkeys{xbmksetup}{#1}% \ifx\x@bmks@docs\@empty \PackageInfo{xbmks}{The docbundle key of \string\xbmksetup\space @@ -81,50 +81,134 @@ } \newcommand{\xbmksetupi}[1]{% \setkeys{xbmksetup}{#1}% - \edef\@exp@for{\noexpand\docbundle{\x@bmks@docs}}\expandafter - \@exp@for - \edef\@exp@keys{\noexpand - \setkeys{xbmk@colors}{\x@bmks@colors}}\@exp@keys - \edef\@exp@keys{\noexpand - \setkeys{xbmk@style}{\x@bmks@style}}\@exp@keys - \def\xbmk@intF{}% - \ifKV@xbmk@style@intit - \ifKV@xbmk@style@intbf - \def\xbmk@intF{/F 3}% - \else - \def\xbmk@intF{/F 1}% - \fi - \else - \ifKV@xbmk@style@intbf - \def\xbmk@intF{/F 2}% - \fi - \fi - \def\xbmk@extF{}% - \ifKV@xbmk@style@extit - \ifKV@xbmk@style@extbf - \def\xbmk@extF{/F 3}% - \else - \def\xbmk@extF{/F 1}% - \fi - \else - \ifKV@xbmk@style@extbf - \def\xbmk@extF{/F 2}% - \fi - \fi + \edef\x{\noexpand\x@docbundle{\x@bmks@docs}}\x + \edef\x{\noexpand + \setkeys{xbmk@colors}{\x@bmks@colors}}\x + \edef\x{\noexpand + \setkeys{xbmk@styles}{\x@bmks@styles}}\x + \let\xbmk@intF\@empty + \ifKV@xbmk@styles@intit + \ifKV@xbmk@styles@intbf + \def\xbmk@intF{/F 3}\else + \def\xbmk@intF{/F 1}\fi + \else + \ifKV@xbmk@styles@intbf + \def\xbmk@intF{/F 2}\fi + \fi + \let\xbmk@extF\@empty + \ifKV@xbmk@styles@extit + \ifKV@xbmk@styles@extbf + \def\xbmk@extF{/F 3}\else + \def\xbmk@extF{/F 1}\fi + \else + \ifKV@xbmk@styles@extbf + \def\xbmk@extF{/F 2}\fi + \fi } -\def\xbmk@csarg#1#2{\expandafter#1\csname#2\endcsname} +\def\xbmkcsarg#1#2{\expandafter#1\csname#2\endcsname} \xdef\xbmk@cnt{0} -\newcommand{\docbundle}[1]{\bgroup +\newcommand{\x@docbundle}[1]{\bgroup \def\thisDoc{\jobname}\count\z@=0 % \edef\@tmpexp{\noexpand\@for\noexpand\@arg:=#1}% - \@tmpexp\do{% - \advance\count\z@ by 1\relax - \edef\@tmpexp{\noexpand\xbmk@recordDoc{\@arg}}\@tmpexp + \@tmpexp\do{\advance\count\z@ by 1\relax + \edef\x{\noexpand\xbmk@recordDoc{\@arg}}\x + \edef\x{\noexpand\xbmk@docID{\@arg}}\x }% \xdef\xbmk@cnt{\the\count\z@}\egroup } \newcommand{\xbmk@recordDoc}[1]{% - \xbmk@csarg\xdef{xbmk@doc\the\count\z@}{#1}} + \xbmkcsarg\xdef{xbmk@doc\the\count\z@}{#1}} +\newcommand{\xbmk@docID}[1]{% + \xbmkcsarg\xdef{x#1}{x\the\count\z@}} +\xbmkcsarg\xdef{x\jobname}{x0} +\define@key{xbmkskeys}{action}{\def\x@bmks@action{#1}} +\let\x@bmks@action\@empty +\define@key{xbmkskeys}{color}[]{% + \HyColor@BookmarkColor{#1}{\x@bmks@C}{xbmks}{color}% + \ifx\x@bmks@C\@empty\else + \edef\x@bmks@C{/C[\x@bmks@C]}\fi +} +\let\x@bmks@C\@empty +\define@key{xbmkskeys}{style}[]{% + \edef\x{\noexpand\setkeys{xbmks@style}{#1}}\x + \let\x@bmks@F\@empty + \ifKV@xbmks@style@it + \ifKV@xbmks@style@bf + \def\x@bmks@F{/F 3}\else + \def\x@bmks@F{/F 1}\fi + \else + \ifKV@xbmks@style@bf + \def\x@bmks@F{/F 2}\fi + \fi +} +\let\x@bmks@F\@empty +\define@boolkey{xbmks@style}{bf}[true]{} +\define@boolkey{xbmks@style}{it}[true]{} +\def\x@rollCFIntoActionBmrk#1{% + \xbmkcsarg\ifx{X_#1}\relax + \let\x@bmks@C\@empty\let\x@bmks@F\@empty\fi + \ifx\xbmk@J\xbmk@filename + \ifx\x@bmks@C\@empty\let\thisCol\xbmks@intC\else + \let\thisCol\x@bmks@C\fi + \ifx\x@bmks@F\@empty\let\thisF\xbmk@intF\else + \let\thisF\x@bmks@F\fi + \else + \ifx\x@bmks@C\@empty\let\thisCol\xbmks@extC\else + \let\thisCol\x@bmks@C\fi + \ifx\x@bmks@F\@empty\let\thisF\xbmk@extF\else + \let\thisF\x@bmks@F\fi + \fi + \global\let\x@bmks@C\@empty\global\let\x@bmks@F\@empty +} +\newcommand\pdfbookmarkx[2][0]{% + \@ifnextchar[%] + {\pdfbookmarkx@i{#1}{#2}} + {\pdfbookmarkx@i{#1}{#2}[]}} +\def\pdfbookmarkx@i#1#2[#3]#4{% level, title, action, name + \def\x@rgiii{#3}\ifx\x@rgiii\@empty + \Hy@writebookmark{}{#2}{#4.#1}{#1}{toc}% + \hyper@anchorstart{#4.#1}\hyper@anchorend + \else + \protected@write\@outlinefile{}{% + \string\nextAction% assign doc ID + {\@nameuse{x\jobname}#4.#1}{#3}}% + \Hy@writebookmark{}{#2}{\@nameuse{x\jobname}#4.#1}{#1}{toc}% + \fi +} +\newcommand{\currentpdfbookmarkx}[1]{% + \@ifnextchar[%] + {\currentpdfbookmarkx@i{#1}} + {\currentpdfbookmarkx@i{#1}[]}} +\def\currentpdfbookmarkx@i#1[#2]#3{% + \pdfbookmarkx[\Hy@currentbookmarklevel]{#1}[{#2}]{#3}} +\newcommand{\subpdfbookmarkx}[1]{% + \@ifnextchar[%] + {\subpdfbookmarkx@i{#1}} + {\subpdfbookmarkx@i{#1}[]}} +\def\subpdfbookmarkx@i#1[#2]#3{% + \@tempcnta\Hy@currentbookmarklevel + \Hy@StepCount\@tempcnta + \expandafter + \pdfbookmarkx\expandafter[\the\@tempcnta]{#1}[{#2}]{#3}} +\newcommand{\belowpdfbookmarkx}[1]{% + \@ifnextchar[%] + {\belowpdfbookmarkx@i{#1}} + {\belowpdfbookmarkx@i{#1}[]}} +\def\belowpdfbookmarkx@i#1[#2]#3{% + \@tempcnta\Hy@currentbookmarklevel + \Hy@StepCount\@tempcnta + \expandafter + \pdfbookmarkx\expandafter[\the\@tempcnta]{#1}[{#2}]{#3}% + \advance\@tempcnta by -1 % + \xdef\Hy@currentbookmarklevel{\the\@tempcnta}} +\def\nextAction@i#1#2{\@ifundefined{X_#1}{% + \setkeys{xbmkskeys}{#2}% + \xbmkcsarg\xdef{X_#1}{\x@bmks@action}% + }{\global\xbmkcsarg\let{X_#1}\relax + \PackageWarning{xbmks} + {The anchor name `#1' is already defined,\MessageBreak + change this name, the bookmark will be created\MessageBreak + but it will have no associated action}}} \InputIfFileExists{xbmks.cfg}{}{} \@ifpackageloaded{bookmark}{\PackageWarningNoLine{xbmks}{The bookmark package is not supported;\MessageBreak |