In a LaTeX document I have a series of equations written inside different equation environments. I would like to replace the equation number with the solution of each equation. How can I do it?
Asked
Active
Viewed 107 times
2 Answers
3
A solution based on the \tag macro of the amsmath package:
\documentclass{article}
\usepackage{amsmath} % for "\tag" macro
\begin{document}
\[
x+1=2 \tag{$x=1$}
\]
\end{document}
Use \tag* instead of \tag if you don't want to surround the solution with parentheses.
Mico
- 506,678
1
Maybe, you want something like this:
$$
\matrix {x + 2 = 5 \cr
y + 3 = 5} \eqno (x=3,\ y=2)
$$
wipet
- 74,238
-
Don't use
$$ ... $$in LaTeX, use\[ ... \]instead. See why-is-preferable-to on this site. – Bernard Oct 01 '17 at 09:28 -
-
-
-
-
@egreg - Whether or not an answer is suitable for a LaTeX user is a separate issue, isn't it? :-) – Mico Oct 01 '17 at 09:38
-
@Mico If one asks how to go by train to somewhere, an answer “you can ride by bike” is not acceptable. – egreg Oct 01 '17 at 09:47
-
@egreg - For the record, I've not expressed a belief that it's helpful to provide a PlainTeX-based answer to a LaTeX-based question. But we're not going to sway P.O.'s opinion, are we? – Mico Oct 01 '17 at 09:54
-
2@Mico: I didn't even think of this possibility, as the O.P. mentioned equation
environments! – Bernard Oct 01 '17 at 10:07 -
My solution is usable in LaTeX too. The main advantage of such code is its independence of used format, so I never give advice to use something different from
$$..$$. Moreover, my solution is based on basic stones of TeX: TeX primitive\eqnoin this case. This primitive is very known in plain TeX, so if OP use plain TeX, this question never occurs. Finally, the "LaTeX train" has railway problems very often because of its complexity (we can see it in this forum) and the bike is much more effective in such situations. You can't get to each place using railway. – wipet Oct 01 '17 at 12:44
gatherin which you can display both the equation and its solution. – Yorgos Oct 01 '17 at 09:06