Featured Book

LaTeX Beginners Guide

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: No registered users and 1 guest

Partner Sites

TeXwelt - Fragen und Antworten goLaTeX
TeXblog
TeXnicCenter
TeXample

multiple alignment points and \split environment

Add tags Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).

multiple alignment points and \split environment

Postby Drugbird on Tue Aug 31st, 2010

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  •  Open in writeLaTeX
\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  •  Open in writeLaTeX
\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 2nd, 2010, edited 1 time in total.
Drugbird
 
Posts: 2
Joined: Tue Aug 31st, 2010

Re: multiple alignment points and \split environment

Postby localghost on Tue Aug 31st, 2010

It has to look a bit different. The code below shows only the relevant part.
Code: Select all  •  Open in writeLaTeX
\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
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses
User avatar
localghost
Site Moderator
 
Posts: 9219
Joined: Fri Feb 2nd, 2007
Location: Braunschweig, Germany

Re: multiple alignment points and \split environment

Postby Drugbird on Thu Sep 2nd, 2010

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?
Drugbird
 
Posts: 2
Joined: Tue Aug 31st, 2010

Re: multiple alignment points and \split environment

Postby localghost on Thu Sep 2nd, 2010

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  •  Open in writeLaTeX
\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.
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses
User avatar
localghost
Site Moderator
 
Posts: 9219
Joined: Fri Feb 2nd, 2007
Location: Braunschweig, Germany


Return to Math & Science

Who is online

Users browsing this forum: No registered users and 1 guest