I'm working on a piece of code that would allow me to make tooltips displaying contents of another cell (EquationNumbered style).

Tooltip["TEST!", Rasterize[Style[DisplayForm@((NotebookRead@
    Cells[CellTags -> {"tagName"}][[1]])[[1, 1]]), FontFamily -> "Times", FontSize -> 18], 
          Background -> None]]

This one works ok:


However it doesn't update if the referenced cell changes. Simply adding Dynamic @ doesn't seem to work. On the other hand removing Rasterization gives me a blank tooltip:


Edit: (for clarification) I don't generate the cell, I create it by hand, then by keyboard shortcut CMD+J I create a tag for the cell ex, "tagName". The real purpose of this is that I want to use this code to generate a preview of referenced equations and plots, of course those cells are usually not visible, somewhere deep in the notebook.

  • $\begingroup$ For completeness, please add the code creating the tagged cell. $\endgroup$
    – bbgodfrey
    Commented Apr 8, 2016 at 3:54
  • $\begingroup$ I would ask to explain in more details, what would you like to achieve. Where is the tagged cell in the notebook? Is it on the screen? Is it out of view? Where do you place the cursor when you want to see the cell content? In general the question may be of a high interest, but from the present text it is not clear. $\endgroup$ Commented Apr 8, 2016 at 7:52
  • $\begingroup$ Added more details $\endgroup$
    – Ranza
    Commented Apr 8, 2016 at 10:35

2 Answers 2


It seems that sometimes Cells and friends are not smart enough to be aware of the parent notebook, supplying the code with EvaluationNotebook gives something working for me:

   Dynamic @ Rasterize @ NotebookRead @ First @ Cells[
      EvaluationNotebook[], CellTags -> "TestTag"]

enter image description here

Is this what you are after?

  • $\begingroup$ Exactly! Thank you! Would it be possible to make it work without Rasterize though? $\endgroup$
    – Ranza
    Commented Apr 8, 2016 at 14:03
  • $\begingroup$ @Ranza Depending how much of styling you want to preserve, the quick fix is DisplayForm@NotebookRead... instead of Rasterize. $\endgroup$
    – Kuba
    Commented Apr 8, 2016 at 14:06
  • $\begingroup$ Looks like it works without rasterize as well (it fixed the empty tooltip problem)! thanks! $\endgroup$
    – Ranza
    Commented Apr 8, 2016 at 14:11

Just to give back to community, here's a little piece of code:

Item[KeyEvent["e", Modifiers -> {Control}], 
    FrontEndExecute @ Module[{nb, t},
        nb = InputNotebook[];
        SelectionMove[nb, All, Expression];
        t = NotebookRead[SelectedNotebook[]];

        NotebookWrite[nb, ButtonBox[RowBox[{"(", CounterBox["Section", t], ".", CounterBox["EquationNumbered", t], ")"}], BaseStyle -> {"Hyperlink",Larger}, ButtonData -> t, TooltipDelay -> 0.05, Tooltip -> Map[DynamicBox[(NotebookRead[First@Cells[EvaluationNotebook[], CellTags -> {#}]]), UpdateInterval -> Infinity] & , {t}]]];
    MenuEvaluator -> Automatic 

which gives you an option to create equation references in notebook with tooltip preview. To make it work, simply add it into KeyEventTranslations.tr. Then in mathematica notebook write 'yourCellTag' without the quotes and hit CTRL+E


Sometimes it seems to fail however (displays blank tooltip and I'm not sure why)


Your Answer

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

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