I finally got fancy-preview working, and I found the place (around line 97) in the script to add to the list of environments which it catches (to add propositions and so on). But what I can't find after a quick read-through is a way to have fancy-preview pick up \autoref, \cref, and other \ref-like commands. Does anybody know how to do this? (I don't know perl or low-level latex, so I could have easily missed something obvious.)

I much prefer using \autoref to \ref. After spending way too much time setting up fancy-preview, it would be pretty disappointing to have to give up \autoref to use it.

EDIT: After looking into this a bit further, I don't think this is controlled in the fancy-preview script. I think it's in the actual fancytooltips.dtx, around line 756. I don't yet know how to adjust this code to also redefine \autoref, but I think I'm at least looking in the right place.


The following code works for me. Save as file.tex and compile by fancy-preview file


  • In fancytooltips.sty the original command \ref is saved into \fancy@oldref and replaced by a command which acts like \ref and adds the tooltip.
  • Similarly, we store the comand \autoref to \oldautoref and replace it by a command which acts like old \autoref, ant then acts like \ref but the referrence is not printed (\fancy@oldref is temporarily redefined) and only the tooltip remains.




Consider equation
  x^2+y^2=\frac 1\pi

    \draw[red,fill=blue] (0,0) circle (2cm);
  \caption{Caption of the figure}

This if the second section. It follows Section \ref{sec:1}. See also
\autoref{equation} and \autoref{figure}, i.e. eq. \eqref{equation} and
Picture \ref{figure}.

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.