[Tex/LaTex] \renewcommand{\theequation} and \renewcommand{\eqref} simultaneously

amsmathcross-referencingmath-mode

I'm trying to change the output of equation numbering in the text and next to each equation simultaneously.
For example, for the 1st eqn, I would like to add "eqn 1" after the equation, and cite it in the text as "equation 1".

After reading a few posts, I tried using simultaneously:

\renewcommand{\theequation}{eqn \arabic{equation}}
\renewcommand{\eqref}[1]{equation \ref{#1}} 

but using the \renewcommand{\theequation}{eqn \arabic{equation}} automatically adds the word eqn within the text, so I end up with an equation eqn 1.

A minimal example:

\documentclass[12pt]{article}
\usepackage{amsmath}
\renewcommand{\theequation}{eqn \arabic{equation}}
\renewcommand{\eqref}[1]{equation \ref{#1}}

\begin{document}
This is an example \eqref{eq:1}
\begin{equation}
y=2+4
\label{eq:1}
\end{equation}
\end{document}

which produces:

enter image description here

Basically what I would like to achieve is getting rid of the word eqn within the text, but keeping it after the equation. Thanks in advance for any help.

Best Answer

Quick and dirty method: Gobbling some args from \p@equation which is responsible for the typesetting of references to an equation label:

Please note the {} around eqn -- it does no harm for the display at the number, but keeps the eqn text as a delimited token list and this can be 'gobbled' with moving arguments in the usage of \gobblesomeargs which drops the first argument (i.e. eqn) and prints only the 2nd one.

I suggest to keep the original \eqref as well and use another one, say equref.

My solution does not need an extra package however (apart from amsmath, which is also not necessary in if \equref is defined)

\documentclass[12pt]{article}
\usepackage{amsmath}
\renewcommand{\theequation}{{eqn} \arabic{equation}}
%\renewcommand{\eqref}[1]{equation \ref{#1}}
\newcommand{\equref}[1]{equation \ref{#1}}
\makeatletter
\DeclareRobustCommand{\gobblesomeargs}[2]{#2}
\renewcommand{\p@equation}{\gobblesomeargs}
\makeatother

\begin{document}

This is an example \equref{eq:1}
\begin{equation}
y=2+4
\label{eq:1}
\end{equation}
\end{document}

enter image description here