Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting tooltips in a pdf file from latex

532 views
Skip to first unread message

Edward M. Reingold

unread,
Apr 19, 2010, 4:48:07 PM4/19/10
to
I am starting this string again in hopes of cutting the clutter and making
clear what help I need.

I use latex -> dvips -> ps2pdf to produce pdf files.

I need (in the pdf file) to get tooltips of simple text (no links,
mathematics, drawings, etc) attached to both simple text and to items in a
PSTricks picture. The following desctibes the effect that I wnat to achieve:

\documentclass{article}
\usepackage{pst-all}

\begin{document}

\centerline{Title} % Tooltip on this word should say ``Word''
\begin{pspicture}(0,0)(5,5)
\psgrid
\psframe*[linecolor=green](1,1) % Tooltip in this rectangle should say
% ``Green''
\psframe*[linecolor=red](4,4)(5,5) % Tooltip in this rectangle should say
% ``Red''
\pscircle*[linecolor=blue](1,4){1} % Tooltip in this circle should say
% ``Blue''
\psline[linewidth=3pt](0,2)(4,3) % Tooltip on this line should say ``Black''
\end{pspicture}

\end{document}

How do I accomplish this?

--

Professor Edward M. Reingold Email: rein...@iit.edu
Department of Computer Science Voice: (312) 567-3309
Illinois Institute of Technology Fax: (312) 567-5067
Stuart Building, 228F
10 West 31st Street
Chicago, IL 60616-3729 U.S.A.

Herbert Voss

unread,
Apr 19, 2010, 5:34:21 PM4/19/10
to
Am 19.04.2010 22:48, schrieb Edward M. Reingold:

> I use latex -> dvips -> ps2pdf to produce pdf files.
>
> I need (in the pdf file) to get tooltips of simple text (no links,
> mathematics, drawings, etc) attached to both simple text and to items in a
> PSTricks picture. The following desctibes the effect that I wnat to achieve:

\documentclass{article}
\usepackage{pstricks-add}
\usepackage{hyperref}
\newcounter{tooltip}
\newcommand\tooltip[2]{%
% arg #1: text to put on the page
% arg #2: tooltip text
\pdfmark[#1]{
pdfmark=/ANN,
Subtype=/Widget,
Raw={
/TU (#2)/T (tooltip \thetooltip)
/FT/Btn/Ff 65536/H/N
}
}%
\stepcounter{tooltip}%
}
\def\myF{\phantom{\rule{1cm}{1cm}}}

\begin{document}
\begin{center}
\begin{pspicture}(-4,-4)(4,4)
\psaxes(0,0)(-4,-4)(4,4)
\rput[c](0,0){\tooltip{\myF}{Origin}}
\rput[c](4,4){\tooltip{\myF}{top right}}
\rput[c](-4,-4){\tooltip{\myF}{bottom left}}
\end{pspicture}
\end{center}

\end{document}

Herbert

zugzwang

unread,
Apr 19, 2010, 6:34:49 PM4/19/10
to

I didn't know tooltips were possible, so I used (latex.exe, dvips.exe,
ps2pdf.exe) to (cleanly) compile. Mouse-hovering at [4,4], [0,0], and
[-4,-4], I saw no tooltip. Considering that my distro is a couple of
years old, I downloaded the latest pdf-docs for pstricks-add and
hyperref, but found no mention of tooltip. Hyperref's manual.pdf
contains the pdfmark string but no mention of the \pdfmark command.

Googling on \pdfmark, I found pdfmarkReference.pdf, which suggests
that \pdfmark is "processed" by the pdf viewer. I tried both Adobe
Viewer 7.0 and SumatraPDF beta v0.9.3; no joy. Is the problem my PDF-
viewer, compile executables, or old packages?

Alan Munn

unread,
Apr 19, 2010, 9:29:04 PM4/19/10
to
In article <85aaszt...@emr.cs.iit.edu>,

rein...@emr.cs.iit.edu (Edward M. Reingold) wrote:

