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.

I read over the response given here: Is it possible to re-insert a LaTeX equation by label? which says such a thing is possible only with a macro. I would like to do this.

I have a bajillion equations, some labelled and some not. Of those that are labelled, some I would like to display again, say, at the end of the document as a quick summary. Wome equations I want to show twice at different places identically.

The problem is I can't decide on notation and I keep changing small things and it is a bit of a pain to remember which equations I want to display again and if I've updated them or not.

Would there be a obvious/better way to do this?

I have to admit I haven't ever bothered with macros for latex before today so apologies if the following is horrible, but, (to the best of my understanding) is that it would be something like

\newcommand{\acommand}[2]{%
    #1
  \expandafter\newcommand\csname #2\endcsname{#1}%
}

\acommand{someequation}{equationassociated} \\
\equationassociated

So then \acommand{someequation}{labelassociated} will display someequation and define the macro \labelassociated.

But then, what if I want to display someequation along with the label entered as the second argument?

share|improve this question
    
Could you please provide a minimal working example (MWE) that shows your use case? –  Werner Dec 31 '12 at 8:23
    
Yes, what if? What is the question here? If you create a macro, e.g. \newcommand*{\reuseeq}[1]{\csname #1\endcsname}, and use it with the associated labe, e.g. \reuseeq{labelassociated} you’d get someequation again. Related: How do I show the equation formula again instead of its number of ref? –  Qrrbrbirlbel Dec 31 '12 at 8:32

1 Answer 1

For a lot of equations, specially if they must be reused, for me the best approach are external files, each with one raw equation and include in the master simply with \input{path\filename} or a macro that do this plus surround it with the desired environment, add appropriate labels based in the filename and/or path, etc.

This may seem a primitive approach, but it maintain a clean master file, the name of files can be easily renamed, numbered, ordered, edited, and more important, reused as you want without problems. However, with a really large amount of macros you might even run out of memory, and in any case, is not user friendly deal with large chunks of complex code in one document.

About the notation, my preference is a simple numeration if there are many, although it can a bit awful if you want to reorder the equations frequently. To remember what is each chunk I prefer put %comments in external file and before each input. Even the master file can have a \newcommand{\comment}[1]{\textbf{#1}~} and in each external files a \comment{some text} to show in the PDF, and for the final manuscript hide all the comments replacing the above macro by \newcommand{\comment}[1]{}

share|improve this answer

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.