summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xbmks
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/xbmks
Initial commit
Diffstat (limited to 'macros/latex/contrib/xbmks')
-rw-r--r--macros/latex/contrib/xbmks/README.md37
-rw-r--r--macros/latex/contrib/xbmks/docs/xbmks.pdfbin0 -> 109548 bytes
-rw-r--r--macros/latex/contrib/xbmks/docs/xbmksman.pdfbin0 -> 211396 bytes
-rw-r--r--macros/latex/contrib/xbmks/docs/xbmksman.tex465
-rw-r--r--macros/latex/contrib/xbmks/examples/doc1.pdfbin0 -> 18419 bytes
-rw-r--r--macros/latex/contrib/xbmks/examples/doc1.tex50
-rw-r--r--macros/latex/contrib/xbmks/examples/doc2.pdfbin0 -> 17032 bytes
-rw-r--r--macros/latex/contrib/xbmks/examples/doc2.tex48
-rw-r--r--macros/latex/contrib/xbmks/examples/master.pdfbin0 -> 23076 bytes
-rw-r--r--macros/latex/contrib/xbmks/examples/master.tex105
-rw-r--r--macros/latex/contrib/xbmks/examples/stand-alone.tex55
-rw-r--r--macros/latex/contrib/xbmks/xbmks.dtx779
-rw-r--r--macros/latex/contrib/xbmks/xbmks.ins61
13 files changed, 1600 insertions, 0 deletions
diff --git a/macros/latex/contrib/xbmks/README.md b/macros/latex/contrib/xbmks/README.md
new file mode 100644
index 0000000000..507038dafb
--- /dev/null
+++ b/macros/latex/contrib/xbmks/README.md
@@ -0,0 +1,37 @@
+The xbmks Package
+Author: D. P. Story
+Dated: 2018/07/04
+
+Short description: Create a cross-document bookmark tree.
+
+The package defines the concept of a document bundle, which is a collection
+of documents that are to be build separately, but have a common bookmark
+tree.
+
+This package takes the bookmarks of each file in doc bundle and merges them.
+The merged bookmarks are listed in all the documents of the document bundle.
+In this way, a sort of 'table of contents' is available to all documents in
+the bundle.
+
+PDF Creator: no restrictions, use dvips->distiller|ps2pdf, pdflatex,
+lualatex, or xelatex.
+
+What's New (2018/07/04) Fixed a problem wherein the bookmarks do not appear
+after an even number of compilations.
+
+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
+case, we set docbundle=\jobname. Bookmarks are generated for that document
+alone, as an extra benefit, the keys colors and style are still obeyed.
+
+
+Now, I simply must get back to my retirement.
+
+D. P. Story
+www.acrotex.net
+dpstory@uakron.edu
+dpstory@acrotex.net
diff --git a/macros/latex/contrib/xbmks/docs/xbmks.pdf b/macros/latex/contrib/xbmks/docs/xbmks.pdf
new file mode 100644
index 0000000000..c6dd851951
--- /dev/null
+++ b/macros/latex/contrib/xbmks/docs/xbmks.pdf
Binary files differ
diff --git a/macros/latex/contrib/xbmks/docs/xbmksman.pdf b/macros/latex/contrib/xbmks/docs/xbmksman.pdf
new file mode 100644
index 0000000000..8ddd2dbe35
--- /dev/null
+++ b/macros/latex/contrib/xbmks/docs/xbmksman.pdf
Binary files differ
diff --git a/macros/latex/contrib/xbmks/docs/xbmksman.tex b/macros/latex/contrib/xbmks/docs/xbmksman.tex
new file mode 100644
index 0000000000..cf2980683b
--- /dev/null
+++ b/macros/latex/contrib/xbmks/docs/xbmksman.tex
@@ -0,0 +1,465 @@
+%
+% Need some discussion on workflow
+%
+% makeindex < aebpro_man.idx > aebpro_man.ind
+\documentclass[10pt]{article}
+\usepackage[fleqn]{amsmath}
+\usepackage[
+ web={centertitlepage,designv,forcolorpaper,latextoc,pro,addtoHyOpts={pagebackref=false}},
+ eforms,
+% linktoattachments,
+ aebxmp
+]{aeb_pro}
+\usepackage{aeb_mlink}
+\usepackage{xbmks}
+\usepackage{graphicx,array}
+%\usepackage{myriadpro}
+%\usepackage{calibri}
+\usepackage[altbullet]{lucidbry}
+
+\DeclareInitView{layoutmag={navitab:UseOutlines}}
+\xbmksetup{colors={int=red},styles={intbf}}
+
+\addtolength{\marginparwidth}{20pt}
+
+%\previewtrue
+%\usepackage{makeidx}
+%\makeindex
+\usepackage{acroman}
+\usepackage[active]{srcltx}
+
+\setcounter{secnumdepth}{4}
+\setcounter{tocdepth}{5}
+\makeatletter
+\renewcommand*{\theparagraph}{\texorpdfstring{\protect\P\protect\ }{\textparagraph}}
+\renewcommand{\paragraph}
+ {\renewcommand{\@seccntformat}[1]{\theparagraph}%
+ \@startsection{paragraph}{4}{0pt}{6pt}{-3pt}{\color{\aeb@subsubsectioncolor}\bfseries}}
+\renewcommand*\l@paragraph{\@dottedtocline{4}{5.0em}{1em}} %{7.0em}{4.1em}}
+\def\chgCurrLblName#1{\def\@currentlabelname{#1}}
+\def\echgCurrLblName#1{\edef\@currentlabelname{#1}}
+\makeatother
+
+%\getDimsFromGraphic{graphics/dpsweb}{\dpswebW}{\dpswebH}
+
+
+%\urlstyle{rm}
+\urlstyle{sf}
+\let\uif\textsf
+\let\app\textsf
+\def\psf#1{\textbf{\textsf{#1}}}
+%\let\amtIndent\leftmargini
+\edef\amtIndent{\the\parindent}
+
+\renewcommand*\descriptionlabel[1]{\hspace\labelsep
+ \normalfont #1}
+
+
+\DeclareDocInfo
+{
+ university={Acro\negthinspace\TeX.Net},
+ title={The \textsf{xbmks} package\texorpdfstring{\\}{: }Cross-document bookmarks},
+ author={D. P. Story},
+ email={dpstory@acrotex.net},
+ subject={Documentation for the xbmks package from AcroTeX: cross-document bookmarks},
+ talksite={\url{www.acrotex.net}},
+ version={v2.0.2, 2018/07/04},
+ Keywords={AcroTeX, bookmarks, cross-document, document bundle},
+ copyrightStatus=True,
+ copyrightNotice={Copyright (C) \the\year, D. P. Story},
+ copyrightInfoURL={http://www.acrotex.net}
+}
+
+\def\dps{$\hbox{$\mathfrak D$\kern-.3em\hbox{$\mathfrak P$}%
+ \kern-.6em \hbox{$\mathcal S$}}$}
+
+\universityLayout{fontsize=Large}
+\titleLayout{fontsize=LARGE}
+\authorLayout{fontsize=Large}
+\tocLayout{fontsize=Large,color=aeb}
+\sectionLayout{indent=-62.5pt,fontsize=large,color=aeb}
+\subsectionLayout{indent=-31.25pt,color=aeb}
+\subsubsectionLayout{indent=0pt,color=aeb}
+\subsubDefaultDing{\texorpdfstring{$\bullet$}{\textrm\textbullet}}
+
+\widestNumber{0.00.}
+%\pagestyle{empty}
+%\parindent0pt\parskip\medskipamount
+
+\def\dps{$\mbox{$\mathfrak D$\kern-.3em\mbox{$\mathfrak P$}%
+ \kern-.6em \hbox{$\mathcal S$}}$}
+
+\newcount\fldCnt \fldCnt=0
+\def\incFldCnt{\global\advance\fldCnt1\relax}
+
+\frenchspacing
+
+\chngDocObjectTo{\newDO}{doc}
+\begin{docassembly}
+var titleOfManual="The xbmks package MANUAL";
+var manualfilename="Manual_BG_Print_xbmks.pdf";
+var manualtemplate="Manual_BG_Brown.pdf"; // Blue, Green, Brown
+var _pathToBlank="C:/Users/Public/Documents/ManualBGs/"+manualtemplate;
+var doc;
+var buildIt=false;
+if ( buildIt ) {
+ console.println("Creating new " + manualfilename + " file.");
+ doc = \appopenDoc({cPath: _pathToBlank, bHidden: true});
+ var _path=this.path;
+ var pos=_path.lastIndexOf("/");
+ _path=_path.substring(0,pos)+"/"+manualfilename;
+ \docSaveAs\newDO ({ cPath: _path });
+ doc.closeDoc();
+ doc = \appopenDoc({cPath: manualfilename, oDoc:this, bHidden: true});
+ f=doc.getField("ManualTitle");
+ f.value=titleOfManual;
+ doc.flattenPages();
+ \docSaveAs\newDO({ cPath: manualfilename });
+ doc.closeDoc();
+} else {
+ console.println("Using the current "+manualfilename+" file.");
+}
+var _path=this.path;
+var pos=_path.lastIndexOf("/");
+_path=_path.substring(0,pos)+"/"+manualfilename;
+\addWatermarkFromFile({
+ bOnTop:false,
+ bOnPrint:false,
+ cDIPath:_path
+});
+\executeSave();
+\end{docassembly}
+
+\begin{document}
+
+\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}
+
+\def\AcroT{Acro\!\TeX}\def\cAcroT{\textcolor{blue}{\AcroT}}
+\def\AcroEB{\AcroT{} eDucation Bundle}\def\cAcroEB{\textcolor{blue}{\AcroEB}}
+\def\AcroB{\AcroT{} Bundle}\def\cAcroB{\textcolor{blue}{\AcroB}}
+\def\bUrl{http://www.math.uakron.edu/~dpstory}
+
+\hypersetup{linktocpage}
+
+\section{Introduction}
+
+It has been more than a couple decades ago (counting back from 2018), I wrote
+two mathematics tutorials:
+\textsl{\href{http://www.math.uakron.edu/~dpstory/e-calculus.html}{eCalculus}}
+and
+\textsl{\mlhref{http://www.math.uakron.edu/~dpstory/mpt_home.html}{Algebra
+Review in Ten Lessons}}. The tutorials consisted of a number of lessons, each
+lesson was in a separate PDF. The bookmarks of each lesson contained the
+table of contents \emph{for the whole tutorial}. A student, in theory, could
+then jump from one lesson to another by selecting a topic of interest from
+the bookmarks. In the intervening years I have not seen a {\LaTeX} package
+for merging the table of contents of a set of PDFs and merge them in this
+each member of the set. The \pkg{xbmks} package attempts to reproduce this
+feature.
+
+\section{Required packages and options}
+
+The only requirement is the \pkg{hyperref} package; there is a negative
+requirement, the \pkg{bookmark} package is not supported. If it is detected
+within a \pkg{xbmks} document, normal non-cross-document bookmarks are
+produced.
+
+The only options are driver options, these are \opt{dvips} (\app{Acrobat
+Distiller} or \app{ps2pdf} can be used as the PDF creator), \opt{pdftex} (and
+\opt{luatex}, which is treated the same as \opt{pdftex}), and \opt{xetex}. Of
+course, this is a {\LaTeX} package, so the `la' versions of these applications
+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}}}\label{s:xbmksetup}
+
+The only user command is \cs{xbmksetup}:
+\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={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}
+key) that you want to merge the bookmarks together so they appear in all the
+files. However, the \cs{xbmksetup} only appears \textbf{in one and only one
+of the documents}, perhaps the one that you think of as the main file.\footnote{The main file is the first one
+listed in the value of the \texttt{docbundle} key.} The
+argument of \cs{xbmksetup} are written to the file \texttt{xbmks.cfg} and
+input back into each of the files as they are compiled. This is needed so
+that across all files in the document bundle, they all obey the very same
+options.
+
+\paragraph*{Description of the key-values}
+\begin{description}
+ \item[\texttt{docbundle}] (Optional) The value of this key, if present,
+ is a comma-delimited list of base names that are a part of this
+ document collection, or bundle. For example,
+\begin{Verbatim}[xleftmargin=\amtIndent]
+docbundle={lesson1,lesson2,lesson3,lesson4}
+\end{Verbatim}
+The order the bookmarks are listed in each file of the document bundle is the same order
+the files are listed in \texttt{docbundle}; in this above example, the bookmarks for
+\texttt{lesson1} are listed first, than those of \texttt{lesson2}, and so on.
+
+The first document listed (\texttt{lesson1}) is where the \cs{xbmksetup}
+commend is placed. This file might be thought of as the `main' file.
+
+\textbf{\textcolor{red}{Important:}} It is extremely important to list the
+base names the using the same spelling and case as the \cs{jobname} command
+returns in each of the bundle collection. When each file is compiled,
+\pkg{xbmks} tries to determine which in the list of \texttt{docbundle}
+files is the one currently being compiled; it is necessary in order to
+create a internal jump or an external jump. If anything goes wrong, be sure
+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{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={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{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={int={[rgb]{0,.6,0}}
+\end{Verbatim}
+or, if the \pkg{xcolor} package is loaded, \emph{named colors} may be used.
+ \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{int}:
+\begin{Verbatim}[xleftmargin=\amtIndent]
+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{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
+Theme}. The PDF viewer (\app{Acrobat} and \app{Acrobat Reader DC}
+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{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 styles (valueless) keys are \texttt{intbf} and \texttt{intit}; zero, one, or
+ two of these may be specified,
+\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()]
+styles={intbf} % !normalfont(bold font)
+styles={intit} % !normalfont(italics font)
+styles={intbf,intit} % !normalfont(bold and italics font)
+\end{Verbatim}
+ \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=!()]
+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{styles} key:
+\begin{Verbatim}[xleftmargin=\amtIndent]
+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
+document and plain font for any external document. I think it's important to
+make it clear in the bookmark panel which are internal and which are
+external. The bold font tells the same story independent of theme. Thus,\def\1{\qquad}%
+\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()]
+\xbmksetup{%
+!1docbundle={!ameta(doc!SUB1),!ameta(doc!SUB2),...,!ameta(doc!SUB(n))},
+!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
+bookmarks, how exactly do you do this? Basically, you treat them the same way
+as you would when you use the \pkg{xy-hyper} package, used for creating cross
+document links.
+
+\paragraph*{Steps to build the document bundle}\leavevmode
+
+\begin{enumerate}
+ \item Compile each document at least twice without deleting any
+ auxiliary files, more if you are using \pkg{xr-hyper}; in
+ particular, without deleting any \textsf{OUT} outline files created
+ by \pkg{hyperref}.
+
+ In terms of order of compilation, compile the main file first (the
+ one that contains the \cs{xbmksetup} command); this will write the
+ \texttt{xbmks.cfg} file and it will be available to the other files
+ in the bundle as you compile them.
+
+ \item All files have been compiled twice, now compile them one more
+ time so they can input the updated \textsf{OUT} files of the
+ collection and the \texttt{xbmks.cfg} configuration file that
+ contains your setup options for the whole collection.
+ \item If you are using \app{pdflatex}, \app{lualatex}, or
+ \app{xelatex}, you are done; otherwise, convert each DVI file to PS
+ using \app{dvips}. Finally, convert each PS file in the collection
+ to PDF using \app{Acrobat Distiller} or \app{ps2pdf}.
+ \item Delete all auxiliary file, including \texttt{xbmks.cfg} if you wish.
+\end{enumerate}
+If you are on \app{Windows OS}, you can use the
+\app{\href{http://www.acrotex.net/builders/}{AeB Builder}} utility to build
+the entire bundle of
+documents.\footnote{\url{http://www.acrotex.net/builders/}} In that utility,
+you would select the \app{External cross-references} option, found on the
+user-interface.
+
+\paragraph*{Sample files.} The demonstration files are found in the \texttt{examples} folder. The
+\pkg{xcolor} package is used, otherwise, the packages used are minimal.
+
+
+\newtopic\noindent Now, back to my retirement. \dps
+
+
+
+\end{document}
diff --git a/macros/latex/contrib/xbmks/examples/doc1.pdf b/macros/latex/contrib/xbmks/examples/doc1.pdf
new file mode 100644
index 0000000000..f975d83b0e
--- /dev/null
+++ b/macros/latex/contrib/xbmks/examples/doc1.pdf
Binary files differ
diff --git a/macros/latex/contrib/xbmks/examples/doc1.tex b/macros/latex/contrib/xbmks/examples/doc1.tex
new file mode 100644
index 0000000000..1c5da0183c
--- /dev/null
+++ b/macros/latex/contrib/xbmks/examples/doc1.tex
@@ -0,0 +1,50 @@
+\documentclass[12pt]{article}
+\usepackage{xcolor}
+%\usepackage{xr-hyper}
+\usepackage[bookmarksopen,bookmarksnumbered]{hyperref}
+\usepackage{xbmks}
+
+
+% the xr-hyper package may also be used if you have
+% cross document links within the body of the doc
+%\externaldocument[m-]{master}
+%\externaldocument[d2-]{doc2}
+
+% just for laughs, we transfer the last section number from master
+\setcounter{section}{2}
+
+\begin{document}
+
+\section{Doc 1: Sec 1}\label{sec1}
+
+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}
+
+Some content goes here.
+
+\newpage
+
+\subsection{Doc 1: subSec 2}
+
+Some content goes here.
+
+\newpage
+
+\section{Doc 1: Sec 2}
+
+Some content goes here.: go to Section~\ref{sec1}
+
+\newpage
+
+\subsection{Doc 1: subSec 1}
+
+
+\end{document}
diff --git a/macros/latex/contrib/xbmks/examples/doc2.pdf b/macros/latex/contrib/xbmks/examples/doc2.pdf
new file mode 100644
index 0000000000..488cae0379
--- /dev/null
+++ b/macros/latex/contrib/xbmks/examples/doc2.pdf
Binary files differ
diff --git a/macros/latex/contrib/xbmks/examples/doc2.tex b/macros/latex/contrib/xbmks/examples/doc2.tex
new file mode 100644
index 0000000000..8bc8ebb833
--- /dev/null
+++ b/macros/latex/contrib/xbmks/examples/doc2.tex
@@ -0,0 +1,48 @@
+\documentclass[12pt]{article}
+\usepackage{xcolor}
+%\usepackage{xr-hyper}
+\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}
+%\externaldocument[d1-]{doc1}
+
+\begin{document}
+
+\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
+
+\subsection{Doc 2: subSec 1}
+
+Some content goes here.
+
+\section{Doc 2: Sec 2}
+
+\subsection{Doc 2: subSec 1}
+
+Some content goes here.
+
+\newpage
+
+\subsection{Doc 2: subSec 2}
+
+Some content goes here.
+
+\subsection{Doc 2: subSec 3}
+
+Some content goes here.
+
+
+\end{document}
diff --git a/macros/latex/contrib/xbmks/examples/master.pdf b/macros/latex/contrib/xbmks/examples/master.pdf
new file mode 100644
index 0000000000..dbc1ca0451
--- /dev/null
+++ b/macros/latex/contrib/xbmks/examples/master.pdf
Binary files differ
diff --git a/macros/latex/contrib/xbmks/examples/master.tex b/macros/latex/contrib/xbmks/examples/master.tex
new file mode 100644
index 0000000000..5dc32e5967
--- /dev/null
+++ b/macros/latex/contrib/xbmks/examples/master.tex
@@ -0,0 +1,105 @@
+\documentclass[12pt]{article}
+\usepackage{xcolor}
+%\usepackage{xr-hyper}
+\usepackage[bookmarksopen,bookmarksnumbered]{hyperref}
+%\usepackage{eforms}
+\usepackage{xbmks}
+
+% the xr-hyper package may also be used if you have
+% cross document links within the body of the doc
+%\externaldocument[d1-]{doc1}
+%\externaldocument[d2-]{doc2}
+
+\title{On merging bookmarks for several documents}
+\author{D. P. Story}
+
+% The \xbmksetup command is placed in only
+% one of the collection. It is written to xbmks.cfg
+% in input by the other files to obtain uniformity
+% of option choices.
+\xbmksetup{%
+ docbundle={master,doc1,doc2},
+ 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
+
+
+\section{Master Two}
+
+Some content goes here.
+
+\subsection{Master Two: subSec 1}
+
+Some content goes here.
+
+\newpage
+
+\subsection{Master Two: subSec 2}
+
+Some content goes here.
+
+
+\end{document}
+
diff --git a/macros/latex/contrib/xbmks/examples/stand-alone.tex b/macros/latex/contrib/xbmks/examples/stand-alone.tex
new file mode 100644
index 0000000000..9751e99c22
--- /dev/null
+++ b/macros/latex/contrib/xbmks/examples/stand-alone.tex
@@ -0,0 +1,55 @@
+\documentclass[12pt]{article}
+\usepackage{xcolor}
+\usepackage[bookmarksopen]{hyperref}
+\usepackage{xbmks}
+
+\title{Stand alone document}
+\author{D. P. Story}
+
+\xbmksetup{%
+% docbundle={\jobname},
+ colors={int=red,ext},
+ styles={intbf}
+}
+
+\begin{document}
+
+\maketitle
+
+\pdfbookmarkx[1]{http://blog.acrotex.net}[action={/S/URI/URI(http://blog.acrotex.net)},%
+ color=magenta,style={bf}]{blog}
+
+
+\section{Section One}
+
+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{styles} keys, as seen in the preamble.
+
+\subsection{Section One: subSec 1}
+
+Some content goes here.
+
+\newpage
+
+
+\section{Section Two}
+
+Some content goes here.
+
+
+\subsection{Section Two: subSec 1}
+
+Some content goes here.
+
+\newpage
+
+\subsection{Section Two: subSec 2}
+
+Some content goes here.
+
+
+\end{document}
+
diff --git a/macros/latex/contrib/xbmks/xbmks.dtx b/macros/latex/contrib/xbmks/xbmks.dtx
new file mode 100644
index 0000000000..b2ed3074c1
--- /dev/null
+++ b/macros/latex/contrib/xbmks/xbmks.dtx
@@ -0,0 +1,779 @@
+%\iffalse
+% makeindex -s gglo.ist -o xbmks.gls xbmks.glo
+% makeindex -s gind.ist -o xbmks.ind xbmks.idx
+%<*copyright>
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% 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. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%</copyright>
+%<package>\NeedsTeXFormat{LaTeX2e}[1997/12/01]
+%<package>\ProvidesPackage{xbmks}
+%<package> [2018/07/04 v2.0.2 xbmks: Cross-document bookmarks (dps)]
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{xcolor}
+\usepackage[colorlinks,hyperindex=false,bookmarksopen]{hyperref}
+\usepackage{fancyvrb,array,calc}
+\usepackage{xbmks}
+\xbmksetup{colors={int=red},styles={intbf}}
+%\pdfstringdefDisableCommands{\let\\\textbackslash}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\bgroup\ttfamily
+\gdef\brpr#1{\char123\relax#1\char125\relax}\egroup
+\let\darg\brpr
+\let\env\texttt
+\let\opt\texttt
+\let\pkg\textsf
+\let\app\textsf
+\def\visispace{\symbol{32}}
+%\def\hardspace{{\fontfamily{cmtt}\selectfont\symbol{32}}}
+\def\ameta#1{\ensuremath{\langle\textit{\texttt{#1}}\rangle}}
+\def\meta#1{\textsl{\texttt{#1}}}
+\def\SUB#1{\ensuremath{{}_{\mbox{\scriptsize\ttfamily#1}}}}
+\def\cs#1{\texttt{\bslash#1}}
+\DeclareRobustCommand{\tmspace}[3]{%
+ \ifmmode\mskip#1#2\else\kern#1#3\fi\relax}
+\renewcommand{\,}{\tmspace+\thinmuskip{.1667em}}
+\let\thinspace\,
+\renewcommand{\!}{\tmspace-\thinmuskip{.1667em}}
+\let\negthinspace\!
+\renewcommand{\:}{\tmspace+\medmuskip{.2222em}}
+\let\medspace\:
+\newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}}
+\renewcommand{\;}{\tmspace+\thickmuskip{.2777em}}
+\let\thickspace\;
+\newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}}
+\makeatletter
+\renewcommand{\paragraph}
+ {\@startsection{paragraph}{4}{0pt}{6pt}{-3pt}
+ {\normalfont\normalsize\bfseries}}
+\renewenvironment{quote}[1][]
+ {\def\@rgi{#1}\ifx\@rgi\@empty
+ \let\rghtm\@empty\else\def\rghtm{\rightmargin\leftmargin}\fi
+ \list{}{\rghtm} %{\rightmargin\leftmargin}%
+ \item\relax}
+ {\endlist}
+\makeatother
+\InputIfFileExists{aebdocfmt.def}{\PackageInfo{xbmks}{Inputting aebdocfmt.def}}
+ {\def\IndexOpt{\DescribeMacro}\def\IndexKey{\DescribeMacro}\let\setupFullwidth\relax
+ \PackageInfo{xbmks}{aebdocfmt.def cannot be found}}
+\begin{document}
+\def\CMD#1{\textbackslash#1}
+ \GetFileInfo{xbmks.sty}
+ \title{\textsf{xbmks}: Cross-document bookmarks}
+ \author{D. P. Story\\
+ Email: \texttt{dpstory@acrotex.net}}
+ \date{processed \today}
+ \maketitle
+ \tableofcontents
+ \let\Email\texttt
+ \DocInput{xbmks.dtx}
+\IfFileExists{\jobname.ind}{\newpage\setupFullwidth\par\PrintIndex}{\paragraph*{Index} The index goes here.\\Execute
+ \texttt{makeindex -s gind.ist -o xbmks.ind xbmks.idx}\\on the command line and recompile
+ \texttt{xbmks.dtx}.}
+\IfFileExists{\jobname.gls}{\PrintChanges}{\paragraph*{Change History} The list of changes goes here.\\Execute
+ \texttt{makeindex -s gglo.ist -o xbmks.gls xbmks.glo}\\on the command line and recompile
+ \texttt{xbmks.dtx}.}
+\end{document}
+%</driver>
+% \fi
+% \MakeShortVerb{|}
+%
+% \InputIfFileExists{aebdonotindex.def}{\PackageInfo{web}{Inputting aebdonotindex.def}}
+% {\PackageInfo{web}{cannot find aebdonotindex.def}}
+%
+% \begin{macrocode}
+% Begin package
+%<*package>
+\RequirePackage{xkeyval}
+\RequirePackage{ifpdf}[2006/02/20]
+\RequirePackage{ifxetex}[2006/08/21]
+% \end{macrocode}
+%
+%\section{Description}
+% More than a couple decades ago (counting back from 2018), I wrote two mathematics tutorials: \textsl{\href{http://www.math.uakron.edu/~dpstory/e-calculus.html}{eCalculus}} and
+% \textsl{\href{http://www.math.uakron.edu/~dpstory/mpt_home.html}{Algebra Review in Ten Lessons}}. The tutorials consisted of a number of lessons, each in a separate PDF.
+% The bookmarks of each lessons contained the table of contents for the whole tutorial. A student, in theory, could then
+% jump from one lesson to another by selecting an entry of interest from the bookmarks. In the intervening years I have not seen
+% a {\LaTeX} package for merging the table of contents of a set of PDFs and merge them in this each member of the
+% set. This package attempts to do just that.
+%
+% \section{Drivers and options}
+% We support the drivers \app{dvips} (and \app{dvipsone}), \app{pdflatex}, \app{lualatex}, and \app{xelatex}; these
+% options are then named \opt{dvipsone}, \opt{dvips}, \opt{pdftex}, \opt{luatex}, and \opt{xetex}.
+% \changes{v1.1}{2018/06/13}{Fixed misspelling of drive command for pdfmark case}
+% \begin{macrocode}
+\def\xbmk@driver{xbmks-pdfmark.def}
+\DeclareOptionX{dvipsone}{\def\xbmk@driver{xbmks-pdfmark.def}}
+\DeclareOptionX{dvips}{\def\xbmk@driver{xbmks-pdfmark.def}}
+\DeclareOptionX{pdftex}{\def\xbmk@driver{xbmks-pdftex.def}}
+\DeclareOptionX{luatex}{\def\xbmk@driver{xbmks-pdftex.def}}
+\DeclareOptionX{xetex}{\def\xbmk@driver{xbmks-xetex.def}}
+% \end{macrocode}
+% \section{Process the options}
+% \begin{macrocode}
+\ifpdf\ExecuteOptionsX{pdftex}\else
+\ifxetex\ExecuteOptionsX{xetex}\else
+ \let\ExecuteOptions@SAVE\ExecuteOptions
+ \let\ExecuteOptions\ExecuteOptionsX
+ \InputIfFileExists{web.cfg}{}
+ {\@ifundefined{l@tex@@@@driver}{\ExecuteOptionsX{dvips}}
+ {\ExecuteOptionsX{dvipsone}}}%
+ \let\ExecuteOptions\ExecuteOptions@SAVE
+\fi\fi
+\ProcessOptionsX
+% \end{macrocode}
+% \section{Requirements}
+% The minimal requirement is \pkg{hyperref} and its built-in bookmark system. It is important to note that
+% the \pkg{bookmark} package is not supported.
+% \begin{macrocode}
+\RequirePackage{hyperref}
+% \end{macrocode}
+% \begin{macro}{\xbmksetup}
+% Set the cross-document options:
+% \changes{v1.1}{2018/06/13}{Allow an empty value of docbundle, its value is set to \string\cs{jobname}}%
+%\begin{quote}\ttfamily\obeylines
+%\string\xbmksetup\darg{%
+%\qquad docbundle=\darg{\ameta{doc\SUB1},\ameta{doc\SUB2},...,\ameta{doc\SUB{n}}},
+%\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
+%of the documents you are calling the `main file'. It writes
+%the key-values to the file \texttt{xbmks.cfg} which is then read back in by the other
+%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}{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@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@extC\@empty
+\let\xbmks@Yes=y \let\xbmks@No=n
+% \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}{docbundle,#1}%
+% \end{macrocode}
+% \changes{v2.0.2}{2018/07/04}{Added an empty docbundle argument. This solves a problem
+% that the bookmarks not appearing after an even number of compiles.}
+% \begin{macrocode}
+ \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
+ in hopes this is your intention}%
+ \gdef\xbmk@cnt{1}%
+ \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
+ \immediate\write\xbmks@setup{\protect\xbmksetupi{#1}}%
+ \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\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}{\x@docbundle}
+% is a comma-delimited list of document base names:
+%\begin{quote}\ttfamily\obeylines
+%\string\x@docbundle\darg{\ameta{doc\SUB1},\ameta{doc\SUB2},...,\ameta{doc\SUB{n}}}
+%\end{quote}
+%This command is called internally by \cs{xbmksetupi}.
+% \begin{macrocode}
+\def\xbmkcsarg#1#2{\expandafter#1\csname#2\endcsname}
+\xdef\xbmk@cnt{0}
+\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\x{\noexpand\xbmk@recordDoc{\@arg}}\x
+ \edef\x{\noexpand\xbmk@docID{\@arg}}\x
+ }%
+ \xdef\xbmk@cnt{\the\count\z@}\egroup
+}
+\newcommand{\xbmk@recordDoc}[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}
+% \begin{macrocode}
+\def\x@outWarningMsg{\PackageWarningNoLine{xbmks}{%
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\MessageBreak
+@@ Outline files were not input, compile again @@\MessageBreak
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}}%
+% \end{macrocode}
+% These commands are implemented in the driver dependent sections.
+% \begin{macrocode}
+% End package
+%</package>
+%<*pdfmark>
+% \end{macrocode}
+% \section{Driver dependent code}
+% \subsection{The pdfmark driver}
+% We redefine/modify the \cs{ReadBookmarks} command of \pkg{hyperref},
+% this definition is driver dependent.
+% \begin{macrocode}
+\def\ReadBookmarks{%
+ \pdf@ifdraftmode{}{%
+ \begingroup\def\\{\@backslashchar\@backslashchar}% dps
+ \def\calc@bm@number##1{%
+ \@tempcnta=\check@bm@number{##1}\relax
+ \advance\@tempcnta by 1 %
+ \expandafter\edef\csname B_##1\endcsname{\the\@tempcnta}%
+ }%
+ \def\do##1{%
+ \ifnum\catcode`##1=\active
+ \@makeother##1%
+ \else
+ \ifnum\catcode`##1=6 %
+ \@makeother##1%
+ \fi
+ \fi
+ }%
+ \dospecials
+ \Hy@safe@activestrue
+ \escapechar=`\\%
+ \ifx\WriteBookmarks\relax
+ \global\let\WriteBookmarks\relax
+ \fi
+ \begingroup
+ \def\WriteBookmarks{0}%
+ \count\z@=0\relax
+ \edef\xbmk@J{\jobname}%
+ \@whilenum \count\z@<\xbmk@cnt\relax\do{%
+ \advance\count\z@ by 1 %
+ \edef\xbmk@thisdoc{xbmk@doc\the\count\z@}%
+ \edef\xbmk@filename{\@nameuse{\xbmk@thisdoc}}%
+ \@onelevel@sanitize\xbmk@filename
+ \bgroup
+ \def\@@BOOKMARK[##1][##2]##3##4##5{%
+ \calc@bm@number{##5}%
+ }%
+ \let\nextAction\@gobbletwo
+ \InputIfFileExists{\xbmk@filename.out}{}{\x@outWarningMsg}%
+ \def\@@BOOKMARK[##1][##2]##3##4##5{%
+ \def\Hy@temp{##4}%
+% \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={/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
+ \endgroup
+ \endgroup
+ }%
+ \ifx\WriteBookmarks\relax\else
+ \if@filesw
+ \newwrite\@outlinefile
+ \Hy@OutlineRerunCheck
+ \immediate\openout\@outlinefile=\jobname.out\relax
+ \ifHy@typexml
+ \immediate\write\@outlinefile{<relaxxml>\relax}%
+ \fi
+ \fi
+ \fi
+}
+%</pdfmark>
+% \end{macrocode}
+% \subsection{Code for pdftex/luatex driver}
+% We redefine/modify the \cs{ReadBookmarks} command of \pkg{hyperref},
+% this definition is driver dependent.
+% \begin{macrocode}
+%<*pdftex>
+\def\ReadBookmarks{%
+ \pdf@ifdraftmode{}{%
+ \begingroup\def\\{\@backslashchar\@backslashchar}% dps
+ \def\calc@bm@number##1{%
+ \@tempcnta=\check@bm@number{##1}\relax
+ \advance\@tempcnta by 1 %
+ \expandafter\edef\csname B_##1\endcsname{\the\@tempcnta}%
+ }%
+ \def\Hy@OutlineName##1##2##3##4{\def\@rgi{##1}%
+ \expandafter\pdfoutline\ifx\@rgi\@empty\else
+ attr {##1} \fi
+ user {##2} count##3{##4}%
+ % goto name{#2} count#3{#4}%
+ }%
+ \def\do##1{%
+ \ifnum\catcode`##1=\active
+ \@makeother##1%
+ \else
+ \ifnum\catcode`##1=6 %
+ \@makeother##1%
+ \fi
+ \fi
+ }%
+ \dospecials
+ \Hy@safe@activestrue
+ \escapechar=`\\%
+ \ifx\WriteBookmarks\relax
+ \global\let\WriteBookmarks\relax
+ \fi
+ \begingroup
+ \def\WriteBookmarks{0}%
+ \count\z@=0\relax
+ \edef\xbmk@J{\jobname}%
+ \@whilenum \count\z@<\xbmk@cnt\relax\do{%
+ \advance\count\z@ by 1 %
+ \edef\xbmk@thisdoc{xbmk@doc\the\count\z@}%
+ \edef\xbmk@filename{\@nameuse{\xbmk@thisdoc}}%
+ \@onelevel@sanitize\xbmk@filename
+ \bgroup
+ \gdef\@@BOOKMARK[##1][##2]##3##4##5{%
+ \calc@bm@number{##5}%
+ }%
+ \let\nextAction\@gobbletwo
+ \InputIfFileExists{\xbmk@filename.out}{}{\x@outWarningMsg}%
+ \gdef\@@BOOKMARK[##1][##2]##3##4##5{%
+ \def\Hy@temp{##4}%
+ \Hy@pstringdef\Hy@pstringName{\HyperDestNameFilter{##3}}%
+ \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
+% \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
+ \endgroup
+ }%
+ \ifx\WriteBookmarks\relax
+ \else
+ \if@filesw
+ \newwrite\@outlinefile
+ \Hy@OutlineRerunCheck
+ \immediate\openout\@outlinefile=\jobname.out\relax
+ \ifHy@typexml
+ \immediate\write\@outlinefile{<relaxxml>\relax}%
+ \fi
+ \fi
+ \fi
+}
+%</pdftex>
+%<*xetex>
+% \end{macrocode}
+% \subsection{Code for xetex driver}
+% We redefine/modify the \cs{ReadBookmarks} command of \pkg{hyperref},
+% this definition is driver dependent.
+% \begin{macrocode}
+\def\ReadBookmarks{%
+ \pdf@ifdraftmode{}{%
+ \begingroup\def\\{\@backslashchar\@backslashchar}% dps
+ \def\calc@bm@number##1{%
+ \@tempcnta=\check@bm@number{##1}\relax
+ \advance\@tempcnta by 1 %
+ \expandafter\edef\csname B_##1\endcsname{\the\@tempcnta}%
+ }%
+ \def\do##1{%
+ \ifnum\catcode`##1=\active
+ \@makeother##1%
+ \else
+ \ifnum\catcode`##1=6 %
+ \@makeother##1%
+ \fi
+ \fi
+ }%
+ \dospecials
+ \Hy@safe@activestrue
+ \escapechar=`\\%
+ \ifx\WriteBookmarks\relax
+ \global\let\WriteBookmarks\relax
+ \fi
+ \begingroup
+ \def\WriteBookmarks{0}%
+ \count\z@=0\relax
+ \edef\xbmk@J{\jobname}%
+ \@whilenum \count\z@<\xbmk@cnt\relax\do{%
+ \advance\count\z@ by 1 %
+ \edef\xbmk@thisdoc{xbmk@doc\the\count\z@}%
+ \edef\xbmk@filename{\@nameuse{\xbmk@thisdoc}}%
+ \@onelevel@sanitize\xbmk@filename
+ \bgroup
+ \def\@@BOOKMARK[##1][##2]##3##4##5{%
+ \calc@bm@number{##5}%
+ }%
+ \let\nextAction\@gobbletwo
+ \InputIfFileExists{\xbmk@filename.out}{}{\x@outWarningMsg}%
+ \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
+ ##1<<%
+ /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)%
+ >>%
+ \else
+ /A<<%
+ /S/GoToR/F(\xbmk@filename.pdf)%
+ /D(\Hy@pstringName)%
+ >>%
+ \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
+ \endgroup
+ \endgroup
+ }%
+ \ifx\WriteBookmarks\relax
+ \else
+ \if@filesw
+ \newwrite\@outlinefile
+ \Hy@OutlineRerunCheck
+ \immediate\openout\@outlinefile=\jobname.out\relax
+ \ifHy@typexml
+ \immediate\write\@outlinefile{<relaxxml>\relax}%
+ \fi
+ \fi
+ \fi
+}
+%</xetex>
+%<*package>
+\InputIfFileExists{xbmks.cfg}{}{}
+\@ifpackageloaded{bookmark}{\PackageWarningNoLine{xbmks}{The
+ bookmark package is not supported;\MessageBreak
+ this package does nothing, as a result}}
+{\InputIfFileExists{\xbmk@driver}{}{}}
+%</package>
+% \end{macrocode}
+% \Finale
diff --git a/macros/latex/contrib/xbmks/xbmks.ins b/macros/latex/contrib/xbmks/xbmks.ins
new file mode 100644
index 0000000000..8341ef98de
--- /dev/null
+++ b/macros/latex/contrib/xbmks/xbmks.ins
@@ -0,0 +1,61 @@
+%%
+%% This file will generate fast loadable files and documentation
+%% driver files from the doc files in this package when run through
+%% LaTeX or TeX.
+%%
+%% Copyright 2018 D. P. Story
+%% -------------------------------------------
+%%
+%% It may be distributed under the conditions of the LaTeX Project Public
+%% License, either version 1.2 of this license or (at your option) any
+%% later version. The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.2 or later is part of all distributions of LaTeX
+%% version 1999/12/01 or later.
+%%
+%% --------------- start of docstrip commands ------------------
+%%
+\def\filedate{2018/07/04}
+\def\batchfile{xbmks.ins}
+
+\input docstrip
+\ifx\generate\undefined
+ \Msg{**********************************************}
+ \Msg{*}
+ \Msg{* This installation requires docstrip}
+ \Msg{* version 2.4 or later.}
+ \Msg{*}
+ \Msg{* An older version of docstrip has been input}
+ \Msg{*}
+ \Msg{**********************************************}
+ \errhelp{Move or rename old docstrip.tex and get a newer one.}
+ \errmessage{Old docstrip in input path}
+ \batchmode
+ \csname @@end\endcsname\end
+\fi
+
+\keepsilent
+\askforoverwritefalse
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\preamble
+\endpreamble
+
+\generate
+{%
+ \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-xetex.def}{\from{xbmks.dtx}{copyright,xetex}}
+}
+
+\Msg{***************************************************************}
+\Msg{*}
+\Msg{* \space To finish the installation you have to copy the files }
+\Msg{*}
+\Msg{* \space *.sty, *.cfg and *.def into a directory searched by TeX}
+\Msg{*}
+\Msg{***************************************************************}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\endinput