2

I want to be able to create many equations, say $a+b=c$ and $c+d=e$, save the equation as a variable but not have the equation be displayed. I simply want to have the ability to use the label/variable name(or perhaps another term?) to display them at a later point in the document. This is because the order of the equations will change later and I want to be able to easily move them around.

Essentially I want to see if I can define hidden variables that take theses equations and display these "variables" later in the document

3
  • Don't worry if you move equations. TeX will do the job for you. Just use \begin{equation}content...\label{key}\end{equation} and cite then with \eqref{key} (load amsmath package).
    – Sigur
    Feb 1, 2015 at 0:03
  • I don't want there to be a label on the side and I don't want to see the equation where I initially define it. Feb 1, 2015 at 0:08
  • To remove the number just use the stared version equation*. But if you don't want it there so why to write it?
    – Sigur
    Feb 1, 2015 at 0:10

2 Answers 2

1

Just use

\newcommand\myeqA{$a+b=c$}
\newcommand\myeqB{$c+d=e$}

then when you want the first to appear, use \myeqA.

3
  • Perfect! This answers my question exactly Feb 1, 2015 at 0:10
  • Do you know if I can name a command with a numebr in it, like myeq11 or myeq24? Feb 1, 2015 at 0:11
  • No, well with a bit more work you could make the number an argument \myeq{11} or some such but only by defining commands that define and use internal commands you can not normally type, just using letters is a lot easier. Otherwise this for example or this one Feb 1, 2015 at 0:24
2

Because the question doesn't specify the used format (LaTeX or something else) I give the format-independent answer:

\def\A{$a+b=c$}
\def\B{$c+d=e$}

Warning: The \newcommand is LaTeX specific feature.

You must log in to answer this question.

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