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 use the alignat environment to arrange five equations on three lines as follows: two equations on the first line, two equations on the second line (aligned with those of the first line), and the fifth equation centered on the third line by itself. For what is worth, here's my failed attempt:

\begin{alignat}{3}
a ={}& b 
&\qquad &
c ={}& d 
\\
e ={}&f 
&\qquad &
g ={}& h
\\
{\centering
 i = j
 }
\end{alignat}

Please note I don't want the equation i=j on the third row to be aligned to the left, nor to the right, nor aligned with any particular piece of the other four equations, I really want it by itself on the third row, and centered on that row. I can produce the first two lines with no problem (using either align or alignat), but I can't get the single equation on the third line to be centered!

share|improve this question
    
Welcome to TeX.SE. I removed 'thanks' from your post since we omit this. Instead, you should up-vote and accept the answers, giving the answerer the site reputation. –  tohecz Aug 26 '12 at 19:59

4 Answers 4

up vote 11 down vote accepted

If you need each line to be numbered, then you can nest alignat inside gather:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{gather}
\begin{alignat}{2}
a &= b &\qquad
c &= d
\\
e &=f &
g &= h
\end{alignat}
\\
 i = j
\end{gather}
\end{document}

Without numbers, here's the way:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{gather*}
\begin{alignedat}{2}
a &= b &\qquad
c &= d
\\
e &=f &
g &= h
\end{alignedat}
\\
 i = j
\end{gather*}
\end{document}
share|improve this answer
    
Thanks a lot, this was very helpful! –  Jon Aug 26 '12 at 21:23

Well, something like this? And remark: & should be before =, not after it. This will as well automatically use the correct spacing.

\begin{gather*}
\begin{aligned}
  a &= b
&
  c &= d 
\\
  e &= f 
&
  g &= h
\end{aligned}
\\
  i = j
\end{gather*}
share|improve this answer
    
Thanks a lot for the answer! –  Jon Aug 26 '12 at 22:38

A regular array would work, given that you provide some help in terms of spacing between the columns:

enter image description here

\documentclass{article}
\begin{document}
\[
  \begin{array}{r@{{}={}}l@{\qquad}r@{{}={}}l}
    f(x) & ax^2 + bx + c & g(x) & mx + c \\[\jot]
    f_1(x) & 2x^2 + 3x - 4 & g_1(x) & 3x - 1 \\[\jot]
    \multicolumn{4}{c}{h(x)=ax^3 + bx^2 + cx + d}
  \end{array}
\]
\end{document}

The column specification @{{}={}} handles the equal signs between functions f and g, and separates them by \qquad, while \\[\jot] adds a little vertical space between the equations. The last equation is centred in the traditional way using \multicolumn{.}{c}{...}.

share|improve this answer
    
Thanks for the answer! –  Jon Aug 26 '12 at 21:24

Not perhaps relevant here, but this is how I would do it with plain TeX (I used Werner's example content):

$$
  \displaylines{
    \eqalign{f(x)&=ax^2+bx+c\cr f_1(x)&=2x^2+3x-4}
    \qquad
    \eqalign{g(x)&=mx+c\cr g_1(x)&=3x-1}
    \cr\noalign{\kern\dp\strutbox}
    h(x)=ax^3+bx^2+cx+d
  }
$$
\bye

enter image description here

share|improve this answer

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.