7
\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?

7

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.

| improve this answer | |
6

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

| 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
5

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.

| improve this answer | |

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.