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.
\documentclass{scrartcl}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath,  amsthm,  amssymb}
\usepackage{mathtools}

\begin{document}
    \begin{align}
        \begin{split}
            \label{eq:lines}
            Q_{1x} &= C_{1x} + \mu_1 \vec{h_{1x}} \\
            Q_{1y} &= C_{1y} + \mu_1 \vec{h_{1y}} \\
            \vdots \\
            Q_{3z} &= C_{3z} + \mu_3 \vec{h_{3z}}
        \end{split} \\
        \begin{split}
            \label{eq:distances}
            \overline{Q_1 Q_2}^2 &= (Q_{1x}-Q_{2x})^2 + (Q_{1y}-Q_{2y})^2 + (Q_{1z}-Q_{2z})^2\\
            \vdots
        \end{split}
    \end{align}
\end{document}

I want to align the equations in both split-environments along the "="-Symbol in the same way. Any ideas?

share|improve this question
1  
Welcome to TeX.SX! Please add a fully compilable minimal working example (MWE) that illustrates your problem. –  canaaerus Aug 21 '12 at 8:56
    
added such an example –  user38034 Aug 21 '12 at 9:18
1  
The solution to Aligning across 'aligned' equation blocks should be adaptable to this situation. Of course, it may be simpler to make your example one align and just use \notag on the lines that should not be numbered. –  Andrew Swann Aug 21 '12 at 9:26
1  
@Andrew: but then the eqn number is not centered around the group. –  daleif Aug 21 '12 at 10:41

3 Answers 3

up vote 5 down vote accepted

All you need to do is to remember to put alignment signs & on all the lines in your splits (your code has none on the \vdots lines). Minimising your example gives:

\documentclass{scrartcl}

\usepackage{amsmath}

\begin{document}

\begin{align}
   \label{eq:lines}
   \begin{split}       
      Q_{1x} &= C_{1x} + \mu_1 \vec{h_{1x}} \\
      Q_{1y} &= C_{1y} + \mu_1 \vec{h_{1y}} \\
      \vdots& \\
      Q_{3z} &= C_{3z} + \mu_3 \vec{h_{3z}}
   \end{split} \\
   \label{eq:distances}
   \begin{split}        
      \overline{Q_1 Q_2}^2 &= (Q_{1x}-Q_{2x})^2 + (Q_{1y}-Q_{2y})^2 
                                      + (Q_{1z}-Q_{2z})^2\\
      \vdots&
   \end{split}
  \end{align}
\end{document}

Sample output

Now you need to decide how you want to place the \vdots...

Discussion

The documentation amsmath.pdf is not so clear about this structure saying

The split structure should constitute the entire body of the enclosing structure, apart from commands like \label that produce no visible material.

in the section "Split equations with alignment", in contrast to the description under gather

Any equation in a gather may consist of a \begin{split} ... \end{split} structure—...

However, the accompanying filed testmath.pdf contains two explicit examples of multiple splits within an align. What you can't do is enclose such a split construction inside e.g. a \left ... \right construction.

Note that there is the package breqn which contains code that allows complicated alignment between various blocks, but it alters fundamental constructions in math mode, and so has a number of compatibility issues.

share|improve this answer
    
Wow, a really easy method. :) Thanks –  user38034 Aug 22 '12 at 7:19

Ok, I have to admit, I have no idea why this worked, just wanted to add an example using the \vdotswithin{} from mathtools and all of a sudden the ='s aligned. I also changed the \vec to only go over the h's.

\documentclass{scrartcl}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath,  amsthm,  amssymb,mathtools}
\usepackage{mathtools}

\begin{document}
    \begin{align}
        \begin{split}
            \label{eq:lines}
            Q_{1x} &= C_{1x} + \mu_1 \vec{h}_{1x} \\
            Q_{1y} &= C_{1y} + \mu_1 \vec{h}_{1y} \\
            &\vdotswithin{=} \\
            Q_{3z} &= C_{3z} + \mu_3 \vec{h}_{3z}
        \end{split} \\
        \begin{split}
            \label{eq:distances}
            \overline{Q_1 Q_2}^2 
            &= (Q_{1x}-Q_{2x})^2 + (Q_{1y}-Q_{2y})^2 + (Q_{1z}-Q_{2z})^2\\
            &\vdotswithin{=}
          \end{split}
    \end{align}
\end{document}

IMAGE

share|improve this answer
    
It turns out that it has nothing to do with \vdotswithin. See my answer! –  Andrew Swann Aug 21 '12 at 15:38

You need aligned instead of split:

\documentclass{scrartcl}
\usepackage{amsmath}

\newlength{\templen}

\begin{document}

\settowidth{\templen}{$\displaystyle\overline{Q_1 Q_2}^2$}
\begin{align}
\label{eq:lines}
&\begin{aligned}
\makebox[\templen][r]{$\displaystyle Q_{1x}$} &= C_{1x} + \mu_1 \vec{h_{1x}} \\
Q_{1y} &= C_{1y} + \mu_1 \vec{h_{1y}} \\
\vdots \\
Q_{3z} &= C_{3z} + \mu_3 \vec{h_{3z}}
\end{aligned} \\
\label{eq:distances}
&\begin{aligned}
\overline{Q_1 Q_2}^2 &= (Q_{1x}-Q_{2x})^2 + (Q_{1y}-Q_{2y})^2 + (Q_{1z}-Q_{2z})^2\\
\vdots
\end{aligned}
\end{align}
\end{document}

The \templen width can be reused at will. It must be set outside the align environment.

share|improve this answer
    
Thanks a lot. Solves the problem. –  user38034 Aug 21 '12 at 10:10

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.