# Putting equations in \intertext to annotate a proof

I'm trying to typeset a proof with Latex. When I do proofs, I like to alternate between a line of text, to explain each step, and the resulting equation. I also like to have the equations align at the =.

I can do this quite easily with begin{align} and \intertext{}. My issue, though, is that I would now like to put an equation into the \intertext. Essentially, it's a side equation which isn't directly part of the proof but is important to get from one step to the next.

Obviously, I could just abandon begin{align} and alternate between text mode and math mode, but then lines of my proof wouldn't be aligned at the =.

Is there some way that I can force \intertext to accept my equation? Otherwise, what do people generally do when they have an equation that's important to the proof but not part of the direct logic?

• Maybe try to provide a simple complete example with of your proofs (or some piece of it) so we can start with that and enhance your code ;) – boycott.se - yo' Mar 26 '12 at 17:41
• You're right, tohecz. Had I taken your advice, my error would have been immediately apparent. I only went back and further checked my coding when David said that it does in fact work. He was quite right. I'll keep this in mind when asking questions in the future. Thanks! – Shane Mar 26 '12 at 17:56
• @Shane It is good if you post a note as to what the error was for reference. A common mistake is to forget that \intertext is text and if you want to enclose maths within you need the  or $$..$$. Posting your MWE post answer is also fine. – Yiannis Lazarides Mar 26 '12 at 18:10 • My error was failing to close the equation within \intertext with ) (exactly as you suggested), even though I knew it had to be closed. In my actual document, I'm not surprised that happened as there were a ton of parentheses and \'s. How I repeated the same error in my simplified test (and I actually did do a test similar to David's), I'll never understand. Again, thanks to all who helped. – Shane Mar 26 '12 at 22:48 ## 3 Answers This appears to just work, depending on what you want he output to look like, did you get an error message from your use of \intertext \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align} 1 &=2\\ \intertext{aaa} a+b&=c+d\\ \intertext{dont't forget that % use primitive display math here as a nested equation % disturbs align counting1111=1
\refstepcounter{equation}\eqno(\theequation)}
0.5&=\frac{1}{2}
\end{align}


\end{document}

• Hmm - that is what I'm trying to do, only with ( and ) to keep the 1=1 next to 'that'. I tried to come up with my own similar test, which didn't work. I'll play around a little more to work out where I made an error. Thanks very much! – Shane Mar 26 '12 at 17:47
• OK - I hate myself. It was just me getting lost in syntax and then inexplicably making the same error in the simplified test I constructed. I'm still rather prone to these errors as a novice. Thanks so much for your help! – Shane Mar 26 '12 at 17:54
• Can I ask why the equations are numbered ? The last one isn't numbered ... I couldn't find anything different in the code that produces numbers in one place but not in the other. – user230452 Jun 26 '16 at 3:57
• @user230452 excellent question!!, I fixed the code. – David Carlisle Jun 26 '16 at 8:53
• yes did you try? – David Carlisle Jun 30 '16 at 19:38

You can put $<equation>$ in \intertext, as demonstrated below

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
f(x) & = x^2+5x+9\\
&= \left( x+\frac{5}{2} \right)^2-\frac{25}{4}+9
\intertext{because $\left( \frac{5}{2} \right)^2=\frac{25}{4}$}
f(x)    & = \left( x+\frac{5}{2} \right)^2+\frac{11}{4}
\end{align*}
\end{document}


Otherwise, what do people generally do when they have an equation that's important to the proof but not part of the direct logic?

I suggest using the extension witharrows.

\documentclass{article}
\usepackage{witharrows}
\begin{document}
\begin{DispWithArrows*}
f(x) & = x^2+5x+9
\Arrow{because $\left( \frac{5}{2} \right)^2=\frac{25}{4}$} \\
& = \left( x+\frac{5}{2} \right)^2-\frac{25}{4}+9 \\
& = \left( x+\frac{5}{2} \right)^2+\frac{11}{4}
\end{DispWithArrows*}
\end{document}