[l2h] Adding a \popupref command that invokes Javascript popups?
Fox, C J
foxcj at essex.ac.uk
Thu Nov 4 23:19:36 CET 2004
[Resent message: apologies if this turns out to be a duplicate. ]
[My earlier message on this topic did not appear for some reason.]
I have a need for a cross-reference command of the form
\popupref{LABEL}{TEXT} that opens the contents labelled by
\label{LABEL} (internal or external) in a popup window by passing the
appropriate HTML reference for LABEL to a Javascript function when
TEXT is clicked. This is for some teaching material. Typically the
popups would be explanations, solutions to exercise etc, where it is
important for users to still see the original text.
I know how to use \HTMLcode{} to define a command \popup{URL}{TEXT}
that invokes a specified Javascript function with argument URL when
TEXT is clicked (and which falls back to a conventional HREF link if
Javascript is not available). The issue is how then to make a version
that uses internal and external LaTeX labels as targets.
I assume I can do this by adding a command "do_cmd_popupref" based on
"do_cmd_htmlref" in html.perl which then calls an appropriately hacked
version of "process_ref".
I have some questions:
1) Is that all I would need to do?
2) Is there a more elegant/generic way? (e.g. perhaps there is a
way of adding a LaTeX command that turns a LaTeX label into a
URL, which would mean this sort of thing could all be done with
HTMLcode?)
3) Has anyone already done something like this? (I could not find
any pre-existing solutions...)
I am assuming that the Javascript function accepts just a single
argument, and its name is defined by a Perl variable, although it
could be nice to have a more configurable command that can embed the
URL or LABEL target in an arbitrary, user-defined "function call".
Any help would be greatly appreciated,
Chris
--
Dr Chris Fox <foxcj at essex.ac.uk> Tel: +44 (0)1206 87 2576
Reader in Computer Science Fax: +44 (0)870 054 7770
University of Essex Web: FoxEarth.org/chris
Colchester CO4 3SQ, United Kingdom GnuPG: 488F6C2A/4FCBC9C6
More information about the latex2html
mailing list