Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to re-insert an equation in LaTeX via referencing the original equation by label? I already know, it is possible to:

  • reuse the original equation numbering via \tag{} as described here
  • re-insert an equation by "boxing" the original one as said here

But isn't it possible to reuse the whole equation (i.e. its text and numbering) just using the label? Wouldn't it be natural to do so, instead of artificially creating additional labels by "boxing"? I'm feeling there must be a better way, or is my intuition wrong?

share|improve this question
1  
No it would not be natural, as you can only reuse something, if it was saved before. Usually you don't need to reuse it, so by default the equation's content is not saved. –  canaaerus Jul 18 '12 at 8:09
    
I disagree - the whole document is written as text file and hence persistent. It doesn't need saving, it's already saved. I still think it would be natural, or at least could be e.g. a label's attribute whether the whole equation can be reinserted later. Just a plain old academic thought. –  mmm Jul 18 '12 at 8:18
    
Certainly the text file is persistent. But to access the particular piece of code making up your equation, a lot of parsing has to take place. So the only reasonable approach is saving the equation — either as the original character string,the tokenized input or the final expanded version — and later accessing that saved version. –  canaaerus Jul 18 '12 at 8:28
    
Always right, huh? :) –  mmm Jul 18 '12 at 8:32
1  
@mmm: the persistency of the equation in the file only helps if you repeatedly re-read the file. LaTeX can't easily do that without disrupting the typesetting, so that persistency is moot. What LaTeX does is to save labels, etc. as macros in an auxiliary file which it reads into memory precisely once (at the beginning of the document). To save every labelled equation for re-use, you could modify the labelling macro so that in a displayed math environment it saves everything until the next newline or the end of the math with the equation number. If you're up for a challenge, try it yourself! –  Niel de Beaudrap Jul 18 '12 at 10:24
show 1 more comment

2 Answers

up vote 8 down vote accepted

As usuallay, nearly everything is possible, but what you want, does not exist yet (AFAIK). What you are asking for is a macro, which goes back to the label, copies the environment completely and expands it at another place, changing the \label into something like \tag in amsmath.

I'm quite convinced, the hacker fraction here could come up with a solution of less than 20 lines of code within half an hour.

But be warned: Why offers the amsmath package only the \tag-solution? Isn't it more usual to refer to an equation by citing its number than to reprint it completely?

share|improve this answer
add comment

I know this question is old but I thought I'd give my input. It seems like the easiest solution would be to save the equation in a separate file and just \input{} the equation whenever it is needed, using whatever desired means to attach the right equation number to it. Of course this could get messy if you have a lot of equations like this. Maybe then you could save them all in a subdirectory. Not elegant but it should work.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.