8

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!

12

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}
8

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*}
4

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}{...}.

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.