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?
Asked
Active
Viewed 1.4e+01k times
78
Marco Daniel
- 95,681
shashashamti2008
- 5,380
1 Answers
104
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}

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.
Marco Daniel
- 95,681