%%
%% This is file `xcpdftips.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xcpdftips.dtx (with options: `package')
%%
%% =============================================
%% IMPORTANT NOTICE:
%%
%% This program is free software: you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation, either version 3 of the License, or
%% (at your option) any later version.
%%
%% This program is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with this program. If not, see .
%%
%% This is a generated file.
%% It may not be distributed without the original source file xcpdftips.dtx.
%%
%% Full documentation can be obtained by LaTeXing that original file.
%% Only a few abbreviated comments remain here to describe the usage.
%% =============================================
%%
%% Copyright (c) 2019 Mikica Kocic
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{xcpdftips}
[2019/03/18 xcpdftips.sty v1.1 - (c) 2019 Mikica Kocic]
\RequirePackage{bibentry}
\RequirePackage{pdfcomment}
\RequirePackage{xparse}
\RequirePackage{etoolbox}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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 generated file <<<<<<
%%
%%
%% End of file `xcpdftips.sty'.