> I am starting this string again in hopes of cutting the clutter and making
> clear what help I need.
>
> I use latex -> dvips -> ps2pdf to produce pdf files.
>
> I need (in the pdf file) to get tooltips of simple text (no links,
> mathematics, drawings, etc) attached to both simple text and to items in a
> PSTricks picture. The following desctibes the effect that I wnat to achieve:
>
> \documentclass{article}
> \usepackage{pst-all}
>
> \begin{document}
>
> \centerline{Title} % Tooltip on this word should say ``Word''
> \begin{pspicture}(0,0)(5,5)
> \psgrid
> \psframe*[linecolor=green](1,1) % Tooltip in this rectangle should say
> % ``Green''
> \psframe*[linecolor=red](4,4)(5,5) % Tooltip in this rectangle should say
> % ``Red''
> \pscircle*[linecolor=blue](1,4){1} % Tooltip in this circle should say
> % ``Blue''
> \psline[linewidth=3pt](0,2)(4,3) % Tooltip on this line should say ``Black''
> \end{pspicture}
>
> \end{document}
>
> How do I accomplish this?

(I posted this in your other thread too, but I'll post it here too.)

Perhaps it would be easier to make the diagram in TikZ, which then can
use the cooltooltips, which depend on pdflatex.

(I don't know if the diagram above was just super simple one or
not.) But most things you can do in pstricks you can also do in TikZ,
and if the cooltooltips is so necessary, it would probably be worth the
effort to try. Here's a version of what I think you want, Ed.

\documentclass{article}
\usepackage{tikz}
\usepackage{cooltooltips}
\begin{document}
\usetikzlibrary{decorations.text}
\begin{tikzpicture}
\setlength{\fboxrule}{0pt}
\setlength{\fboxsep}{0pt}
\draw[step=.2cm,gray] (0,0) grid (5,5);
\draw[step=1cm,very thick] (0,0) grid (5,5);
\draw (.5,.5) node (O) {{\cooltooltip [0 0 0] {Origin} {This is the
origin of the graph.} {}{} {\color{green}\rule{1cm}{1cm}}{}}} (1,1);
\draw (4.5,4.5) node (R) {{\cooltooltip [0 0 0] {Corner} {This is the
top right corner of the graph.} {}{} {\color{red}\rule{1cm}{1cm}}{}}}
(5,5);
\draw (1,4) node (L) {{\cooltooltip [0 .2 1] {Corner} {This is the top
left corner of the graph.} {}{} {\rule{1.3cm}{1.3cm}}{}}} (1,5);
\draw[fill,blue] (1,4) circle (1);
\draw[line width=3pt] (0,2) -- (4,3);
\foreach \x in {0,.1,...,4} {
\node at (\x,2+\x*.25) {{\cooltooltip [0 0 0] {Line} {This is a
line.} {}{} {\rule{2pt}{2pt}}{}}};}
\foreach \x in {0,1,...,5} {
\node[left=3pt] at (0,\x) {\sffamily\bfseries\x};
\node[below=3pt] at (\x,0) {\sffamily\bfseries\x};}
\end{tikzpicture}

\end{document}


Alan

Edward M. Reingold

unread,
Apr 19, 2010, 10:37:35 PM4/19/10
to
>>>>> "AM" == Alan Munn <am...@msu.edu> writes:

AM> In article <85aaszt...@emr.cs.iit.edu>,
AM> rein...@emr.cs.iit.edu (Edward M. Reingold) wrote:

AM> (I don't know if the diagram above was just super simple one or not.)
AM> But most things you can do in pstricks you can also do in TikZ, and if
AM> the cooltooltips is so necessary, it would probably be worth the
AM> effort to try. Here's a version of what I think you want, Ed.

What I really have is extremely complex and is heavily reliant on PSTricks
tools. The example that Herbert gave is perfect (thanks!). I would like to
give the tooltip window/text a color and simply adding, say, \red before the
text didn't work--how do I do that? I am happy to define the color as RGB, if
that makes it easier).

Josef Kleber

unread,
Apr 20, 2010, 4:33:51 AM4/20/10
to
Am 20.04.2010 00:34, schrieb zugzwang:
> I didn't know tooltips were possible, so I used (latex.exe, dvips.exe,
> ps2pdf.exe) to (cleanly) compile. Mouse-hovering at [4,4], [0,0], and
> [-4,-4], I saw no tooltip. Considering that my distro is a couple of
> years old, I downloaded the latest pdf-docs for pstricks-add and
> hyperref, but found no mention of tooltip.

