summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cooltooltips/cooltooltips.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/cooltooltips/cooltooltips.dtx')
-rw-r--r--macros/latex/contrib/cooltooltips/cooltooltips.dtx124
1 files changed, 68 insertions, 56 deletions
diff --git a/macros/latex/contrib/cooltooltips/cooltooltips.dtx b/macros/latex/contrib/cooltooltips/cooltooltips.dtx
index 7f3304d813..dcfd2a4d0d 100644
--- a/macros/latex/contrib/cooltooltips/cooltooltips.dtx
+++ b/macros/latex/contrib/cooltooltips/cooltooltips.dtx
@@ -1,17 +1,17 @@
% \iffalse meta-comment
%
-% Copyright (C) 2006 by Scott Pakin <scott+ctip@pakin.org>
-% --------------------------------------------------------
+% Copyright (C) 2006-2021 by Scott Pakin <scott+ctip@pakin.org>
+% -------------------------------------------------------------
%
% This file may be distributed and/or modified under the
-% conditions of the LaTeX Project Public License, either version 1.3b
+% conditions of the LaTeX Project Public License, either version 1.3c
% 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.3b or later is part of all distributions of LaTeX
-% version 2006/01/07 or later.
+% and version 1.3c or later is part of all distributions of LaTeX
+% version 2008/05/04 or later.
%
% \fi
%
@@ -22,7 +22,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[2001/06/01]
%<package>\ProvidesPackage{cooltooltips}
%<*package>
- [2006/03/07 v1.0 Cool PDF tooltips]
+ [2021/08/08 v1.1 Cool PDF tooltips]
%</package>
%
%<*driver>
@@ -37,13 +37,13 @@
\begin{document}
\sloppy
\DocInput{cooltooltips.dtx}
-% \PrintChanges
+ \PrintChanges
\PrintIndex
\end{document}
%</driver>
% \fi
%
-% \CheckSum{204}
+% \CheckSum{216}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -63,31 +63,19 @@
%
%
% \changes{v1.0}{2006/03/07}{Initial version}
+% \changes{v1.1}{2021/08/08}{Enable support for Lua\string\LaTeX}
%
% \GetFileInfo{cooltooltips.dtx}
%
-% \DoNotIndex{\@ifundefined,\@tempboxa,\@tempcnta,\@tempcntb}
-% \DoNotIndex{\@tempdima,\@tempdimb,\@tempdimc,\\}
-% \DoNotIndex{\active,\addtolength,\advance}
-% \DoNotIndex{\begingroup,\bgroup}
-% \DoNotIndex{\catcode,\csname}
-% \DoNotIndex{\DeclareRobustCommand,\def,\dp}
-% \DoNotIndex{\edef,\egroup,\else,\endcsname,\endgroup,\expandafter}
-% \DoNotIndex{\fi}
-% \DoNotIndex{\gdef}
-% \DoNotIndex{\hbox,\hspace,\ht}
-% \DoNotIndex{\ifnum,\ifpdf,\immediate}
-% \DoNotIndex{\let}
-% \DoNotIndex{\makebox,\mbox,\MessageBreak}
-% \DoNotIndex{\newcommand,\noexpand}
-% \DoNotIndex{\paperwidth,\pdflastannot,\pdflastobj,\pdflastxform}
-% \DoNotIndex{\renewcommand}
-% \DoNotIndex{\savebox,\setbox,\setcounter,\setlength,\space}
-% \DoNotIndex{\stepcounter,\strip@pt}
-% \DoNotIndex{\the,\thepage}
-% \DoNotIndex{\usebox}
-% \DoNotIndex{\wd}
-% \DoNotIndex{\xdef}
+% \DoNotIndex{\@ifundefined,\@tempboxa,\@tempcnta,\@tempcntb,\@tempdima}
+% \DoNotIndex{\@tempdimb,\@tempdimc,\DeclareRobustCommand,\MessageBreak,\\}
+% \DoNotIndex{\active,\addtolength,\advance,\begingroup,\bgroup,\catcode}
+% \DoNotIndex{\csname,\def,\dp,\edef,\egroup,\else,\endcsname,\endgroup}
+% \DoNotIndex{\expandafter,\fi,\gdef,\hbox,\hspace,\ht,\ifnum,\immediate}
+% \DoNotIndex{\let,\makebox,\mbox,\newcommand,\noexpand,\paperwidth}
+% \DoNotIndex{\pdflastannot,\pdflastobj,\pdflastxform,\renewcommand}
+% \DoNotIndex{\savebox,\setbox,\setcounter,\setlength,\space,\stepcounter}
+% \DoNotIndex{\strip@pt,\the,\thepage,\usebox,\wd,\xdef}
%
% ^^A Define the document's metadata.
% \title{The \cool\ package\thanks{This document
@@ -142,11 +130,11 @@
% up a brief tooltip when the mouse moves over them and also open a
% small window containing additional text. \cool\ works only with
% pdf\LaTeX\@. Furthermore, the tooltips that \cool\ produces are much
-% less cool when viewed under older versions of Acrobat~($<7.0$) or the
-% current version of xpdf~(3.00) because they don't pop up the extra,
-% small window. \cooltooltip[0 0 1]{Example}{This is an example of a
-% cool tooltip. Pretty cool, eh?}{http://www.ctan.org/}{Visit CTAN on
-% the Web}{This text\strut} is an example of a cool tooltip (assuming
+% less cool when viewed under older versions of Acrobat~($<7.0$) or most
+% other \acro{pdf} readers because they don't pop up the extra, small
+% window. \cooltooltip[0 0 1]{Example}{This is an example of a cool
+% tooltip. Pretty cool, eh?}{http://www.ctan.org/}{Visit CTAN on the
+% Web}{This text\strut} is an example of a cool tooltip (assuming
% you're viewing this document with a sufficiently capable \acro{pdf}
% reader). Move your mouse pointer over it and watch what happens.
% Then, click on the link. If your \acro{pdf} reader is properly
@@ -156,8 +144,8 @@
% If the \cool\ popup mechanism causes problems with your browser you
% can \cooltooltiptoggle{\fcolorbox{blue}{white}{click here}} to disable
% popups. (Click again to re-enable them.) Regardless of whether
-% popups are enabled the tooltip and hyperlink mechanisms continue to
-% function.
+% popups are enabled the tooltip and hyperlink mechanisms should continue
+% to function.
%
% The cool tooltip shown above was created with the following code:
%
@@ -272,17 +260,17 @@
% \label{sec:license}
%
% \begin{center}
-% Copyright \textcopyright{} 2006
+% Copyright \textcopyright{} 2006--2021
% by Scott Pakin \texttt{<scott+ctip@pakin.org>}
% \end{center}
%
% \noindent
% This file may be distributed and/or modified under the conditions of
-% the \LaTeX{} Project Public License, either version~1.3b of this
+% the \LaTeX{} Project Public License, either version~1.3c of this
% license or (at your option) any later version. The latest version of
% this license is in \url{http://www.latex-project.org/lppl.txt} and
-% version~1.3b or later is part of all distributions of \LaTeX{} version
-% 2006/01/07 or later.
+% version~1.3c or later is part of all distributions of \LaTeX{} version
+% 2008/05/04 or later.
% }
%
% \section{Implementation}
@@ -314,12 +302,37 @@
%
% \bigskip
%
-% Because \cool\ works only with pdf\LaTeX\ and only in \acro{pdf} mode,
-% we load the \textsf{ifpdf} package up front to simplify testing for
-% that case.
+% Because \cool\ works only with pdf\LaTeX---or Lua\LaTeX\ with the
+% \pkgname{luatex85} compatibility package---and only in \acro{pdf}
+% mode, we load the \textsf{iftex} package up front to simplify testing
+% for the execution environment.
% \begin{macrocode}
-\RequirePackage{ifpdf}
+\RequirePackage{iftex}
+\ifluatex
+ \RequirePackage{luatex85}
+\fi
+% \end{macrocode}
+%
+% \begin{macro}{\ifcoolpdf}
+% \begin{macro}{\coolpdftrue}
+% \begin{macro}{\coolpdffalse}
+% We define a new test, |\ifcoolpdf|, which is true only when \TeX\ is
+% in \acro{pdf} mode and only when pdf\LaTeX\ or Lua\LaTeX~+
+% \pkgname{luatex85} is being used to build the document.
+% \begin{macrocode}
+\newif\ifcoolpdf
+\ifpdf
+ \ifluatex
+ \coolpdftrue
+ \fi
+ \ifpdftex
+ \coolpdftrue
+ \fi
+\fi
% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
%
% \subsection{\pdfterm{AcroForm} construction}
@@ -339,7 +352,7 @@
% At the end of the document we need to export the final value of
% |\ctip@form@fields| as an \pdfterm{AcroForm}.
% \begin{macrocode}
-\ifpdf
+\ifcoolpdf
\AtEndDocument{%
\immediate\pdfobj {
<<
@@ -364,7 +377,7 @@
% Define an empty \pdfterm{XForm} object to use as an invisible icon for
% the \pdfterm{Text} annotation.
% \begin{macrocode}
-\ifpdf
+\ifcoolpdf
\setbox\@tempboxa=\hbox{}
\immediate\pdfxform\@tempboxa
\edef\ctip@empty@icon{\the\pdflastxform}
@@ -438,10 +451,10 @@
%
% \begin{macro}{\ctip@update@pagenum}
% We can't reliably use |\thepage| to get the current page number
-% (cf.~\url{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=wrongpn}).
-% Hence, we exploit the |\label|\slash|\pageref| mechanism to get an
-% accurate page number. |\ctip@update@pagenum| creates a label (based
-% on Section~\ref{sec:text}'s |\ctip@tip@number|) then sets
+% (cf.~\url{https://texfaq.org/FAQ-wrongpn}). Hence, we exploit the
+% |\label|\slash|\pageref| mechanism to get an accurate page number.
+% |\ctip@update@pagenum| creates a label (based on
+% Section~\ref{sec:text}'s |\ctip@tip@number|) then sets
% |\ctip@current@page| to the page on which the label occurs.
% \begin{macrocode}
\newcommand*{\ctip@update@pagenum}{%
@@ -827,14 +840,13 @@
% \subsection{Sanity checks}
% \label{sec:sanity-checks}
%
-% Complain---but attempt to continue---if we're not running pdf\LaTeX\
-% in \acro{pdf} mode.
+% Complain---but attempt to continue---if we're not running
+% pdf\LaTeX\ or Lua\LaTeX\ in \acro{pdf} mode.
% \begin{macrocode}
-\RequirePackage{ifpdf}
-\ifpdf
+\ifcoolpdf
\else
\PackageWarning{cooltooltips}{%
- Not running pdfLaTeX in PDF mode; disabling cooltooltips%
+ Not running pdfLaTeX or LuaLaTeX in PDF mode; disabling cooltooltips%
}
\renewcommand*{\ctip@cooltooltip@i}[6][]{\mbox{#6}}
\fi