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 have this:

\begin{align*}  
&f(1) = -11 & &\mbox{while q satisfies} &q(1) = 11,\\  
&f(-2) = 20 & &\mbox{} &q(-1) = 20  
\end{align*}

which puts the text "while" on the same line as the first line (obviously). Is there a way to have it in the (vertical) middle of the two lines? I.e. in between the two lines.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Here are a few possibilities. I included your original code. Note that the align environment isn't really required for this structure.

My first version simply adds a line to your original code and inserts the text in that line. It is not an appealing solution. The version I prefer is the second to last, which uses cases. If you don't like the braces, you may use the last version that uses aligned. You can replace aligned by gathered or an array (as Daniel's solution).

\begin{align*}
&f(1) = -11 & &\mbox{while q satisfies} &q(1) = 11,\\
&f(-2) = 20 & &\mbox{} &q(-1) = 20
\end{align*}

\begin{align*}
&f(1) = -11 & &&q(1) = 11,\\
&&&\mbox{while q satisfies} \\
&f(-2) = 20 & &\mbox{} &q(-1) = 20
\end{align*}

\begin{align*}
\begin{cases}f(1) = -11\\f(-2)=20\end{cases}&&\text{while $q$ satisfies}&&\begin{cases}q(1) = 11\\q(-1)=20\end{cases}
\end{align*}

\begin{equation*}
\begin{cases}f(1) = -11\\f(-2)=20\end{cases}\qquad\text{while $q$ satisfies}\qquad\begin{cases}q(1) = 11\\q(-1)=20\end{cases}
\end{equation*}

\begin{equation*}
\begin{aligned}f(1) &= -11\\f(-2)&=20\end{aligned}\qquad\text{while $q$ satisfies}\qquad\begin{aligned}q(1) &= 11\\q(-1)&=20\end{aligned}
\end{equation*}

The result is

aligned equations

Edit : (A comment about mbox) To include text within an equation, you are better off to use the \text command rather than the \mbox.

share|improve this answer
    
Thanks very much! –  P.A Apr 25 '11 at 20:27
add comment

I would say as a good solution the use of the array environment within the align environment:

\begin{align}
\begin{array}{l}
f(1) = -11\\
f(-2)
\end{array}
\qquad \text{while $q$ satisfies}
\qquad
\begin{array}{r}
q(1) = 11,\\
q(-1) = 20  
\end{array}
\end{align}
share|improve this answer
    
Thanks a lot. I would vote up if I could :| –  P.A Apr 25 '11 at 20:27
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.