# Writing steps to an equation

I am new to LyX, how do I write steps to an equation, and if I want to do an operation on both sides of the equation, something like

x+2=2 \-2
x = 0

• You might be interested in reading LyX's Math manual. See Help > Math – scottkosty Nov 21 '15 at 16:26

Something like this?

If you don't like the vertical bar, consider replacing \mid with \setminus.

\documentclass{article}
\usepackage{amsmath}  % for 'align*' environment
\begin{document}
\begin{align*}
x+2 &= 2 \qquad \mid -2\\
x\phantom{{}+2} &= 0
\end{align*}
\end{document}


Addendum: If your systems of equations tend to be more involved than the one you gave in your posting, you may want to look into loading the systeme package. One of its very nice features is that it handles many equation-related formatting tasks with ease. Caveat: The package's user guide is available only in French; however, the document features a lot of more or less self-explanatory examples and should thus be usable even if you don't understand French.

\documentclass{article}
\usepackage{systeme} % for '\systeme' macro

\begin{document}
$\sysdelim.. % no delimiters on either side \systeme{x+2=2 @ \qquad\mid-2, x=0}$
\end{document}

• how do you write comments within the equations? – Ethan Nov 21 '15 at 15:46
• @Ethan - what do you mean by "comments"? Could you give an example? – Mico Nov 21 '15 at 15:46
• like explanatory text – Ethan Nov 21 '15 at 15:47
• @Ethan -- Do you mean something like replacing the "-2" fragment with a text string, e.g., "\text{Subtract 2 from both sides}"? (The \text macro requires the amsmath package.) – Mico Nov 21 '15 at 15:48