9
$\begingroup$

Using “Create Hyperlink” dialog window I can create a link to a tagged cell in my notebook (it's “Destination notebook: Current notebook” radio button).

Now, I can't figure it out how to create such links with Hyperlink[] command.

I tried

Hyperlink["label", {"", "tag"}]
Hyperlink["label", {None, "tag"}]
Hyperlink["label", {Automatic, "tag"}]

etc., but nothing works.

$\endgroup$
1
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2)Read the FAQs! 3) When you see good Q&A, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign` $\endgroup$ Nov 5, 2012 at 11:08

1 Answer 1

14
$\begingroup$

You have to use EvaluationNotebook[] to point to the actual notebook you are working in (you don't even have to save it). First, create a cell with a tag:

CellPrint@Cell["Target cell", "Text", CellTags -> {"target"}]

and then create the link that points to the target cell:

Hyperlink["link", {EvaluationNotebook[], "target"}]

Clicking the link will select the cell with tag "target".

$\endgroup$
4
  • $\begingroup$ Thanks for your answer! Sorry for such a late thanks. $\endgroup$
    – Alekh
    Dec 26, 2012 at 18:36
  • $\begingroup$ Just one remark. With {EvaluationNotebook[], ...} I get a {NotebookObject[FrontEndObject[LinkObject[...]], 12], target} in the status line when hovering over the "link", while it’s just "target" with the “Create Hyperlink” dialog. $\endgroup$
    – Alekh
    Dec 26, 2012 at 18:43
  • 1
    $\begingroup$ @Alekh I guess you have to live with that, as I don't think there is any way to format the status notification of Hyperlink. Unfortunately, a StatusArea wrapper does not overwrite it. Perhaps it is possible to create a customizable hyperlink using lower level interface elements. $\endgroup$ Dec 26, 2012 at 21:11
  • 1
    $\begingroup$ An extension: As noted in How to create permanent intra-notebook links, EvaluationNotebook[] may be replaced by another destination notebook (which I would have thought was obvious, but, hey, a new system can really undermine one's confidence until you get a good feel for how it works). $\endgroup$
    – Michael E2
    Jun 24, 2016 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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