# Is there any package where the reference writes the equation?

Just a question for knowledge. I would like to know if there is a package that by doing a label of a equation and referring to it with \eqref of whatever command it is, that equation appears completely instead of the label. Maybe the point is to copy the label the same as the equation, but I ask if there is a easier way.

I don't know of a package that does this but the code below defines a new environment requation, for "remember equation", that takes a mandatory label that can then be used with \Eqref{<label>} to repeat the equation. By default, the original equation number is repeated and there is *-version for omitting the equation number.

EDIT In the comments the OP asks if it is possible to use this macro as 1+\Eqref{...}+1. With the initial implementation this was not possible, but I with a small variation I have added a !-version that reproduces the equation without putting it inside an equation environment. Consequently, the !-version allows 1+\Eqref!{one}+1 and it also allows \Eqref to be used in-line. The ! and * modifiers cannot be used together. (In hindsight, perhaps \Eqref{} should just reproduce the equation and the *-variant should put it inside an equation environment with the original number, allowing the !-variant to be dropped.) I have also added an "automatic" \label{...} to the requation environment.

Edit II Following Bruno's excellent suggestion in the comments I have removed the !-variant and made \EqRef{...} reprint the equation whenever it is used inside math-mode. This simplifies the syntax and does not change the output.

The result is that you can write:

using the code:

\documentclass{amsart}
\usepackage{environ}
\usepackage{etoolbox}
\usepackage{xparse}
\makeatletter
\NewEnviron{requation}[1]{%
\csxdef{reqno@#1}{\theequation}% remember equation number
\protected@csxdef{req@#1}{\BODY}% remember equation
\equation\BODY\label{#1}\endequation% print equation
}
\newcounter{rememberedequation}
\NewDocumentCommand\Eqref{ s m }{%
\relax\ifmmode$$\csuse{req@#2}$$%
\else%
\IfBooleanTF{#1}{\begin{equation*}$$\csuse{req@#2}$$\end{equation*}}% no equation number
{% if no * then we need to fudge the equation number
\setcounter{rememberedequation}{\value{equation}}% store equation number
\setcounter{equation}{\csuse{reqno@#2}}% reset equation number
$$\csuse{req@#2}$$% equation
\setcounter{equation}{\value{rememberedequation}}% restore equation number
}%
\fi%
}
\makeatother

\begin{document}

\begin{requation}{one}
1+1=2
\end{requation}
First we remember the equation without the equation number:
\Eqref*{one}
To see what happens let's put a new unremembered equation in the middle
$$2+2=4$$
Now we remember equation~\eqref{one} with the equation number:
\Eqref{one}%
To check that equations are being indexed correctly, here is another unremembered equation
$$3+2=5$$
Finally, we can reuse the remembered equation in-line as $\Eqref{one}$ and we can even
$1 + \Eqref{one} +1$

• Better than ! variant would be to test for math mode using \relax\ifmmode your ! variant \else your variant surrounded by begin/end equation \fi – Bruno Le Floch Mar 21 '18 at 2:57