57

Is there any difference between \eqref and \ref? I used both of them in my document using the package classicthesis and saw no difference in the result. Is there any specific situation in which I should use \eqref or \ref?

80

The command \ref is defined in the LaTeX Kernel. The command \eqref is defined by amsmath. In the documentation of amsmath you will find the explanation in section 3.11.2 Cross references to equation numbers.

\eqref puts brackets around the reference number. It's also places the references in in \upshape (or \textup), to match the equation reference exactly (Thanks to Werner). This is shown in the example below.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{equation}
a^2+b^2=c^2\label{eq:1}
\end{equation}

\verb+\eqref{eq:1} vs \ref{eq:1}+: \eqref{eq:1} vs \ref{eq:1}

\verb+\textit{\eqref{eq:1} vs \ref{eq:1}}+: \textit{\eqref{eq:1} vs \ref{eq:1}}

\end{document}

enter image description here


If you use the package classicthesis, you must load amsmath before. Because the package classicthesis loads the package hyperref. However the package itself doesn't change the format of the output.

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.