Math & Sciencemultiple alignment points and \split environment

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Drugbird
Posts: 2
Joined: Tue Aug 31, 2010 3:13 pm

multiple alignment points and \split environment

Post by Drugbird »

Hi there,

I'd like to display a two line equation aligned in more than one place across two lines, but only supply it with one number.

I.e. in an equation like:
a=b=c
ab=bc=c^2

I'd like the = signs to be aligned vertically, and I want 1 equation number to the right halfway between the two lines.

I know alignment can be done with \alignat, and the numbering can be done with \split, but I can't seem to get both things at once.

MWE:

Code: Select all

\documentclass[10pt,a4paper]{article}
\usepackage{amsmath}
\begin{document}
\section{Test}
\begin{alignat}{3}
a&={}&b&={}&c\\
ab&={}&bc&={}&c^2
\end{alignat}

\begin{alignat}{3}
a&=b&=c\\
ab&=bc&=c^2
\end{alignat}

\begin{equation}
\begin{split}
a&=b=c\\
ab&=bc=c^2
\end{split}
\end{equation}

\end{document} 

Also, alignat seems to require an extra {}& per equal sign that I don't quite understand (top equation in the MWE, since the one below has strange spacing). Could someone explain this to me?

Furthermore, the split environment will produce error messages if I put more & symbols on one line. For example, inserting this in the MWE will produce error messages:

Code: Select all

\begin{equation}
\begin{split}
a&=b&=c\\
ab&=bc&=c^2
\end{split}
\end{equation}
Could someone help me align and number things the way I like? Thanks in advance.

(Some more details I'm not quite sure are useful: I use WinEdt 6.0 with MikTex 2.8 and PDFTexify)
Last edited by Drugbird on Thu Sep 02, 2010 1:00 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

multiple alignment points and \split environment

Post by localghost »

It has to look a bit different. The code below shows only the relevant part.

Code: Select all

\begin{equation}
  \begin{alignedat}{2}
    a  &= b  & &= c\\
    ab &= bc & &= c^2
  \end{alignedat}
\end{equation}
See the amsmath manual for details. More stuff about math typesetting can be found in the »Math mode« document.


Best regards and welcome to the board
Thorsten
Drugbird
Posts: 2
Joined: Tue Aug 31, 2010 3:13 pm

Re: multiple alignment points and \split environment

Post by Drugbird »

Thanks a lot, localghost. This is exactly what I was looking for.

I'm still not quite sure though why you need three & symbols per line. My reasoning is that there are only two equal signs that need to be aligned, so you'd also need two & symbols. I tried searching the amsmath documentation, but was unable to find it... Any help?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

multiple alignment points and \split environment

Post by localghost »

Drugbird wrote:[…] I'm still not quite sure though why you need three & symbols per line. My reasoning is that there are only two equal signs that need to be aligned, so you'd also need two & symbols. I tried searching the amsmath documentation, but was unable to find it. […]
Consider the alignat environment as an array with special alignment of the columns.

Code: Select all

\begin{array}{@{}r@{\,=\,}lr@{\,=\,}l@{}}
  a  & b  & c \\
  aa & bb & cc
\end{array}
If you declare an alignat environment with n as its mandatory argument for the number of equal signs to be aligned, you will need n+1 alignment characters (ampersands) to get the right alignment. Take a look at Sections 3.6 and 3.7 of the amsmath manual. You can find similar descriptions in the »Math mode« document.
Post Reply