2

I have 2 equations, both have to be numbered and aligned. Equations' numbers should be vertically centered. But equations are long and have to be broken into 2 or 3 lines each. It would be great to have 2 alignment points in each line. But I cannot achieve that using split. Or can I? Here is the MWE:

\begin{align}
\begin{split}
z_1^{i,j}
    & = a_1 \, x_1^{i,j} + b_1 \, \delta_1^{i,j} \\
    & + \sum_k y_k^{i,j} \qquad \forall ~i,j
\end{split}
\\
\begin{split}
z_2^{i,j}
    & = a_2 \, x_2^{i,j} + b_2 \, \delta_2^{i,j} + c_2 \\
    & + z_1^{i,j} \qquad \forall ~i,j
\end{split}
\end{align}

Basically, I want the same output as produced with this code, especially equations' numbers vertically centered. In addition, I want \forall ~i,j from both equations to be also aligned, i.e. below each other. Solution with alignat instead align would be even better for me.

4

I believe you're using a two column format.

The environment split only accepts one alignment point; you can use \mathmakebox from mathtools (that also loads amsmath) and calc:

\documentclass[twocolumn]{article}
\usepackage{mathtools}
\usepackage{calc}

\begin{document}
\begin{align}
\begin{split}
z_1^{i,j}
    & = a_1^{} x_1^{i,j} + b_1^{} \delta_1^{i,j} \\
    & \qquad+ \sum_k y_k^{i,j}
      \qquad \forall i,j
\end{split}
\\
\begin{split}
z_2^{i,j}
    & = a_2^{} x_2^{i,j} + b_2^{} \delta_2^{i,j} + c_2^{} \\
    & \qquad + \mathmakebox[\widthof{$\displaystyle\sum_k y_k^{i,j}$}][l]{z_1^{i,j}}
      \qquad \forall i,j
\end{split}
\end{align}
\end{document}

Note that \, between factors is not used, while ^{} is recommended in order to push subscripts at the same level. The + on the second line shouldn't be under the equals sign, as it belongs to the right hand side of the expression.

enter image description here

However, the subscripts are not really level, because of j at the exponent, so you might want a slightly more complex adjustment:

\documentclass[twocolumn]{article}
\usepackage{mathtools}
\usepackage{calc}

\newcommand{\adjs}[1]{^{\vphantom{#1}}}

\begin{document}
\begin{align}
\begin{split}
z_1^{i,j}
    & = a_1\adjs{j} x_1^{i,j} + b_1\adjs{j} \delta_1^{i,j} \\
    & \qquad+ \sum_k y_k^{i,j}
      \qquad \forall i,j
\end{split}
\\
\begin{split}
z_2^{i,j}
    & = a_2\adjs{j} x_2^{i,j} + b_2\adjs{j} \delta_2^{i,j} + c_2\adjs{j} \\
    & \qquad + \mathmakebox[\widthof{$\displaystyle\sum_k y_k^{i,j}$}][l]{z_1^{i,j}}
      \qquad \forall i,j
\end{split}
\end{align}
\end{document}

enter image description here

  • Works nice. It's very elegant solution and just what I wanted. And the \adjs command is just beautiful. – MMSt Sep 19 '14 at 8:48
1

Well there is no problem with each of your equations in one line, and the symbols can be aligned with the alignat environment:

\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}
    \usepackage{amsmath}
\usepackage[showframe]{geometry}

\begin{document}

\begin{alignat}{2}
z_1^{i,j}    & = a_1 \, x_1^{i,j} + b_1 \, δ_1^{i,j}
     + ∑_k y_k^{i,j} &  \qquad &  ∀ ~i,j \\
z_2^{i,j}
    & = a_2 \, x_2^{i,j} + b_2 \, δ_2^{i,j} + c_2
     + z_1^{i,j}  &  &  ∀ ~i,j
\end{alignat}

\end{document}

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.