18

I have an equation:

\begin{equation}\label{eq:equation}
f(x)=x
\end{equation}

I would like to refer to this equation and show the whole formula again, and not only its number. In other words, I wanna get $f(x)=x$ instead of \eqref{eq:equation}.

How do I refer to the equation in order to reproduce its formula instead of its number?

4
  • Welcome to TeX.sx!
    – henrique
    Oct 8, 2012 at 14:43
  • A tip: indent with 4 spaces the code block to format it properly or use the button with the braces ({}) above the edit window. In the case of inline code, either put the code between backticks (`) or select and press Ctrl+K.
    – Count Zero
    Oct 8, 2012 at 14:45
  • 1
    The answer to the question at tex.stackexchange.com/questions/47570/… suggests a way to write a command that "remembers" text in one place to use in another. It might work for you if you don't need to do it often. For a systematic solution, you will have to wait for one of the regulars here to chip in. Oct 8, 2012 at 15:15
  • I guess this answer is what you wanted. It used the least additional mechanisms compared to the existing solutions under the current question. tex.stackexchange.com/a/67654/286722 Dec 14, 2022 at 14:53

2 Answers 2

7

I just found this question that was asked earlier: Is it possible to re-insert a LaTeX equation by label?

It cites "Equation Reuse" from LaTeX-Community Forum as a solution.

Namely:

\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}

\begin{document}

%defining the box
\newsavebox\myeq
%filling the box
\savebox\myeq{\vbox{\begin{align*}
  a &= b\\
  &= c\\
  &= d\\
  &= e\\
  &= f
\end{align*}}}

%using the box
\usebox\myeq

%using the box
\usebox\myeq

%using the box
\usebox\myeq

\end{document}

Hope this helps!

2
  • It works pretty well. I would like to turn off the numbering when I use equation or align instead of align*. For instance, the first time the equation apear, I want to number it. The next time it apears, I want turn off the number. Anyone have an idea?
    – Diogo
    Oct 8, 2012 at 22:31
  • You could have the first instance be in the equation environment and define a separate box with the equation in displaymath. It's not a great solution, unfortunately.
    – kanatzidis
    Oct 8, 2012 at 23:33
15

This might be a solution, but I don't see how it would help the reader.

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\repeatable}[2]{%
  \label{#1}\global\@namedef{repeatable@#1}{#2}#2
}
\newcommand{\eqrepeat}[1]{%
  \@ifundefined{repeatable@#1}{NOT FOUND}{$\@nameuse{repeatable@#1}$}%
  ~\eqref{#1}}
\makeatother

\begin{document}

\begin{equation}
\repeatable{eq:good}{f(x)=x}
\end{equation}

This is seen in \eqrepeat{eq:good}.

\end{document}

However it seems from your comments that you want something more complicated; please be more specific in your question.

enter image description here

6
  • Actually, I just want to repeat the function of equation. Your answer worked well. Do you know how to hide the number not in the main equation, but when I am referring to that in the text? Thanks.
    – Diogo
    Nov 27, 2013 at 5:09
  • 1
    @Diogo Use equation*. But I don't find particular merits in the practice of repeating the whole equation; to be honest I consider it heavy.
    – egreg
    Nov 27, 2013 at 7:25
  • In case anyone else comes across this: When \repeatable contains a tikzcd-environment, I had to add [ampersand replacement=\&] to tikzcd to avoid the error Undefined control sequence. \end{tikzcd}}. I'd love to know why!
    – Anna
    Apr 1, 2022 at 23:58
  • @egreg One reason I see for repeating equations is a "cheat sheet" at the end of an equation-heavy document.
    – Anna
    Apr 2, 2022 at 0:00
  • 1
    @Anna It’s because the material is read as the argument to another command.
    – egreg
    Apr 2, 2022 at 8:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .