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:

enter image description here

using the code:

  \csxdef{reqno@#1}{\theequation}% remember equation number
  \protected@csxdef{req@#1}{\BODY}% remember equation
  \equation\BODY\label{#1}\endequation% print equation
\NewDocumentCommand\Eqref{ s m }{%
    \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
       \begin{equation}\csuse{req@#2}\end{equation}% equation
       \setcounter{equation}{\value{rememberedequation}}% restore equation number


  First we remember the equation without the equation number:
  To see what happens let's put a new unremembered equation in the middle
  Now we remember equation~\eqref{one} with the equation number:
  To check that equations are being indexed correctly, here is another unremembered equation
  Finally, we can reuse the remembered equation in-line as $\Eqref{one}$ and we can even
  add something to it with
      1 + \Eqref{one} +1

I have not tested this with "complicated" equations but I think that it should work.

  • Thank you very much Andrew. I think this would be very useful. Also can we add more components to this \Eqref* or \Eqref? I mean for example add ones from 1+\Eqref+1 – Pablo ARCB Mar 20 '18 at 13:25
  • 1
    please don't leave blank lines between text and a math display environment. it makes the vertical spacing uneven, and permits a page break at that point, which is almost always not a good idea. – barbara beeton Mar 20 '18 at 15:39
  • @PabloAR Yes, this is possible. Will edit – user30471 Mar 20 '18 at 23:50
  • 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
  • @BrunoLeFloch Thank you, that is definitely much better! I have modified my answer accordingly, – user30471 Mar 21 '18 at 12:58

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.