I want to include a Hyperlink inside of a usage. For example:

function::usage = "function[x] does a complicated calculation
  following the algorithms in this paper."

where "this paper" is hyperlinked to a paper on the web.

To get an idea for how the boxes works for Hyperlinks, I did:

Hyperlink["here", "paclet:ref/Plot"] // ToBoxes

TagBox[ButtonBox[PaneSelectorBox[{False->"here", True->StyleBox["here", {HyperlinkActive}]}, False, BaseStyle->{Hyperlink}, FrameMargins->0, ImageSize->Automatic], BaseStyle->Link, ButtonData->paclet:ref/Plot, ButtonNote->paclet:ref/Plot], #1&]

That was a lot of boxes to put into the usage string:

function::usage = "function[x] does a complicated calculation
  following the algorithms in 

I got overwhelmed with all the \(\* \)'s so I gave up.

Is there a better way to include hyperlinks inside of usage?


I usually do it this way:

f::usage =
                      Style["f[ _Integer ]", Bold], " maps ", 
                      Style[Hyperlink["integer", "paclet:ref/Integer"], Italic], 
                      " to real number."
                     }], StandardForm];


formated usage text

  • $\begingroup$ Haven't seen you for some days!:-) $\endgroup$ – xyz Nov 12 '14 at 13:28
  • $\begingroup$ @ShutaoTang Am kind of busy recently :) $\endgroup$ – Silvia Nov 13 '14 at 8:33

Just evaluate your hyperlink code:

Mathematica graphics

then copy the hyperlink from the output and paste it in your string

Mathematica graphics

The boxes were worked into your string automatically:

Mathematica graphics


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.