MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Dynamic referencing AND hyperlinking for numbered equations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34182] Re: [mg34127] Re: Dynamic referencing AND hyperlinking for numbered equations
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Wed, 8 May 2002 01:57:53 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On Sat, 4 May 2002 04:29:34 -0400 (EDT), Alexandre Costa wrote:
>Dear Mr. Abbot
>I am afraid I was not so much clear. Let me try to explain again my 
problem:
>For example,  I have the following set of Mathematica cells:
>
>Cell 1:
>Cell[BoxData["\[IndentingNewLine]"], "NumberedEquation"]
>Cell 2:
>Cell[BoxData["\[IndentingNewLine]"], "NumberedEquation",
> CellTags->"Eqtwo"]
>
>Cell 3:
>Cell[TextData[{
> "See (",
>
> CounterBox["NumberedEquation", "Eqtwo"],
> ")\n"
>}], "Text"]
>
>Cell 4:
>Cell[TextData[{
> "See ",
> ButtonBox["(0)",
>  ButtonData:>"Eqtwo",
>  ButtonStyle->"Hyperlink"],
> "\n"
>}], "Text"]
>
>My problem is shown on Cell 4. I got this cell when I try to hyperlink
>the dynamic referenced equation given in Cell 3. In doing so, I use the
>following steps:
>- selected the equation number (i.e the string "(2)" in the cell 3)
>- Used the commands Input/Create hyperlink- Cell with tag: Eqtwo
>Instead of having a hyperlinked number "(2)"  (what I really want), I got 
a
>hyperlinked "(0)".
>
>Hope now, you can tell me the solution,
>         With best wishes,
>             Alexandre Costa
>
>

Here's a way you could do it.  It's not the most elegant thing in the 
world (among other things, clicking on the hyperlink will have the odd 
effect of not highlighting the whole hyperlink, and the resulting 
underlying cell structure is ugly), but it works for me.

Evaluate the following, select the resulting cell, and choose 
File->Generate Palette from Selection:

CellPrint[
  Cell[BoxData[
      ButtonBox["Counter->Hyperlink", 
        ButtonFunction :> 
          KernelExecute[
            Module[{input = NotebookRead[InputNotebook[]], counter}, 
              counter = Switch[input,
                  _List, Cases[input, _CounterBox],
                  _CounterBox, {input},
                  _, {}];
              If[Length[counter] == 1, 
                NotebookWrite[InputNotebook[], TextData[ButtonBox[
                      RowBox[input],
                      ButtonData -> counter[[1, 2]],
                      ButtonStyle :> "Hyperlink"]]]];
              Null]],
        ButtonEvaluator -> Automatic, Active -> True]]]]

I agree, incidentally, that Create Hyperlink ought to preserve the counter 
inside of the hyperlink.  I'll make a note of it for future development.

Sincerely,

John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.




  • Prev by Date: Re: 3D contour through a point[2]
  • Next by Date: Re: Question:
  • Previous by thread: RE: Re: Dynamic referencing AND hyperlinking for numbered equations
  • Next by thread: Re: Mathematica EPS to Distiller PDF Font Problem Solved (?)