[Tex/LaTex] hyperlinked cross referencing in Lyx

lyxtables

I want to make cross-referencing of Figures and Tables in text. I want them to appear in text with hyperlink, just like Journals. I have labeled all Figures and Tables and inserted them as cross reference in text. But in PDF output, only figure or table number ‘1’ appears with hyperlink such as. What I want is ,the word Table or Figure to appear with the number and hyperlinked together such as ‘Figure 1’. Can anyone please suggest me how to do this in Lyx? Many thanks.

Best Answer

First make sure you use refstyle, go to Document->Document Settings->Document Class and check "Use refstyle...". Now lets add references that are clickable: go to Document->Settings->PDF Properties and check "Use Hyperref Support".

Now when adding a cross-reference select "Formatted reference" in the Format option at the bottom of the window.

Choosing the "formetted reference" will add the "figure" or "table" for each cross reference, and the hyperref settings will add a hyperlink to any '\ref'. The problem ? the hyperlinks are only on "1" and not "figure 1" entirely. to fix that we need to add the following to your preamble

\newref{fig}{refcmd={\hyperref[#1]{Figure \ref{#1}}}}
\newref{tab}{refcmd={\hyperref[#1]{Table \ref{#1}}}}
\newref{eq}{refcmd={\hyperref[#1]{Eq. (\ref{#1})}}}

Of course you can change "Figure" to "Fig" or "Drawing" or anything you like