[Tex/LaTex] How to cross reference with \renewcommand{\theequation}

cross-referencingequations

I change the default numbering of the equation. Instead of default "1" on the right side I put "Eq. (1)". The number inside the parentesis automatically changes.

But in the cross reference i need "Equation 1", and I want that the number change automatically too.

What i can do is this:

\documentclass[11pt]{article}

\usepackage{polyglossia}
\setdefaultlanguage{brazil}

\usepackage{hyperref}
\hypersetup{colorlinks=true}

\usepackage{amsmath}

%% RETIRE THE PARENTESIS IN THE EQUATION NUMBERING

\makeatletter
\def\tagform@#1{\maketag@@@{\ignorespaces#1\unskip\@@italiccorr}}
\makeatother

%% PUT THE "EQ. (1)"

\renewcommand{\theequation}{Eq. (\arabic{equation})}
\makeatother


\begin{document}

O grau de compactação é definido como a razão (\%) entre densidade do solo seco e a densidade do solo seco quando compactado em um estado de referência, conforme Equação \ref{eq:grau}. %% HERE I WANT EQUATION 1

\begin{equation} 
{D=\frac{\rho_{b}}{\rho_{bs}}\times100} 
\label{eq:grau}
\end{equation}

\end{document}

enter image description here

Best Answer

Again, a modification of an answer of Andrew Stacey's does the trick:

\documentclass{article}
\usepackage{amsmath}
\usepackage{polyglossia}
\setdefaultlanguage{brazil}

\makeatletter
\let\reftagform@=\tagform@
\def\tagform@#1{\maketag@@@{(Eq.\ #1\unskip\@@italiccorr)}}
\renewcommand{\eqref}[1]{\textup{\reftagform@{\ref{#1}}}}
\makeatother

\begin{document}

O grau de compactação é definido como a razão (\%) entre densidade do
solo seco e a densidade do solo seco quando compactado em um estado de
referência, conforme Equação~\eqref{eq:grau}.
\begin{equation}
D=\frac{\rho_\textnormal{b}}{\rho_\textnormal{bs}}\times100
\label{eq:grau}
\end{equation}

\end{document}

Notice the usage of \eqref for automatically getting the parentheses. I also changed the formatting of the equation to have upright subscripts (they are text, rather than symbols).

enter image description here