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'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?

Thanks in advance for your advice!

share|improve this question
1  
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 ;) –  tohecz 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
add comment

2 Answers

up vote 11 down vote accepted

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 \begin{equation}1=1\end{equation}}
0.5&=\frac{1}{2}
\end{align}

\end{document}

enter image description here

share|improve this answer
    
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
1  
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
add comment

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

enter image description here

\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}
share|improve this answer
add comment

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.