I would like to use the \autoref
function in LyX, so that when I refer to a labeled figure or theorem, it is typeset as "Figure #" or "Theorem #". According to this answer, I can redefine the \ref
command as \autoref
using
\let\ref\autoref
at the beginning of the document. However, this creates a problem: when I refer to an equation, it comes out as "(Equation #)". This is because LyX does not use \eqref{eq_label}
, but rather (\ref{eq_label})
to refer to equations.
So my question is: Is there a way to configure LyX so that it uses \eqref
to refer to equations, and \autoref
to refer to figures, theorems, etc.
I'm using the article
document class and MikTeX distribution.
Best Answer
Using
\autoref
is actually simpler and has an nice advantage! The area for clicking on a hyperlink is larger (see example below) since the "type names" are included in the clickable area.For that, we insert following code in the LyX Preamble.
The command
\renewcommand\equationautorefname{\@gobble}
is used for equation references to remove the word "Equation~". In the example the styles "Reference" and "(<Reference>)" are used: