%%
%% This is file `xcpdftips.drv',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xcpdftips.dtx (with options: `driver')
%% ============================================
%% This is the driver file to produce the LaTeX documentation
%% from the original source file xcpdftips.dtx.
%%
%% Make changes to it as needed. (Never change the file xcpdftips.dtx!)
%% ============================================
%% Copyright (c) 2019 Mikica Kocic
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{xcpdftips.drv}
\documentclass[a4paper]{ltxdoc}
%\documentclass[twoside]{ltxdoc}
%\documentclass[a4paper]{ltxdoc}
%\documentclass[twoside,a4paper]{ltxdoc}
\raggedbottom
%** To include the detailed explanation of the coding, comment out
%** the next line
%** To produce a command index: add the following line for one run,
%** then run makeindex -s gind.ist xcpdftips
%** and reprocess, with or without this line (much faster without)
% \EnableCrossrefs\CodelineIndex
%** To produce a change history: add the following line for one run,
%** then run makeindex -s gglo.ist -o xcpdftips.gls xcpdftips.glo
%** and reprocess, with or without this line (faster without)
% \RecordChanges
\DisableCrossrefs %May stay; zapped by \EnableCrossrefs
\CodelineNumbered %May stay
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\DocInput{xcpdftips.dtx}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newif\ifXCP@redefcite\XCP@redefcitefalse
\newif\ifXCP@useocg\XCP@useocgfalse
\newif\ifXCP@usetcolorbox\XCP@usetcolorboxfalse
\DeclareOption{redefcite}{\XCP@redefcitetrue}
\DeclareOption{ocg}{\XCP@useocgtrue}
\DeclareOption{tcolorbox}{\XCP@usetcolorboxtrue}
\ProcessOptions\relax
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifXCP@useocg
\ifXCP@usetcolorbox
\ifx\tcolorbox\undefined
\RequirePackage{tcolorbox}
\fi
\newcommand{\XCP@tooltipbox}[3]{%
\begin{tcolorbox}[colframe=#1, colback=#2,%
width=1.02\columnwidth, arc=2pt,%
boxsep=2pt, top=0ex, bottom=0ex, left=0.1em, right=0.1em%
]\normalfont\small #3\end{tcolorbox}%
}
\else
\newcommand{\XCP@tooltipbox}[3]{%
\fcolorbox{#1}{#2}%
{\parbox[t]{\columnwidth}{\normalfont\small #3}}%
}
\fi
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifXCP@useocg
\RequirePackage{pdfbase,ocgbase}
\RequirePackage{expl3}
\RequirePackage{calc,linegoal}
\RequirePackage{xcolor}
\ExplSyntaxOn
\msg_set:nnnn{xcpdftips}{support~outdated}{
Support~package~`#1'~too~old.
}{
Get~an~up~to~date~version~of~`#1'.\\Aborting.
}
\@ifpackagelater{pdfbase}{2018/04/06}{}{
\msg_error:nnn{xcpdftips}{support~outdated}{pdfbase.sty}
\tex_endinput:D
}
\@ifpackagelater{ocgbase}{2018/04/06}{}{
\msg_error:nnn{xcpdftips}{support~outdated}{ocgbase.sty}
\tex_endinput:D
}
\let\XCP@pdfLink\pbs_pdflink:nn % Alias for the pdflink from pdfbase
\ExplSyntaxOff
\ifx\Hy@setpdfborder\undefined\else
\let\Hy@setpdfborderOrig\Hy@setpdfborder
\def\Hy@setpdfborder{\ocgbase@insert@oc\Hy@setpdfborderOrig}%
\fi
\newsavebox{\XCP@tipText} % Temporary savebox
\newlength{\XCP@hOffset} \setlength\XCP@hOffset{-0.1em}
\newlength{\XCP@vOffset} \setlength\XCP@vOffset{0.2ex}
\newlength{\XCP@lineGoal}
\NewDocumentCommand{\XCP@ocgtooltip}{%
m % link text
O{yellow!5} % tooltip box color
m % tooltip text
}{{%
\leavevmode%
% Create a new PDF layer
\ocgbase@new@ocg{ref [\XCP@keys]}{%
/Print<> %
/Export<> %
/View<> %
}{invisible}%
\edef\XCP@currentOcg{\ocgbase@last@ocg}%
% Insert the PDF layer into the order hierarchy (shown in the 'Layers' tab)
\ocgbase@tree@node@begin%
\XCP@currentOcg%
\ocgbase@tree@node@end%
% Disable the simultaneous visibility of multiple tooltips
\ocgbase@add@ocg@to@radiobtn@grp{tool@tips}{\ocgbase@last@ocg}%
% Emit the using \pbs_pdflink:nn
\XCP@pdfLink{%
/Subtype/Link/Border[0 0 0]/A %
<> %
}{#1}%
% Create a savebox for the on the PDF layer
\sbox\XCP@tipText{%
\ocgbase@oc@bdc{\XCP@currentOcg}%
\ocgbase@open@stack@push{\XCP@currentOcg}%
\XCP@tooltipbox{black!50}{#2}{#3}%
\ocgbase@oc@emc%
\ocgbase@open@stack@pop%
\null%
}%
% Emit the savebox (at this point we have dimensions to calc the offset)
\raisebox{%
\heightof{#1} + \the\dp\XCP@tipText + \XCP@vOffset%
}[0pt][0pt]{%
\makebox[0pt][l]{\relax%
\setlength\XCP@lineGoal{\linegoal}%
\hspace{\dimexpr\XCP@lineGoal - \linewidth + \XCP@hOffset \relax}%
\usebox{\XCP@tipText}%
}%
}%
}}
\fi%XCP@useocg
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newsavebox{\XCP@keynum} % Temp box for getting citation numbers using \citenum
\ExplSyntaxOn
\NewDocumentCommand{ \XCP@enumeratetips }%
{ > { \SplitList , } m }%
{%
\global\undef\XCP@tips%
\global\undef\XCP@keys%
\tl_map_inline:nn {#1}%
{%
\ifx\XCP@tips\undefined%
\global\def\XCP@keys{}%
\sbox\XCP@keynum{\citenum{##1}}%
\expandafter\xdef\csname XCP@k@##1\endcsname{\NAT@num}%
\xappto{\XCP@keys}{\NAT@num}%
\global\def\XCP@tips{}%
\gappto{\XCP@tips}{[\textbf{\@nameuse{XCP@k@##1}}]\ %
{\@nameuse{BR@r@##1\@extra@b@citeb}}}%
\else%
\sbox\XCP@keynum{\citenum{##1}}%
\expandafter\xdef\csname XCP@k@##1\@extra@b@citeb\endcsname{\NAT@num}%
\xappto{\XCP@keys}{,\NAT@num}%
\gappto{\XCP@tips}{,\textCR[\textbf{\@nameuse{XCP@k@##1}}]\ %
{\@nameuse{BR@r@##1\@extra@b@citeb}}}%
\fi%
}%
}
\ExplSyntaxOff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\XCP@opt@author{{}}
\newcommand{\xcsetauthor}[1]{\gdef\XCP@opt@author{#1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\XCP@opt@markup{Underline}
\newcommand{\xcsetmarkup}[1]{\gdef\XCP@opt@markup{#1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\XCP@opt@color{1 1 0}
\newcommand{\xcsetcolor}[1]{\gdef\XCP@opt@color{#1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\XCP@opt@opacity{0}
\newcommand{\xcsetopacity}[1]{\gdef\XCP@opt@opacity{#1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\XCP@citetp{\@ifnextchar[{\XCP@@citetp}{\XCP@@citetp[]}}
\newcommand\XCP@@citetp{}
\def\XCP@@citetp[#1]{\@ifnextchar[{\XCP@citex[#1]}{\XCP@citex[][#1]}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\XCP@citex{}
\gdef\XCP@citex[#1][#2]#3%
{%{\protect\NoHyper%
\ifXCP@useocg%
\let\textCR\par%
\XCP@enumeratetips{#3}%
\XCP@ocgtooltip%
{{{\protect\NoHyper\XCP@oldcite[#1][#2]{#3}\protect\endNoHyper}}}%
{\XCP@tips}%
\else%
\XCP@enumeratetips{#3}%
\pdftooltip{\XCP@oldcite[#1][#2]{#3}}{\XCP@tips}%
\pdfmarkupcomment[%
author=\XCP@opt@author,%
markup=\XCP@opt@markup,%
color=\XCP@opt@color,%
opacity=\XCP@opt@opacity,%
]{\vphantom{.}}{\XCP@tips}%
\fi%
}%\protect\endNoHyper}}
\let\XCP@oldcite\citep % Save \citep (in the case if it becomes redefined)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\let\xpdfcite\XCP@citetp
\robustify{\xpdfcite}
\AtBeginDocument{\nobibliography*} % Necessary to get bibentries.
\ifXCP@redefcite % Override \cite
\let\cite\xpdfcite
\robustify{\cite} % Required for, e.g., captions
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% End of documentation driver file.
%%
%% End of file `xcpdftips.drv'.