3

I am trying to achieve the following structuring with an align environment: Each of the first two rows has 2 equations, which should be aligned. In the third and fourth row, there should be one centered equation in each case. With my approach those criteria are mainly satisfied, but the horizontal space is way to large and it looks somehow irregular. So I would like to ask how I can get the 3./4. row to be between the two equation in the first two lines.

\documentclass[a4paper]{article}
\usepackage{amsmath}

\begin{document}
    \begin{align}
        x1&=y1  &       a1&=b1 \label{eq:a} \\
        x2&=y2  &       a2&=b2 \label{eq:b} \\
    \begin{split}
        x3=y3 \\
        a3=b3
        \label{eq:c}
    \end{split}
    \end{align}
\end{document}

The following approach would be perfect, if there wasn't a blank line between the two align environments.

\begin{document}
    \begin{align}
        x1&=y1  &       a1&=b1 \label{eq:a} \\
        x2&=y2  &       a2&=b2 \label{eq:b}
    \end{align}
    \begin{align}
    \begin{split}   
        x3=y3 \\
        a3=b3
        \label{eq:c}
    \end{split} 
    \end{align}
\end{document}

I really hope you can understand my English :D Thanks in advance!

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – karlkoeller Mar 7 '15 at 12:32
  • Thank you... next time, there won't be any emotions of gratitude or salutation in my question ;) – Jan Mar 7 '15 at 21:43
  • I don't mind emotions of gratitude or salutation at all, but some people here do. The welcome message is a standard one we use over here. Just remember to upvote answers that you find useful, and accept the one which helped you most. See How do you accept an answer? – karlkoeller Mar 8 '15 at 7:17
2
\documentclass[a4paper]{article}
\usepackage{mathtools}

\begin{document}
    \begin{alignat}{3}
        x1&=y1  &  &  &      a1&=b1 \label{eq:a} \\
        x2&=y2  & & &      a2&=b2 \label{eq:b} \\
        && \begin{aligned}
         x3&=y3 \\
         a3&=b3
        \end{aligned}& &
        \label{eq:c}
    \end{alignat}
\end{document}

enter image description here

\documentclass[a4paper]{article}
\usepackage{mathtools}

\begin{document}
    \begin{alignat}{3}
        x1&=y1  & \qquad\qquad & \qquad\qquad &      a1&=b1 \label{eq:a} \\
        x2&=y2  & & &      a2&=b2 \label{eq:b} \\
        && \mathclap{\begin{aligned}
         x3&=y3 \\
         a3&=b3
        \end{aligned}}& &
        \label{eq:c}
    \end{alignat}
\end{document}

enter image description here

The long third equation version:

\documentclass[a4paper]{article}
\usepackage{mathtools}

\begin{document}
    \begin{alignat}{3}
        x1&=y1  & \qquad\qquad & \qquad\qquad &      a1&=b1 \label{eq:a} \\
        x2&=y2  & & &      a2&=b2 \label{eq:b} \\
        && \mathclap{\begin{aligned}
         x3&=y3 +a1 -d1 +e5 +a1 -d1 +e5 \\
         a3&=b3
        \end{aligned}}& &
        \label{eq:c}
    \end{alignat}
\end{document}

enter image description here

The centered long third equation version:

\documentclass[a4paper]{article}
\usepackage{mathtools}

\begin{document}
    \begin{alignat}{3}
        x1&=y1  & \qquad\qquad & \qquad\qquad &      a1&=b1 \label{eq:a} \\
        x2&=y2  & & &      a2&=b2 \label{eq:b} \\
        && \mathclap{\begin{gathered}
         x3=y3 +a1 -d1 +e5 +a1 -d1 +e5 \\
         a3=b3
        \end{gathered}}& &
        \label{eq:c}
    \end{alignat}
\end{document} 

enter image description here

  • Thank you very much for your answer too!! Now I'll try to find out, how this exactly works – Jan Mar 7 '15 at 13:04
  • @Jan Sure. In case of doubt, please leave a comment for clarification. BTW run texdoc amsldoc from command prompt to open amsmath documentation and try to search for alignat. – user11232 Mar 7 '15 at 13:46
  • I tried these approaches. Unfortunately, if the last two equations get longer, the upper two rows will be pushed too far apart. Is there a possibility to center equation (3) like above, without affecting this distance? – Jan Mar 7 '15 at 21:40
  • @Jan See the update. You need to use \mathclap versions for that. – user11232 Mar 7 '15 at 23:15
2

One way is to remove that spacing with

\vspace*{\dimexpr-\abovedisplayshortskip-\belowdisplayskip-\belowdisplayshortskip\relax}

The second align is better to be replaced by equation.

MWE:

\documentclass[a4paper]{article}
\usepackage{amsmath}

\begin{document}
    \begin{align}
        x1&=y1  &       a1&=b1 \label{eq:a} \\
        x2&=y2  &       a2&=b2 \label{eq:b}
    \end{align}
    \vspace*{\dimexpr-\abovedisplayshortskip-\belowdisplayskip-\belowdisplayshortskip\relax}
    \begin{equation}
    \begin{split}
        x3=y3 \\
        a3=b3
        \label{eq:c}
    \end{split}
    \end{equation}
\end{document} 

enter image description here

  • That looks beautiful, thank you very much. Can you tell me why I should use the equation environment? – Jan Mar 7 '15 at 12:58
  • @Jan align is needed only when you have to align something, which is not this case. In cases where you haven't to align anything, equation is the right choice. – karlkoeller Mar 7 '15 at 13:02
  • if this happens to come at the end of a page, i believe the separate equation would be quite able to split to a new page, which isn't desirable. – barbara beeton Mar 7 '15 at 16:14

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.