\ref versus \eqref

rob.distel's picture

Is there any way of using the \eqref tag instead of the \ref tag in SWP5.5? When the amsmath package is loaded it still uses \ref when using INSERT/TYPESET OBJECT/CROSS REFERENCE.

 

 

 You will need to use a TeX

 You will need to use a TeX field if you want to reference equations using \eqref rather than \ref.  When you do a cross reference it resolves to the previous object closest to the marker.  SW doesn't retain any information as to what this object might be.  So, to use \eqref to add a cross reference to an equation marked myeq, use Insert, Typeset Object, TeX Field and in the body of the dialog enter:

\eqref{myeq}

It could be helpful to turn on the Encapsulate check box and then enter a descriptive name, probably including the marker being referenced. Otherwise when you open the document you will see a TeX field showing only the name of the macro, "eqref".

rob.distel's picture

Another way that doesn't

Another way that doesn't require resorting to latex or changing dozens of existing references is to add the following in the preamble

\let\oldref\ref
\renewcommand{\ref}[1]{\textup{(\oldref{#1})}}
 

which duplicates the effect of the \eqref tag - turning all your \ref's into \eqref's - great provided you dont need to refer to figures as well...