Well the tooltip command is defined in the document preamble. Why do you
expect it to be documented in pstricks-add od hyperref? ;-)

>Hyperref's manual.pdf
> contains the pdfmark string but no mention of the \pdfmark command.

hyperref's pdfmark inserts a special, which dvips is converting to the
postscript command pdfmark. ps2pdf transforms that to the specific PDF
commands, which are interpreted by at least some pdf viewers.

> Googling on \pdfmark, I found pdfmarkReference.pdf, which suggests
> that \pdfmark is "processed" by the pdf viewer. I tried both Adobe
> Viewer 7.0 and SumatraPDF beta v0.9.3; no joy. Is the problem my PDF-
> viewer, compile executables, or old packages?

No problem here with AR 9.3.2! Most so called PDF viewers don't care
about annotations, especially when based on poppler. They only
implemented their own flavour of "PDF", but not the complete PDF
standard defined in the PDF Reference.

Josef


--
Keine Sicherheit ohne Schäuble:
GNUPG/PGP-Key unter http://www.josef-kleber.de/pgp/Josef_Kleber_News.asc
DSA 1024 / 0xF4B1EA2A / F832 6058 319E FFD4 0EFF 088C 521B 40D4 F4B1 EA2A

zugzwang

unread,
Apr 20, 2010, 8:01:59 AM4/20/10
to
> ...

>
> No problem here with AR 9.3.2! Most so called PDF viewers don't care
> about annotations, especially when based on poppler. They only
> implemented their own flavour of "PDF", but not the complete PDF
> standard defined in the PDF Reference.

Interesting, apparently I hovered carelessly. Retrying the pdf
generated from Herbert Voss' (PSTtricks) sample, the tooltips do show
in Adobe Viewer 7.0 but not in SumatraPDF beta v0.9.3.

zugzwang

unread,
Apr 20, 2010, 8:16:10 AM4/20/10
to
> Well the tooltip command is defined in the document preamble. Why do you
> expect it to be documented in pstricks-add od hyperref? ;-)
>

I was debugging blindly, thinking that perhaps my packages were too
old. It seemed reasonable to scan the latest pdf-docs of any packages
in the preamble of Herbert's sample for the tooltip and pdfmark
strings.

> No problem here with AR 9.3.2!

Recreating my initial AR 7.0 error, I first zoomed. In AR 7.0, this
disables tooltips. The tooltips may then be re-enabled via menu-Tools-
Basic-Hand Tool.

Josef Kleber

unread,
Apr 20, 2010, 9:22:24 AM4/20/10
to
^^^^^^^^^^^^
based on poppler, so no chance! :-(

Josef Kleber

unread,
Apr 20, 2010, 9:24:49 AM4/20/10
to

No problem with zooming and AR 9.3.2. But i remeber that i once had to
zoom with an old version of PDF X-change viewer to see the annotations.

Edward M. Reingold

unread,
Apr 20, 2010, 10:16:07 AM4/20/10
to
>>>>> "HV" == Herbert Voss <Herber...@FU-Berlin.de> writes:

HV> \documentclass{article} \usepackage{pstricks-add}
HV> \usepackage{hyperref} \newcounter{tooltip} \newcommand\tooltip[2]{% %
HV> arg #1: text to put on the page % arg #2: tooltip text \pdfmark[#1]{
HV> pdfmark=/ANN, Subtype=/Widget, Raw={ /TU (#2)/T (tooltip \thetooltip)
HV> /FT/Btn/Ff 65536/H/N } }% \stepcounter{tooltip}% }
HV> \def\myF{\phantom{\rule{1cm}{1cm}}}

HV> \begin{document} \begin{center} \begin{pspicture}(-4,-4)(4,4)
HV> \psaxes(0,0)(-4,-4)(4,4) \rput[c](0,0){\tooltip{\myF}{Origin}}
HV> \rput[c](4,4){\tooltip{\myF}{top right}}
HV> \rput[c](-4,-4){\tooltip{\myF}{bottom left}} \end{pspicture}
HV> \end{center}

That example is just what I need; success! Thanks to Herbert and all who
helped me.

0 new messages