1

In this MWE, I need to preserve the equations alignment at both prescribed positions (i.e. equal signs and \text{}) while controlling the columns spacing (i.e. \qquad).

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\begin{document}

\begin{alignat}{2}
%
a &= 1 & \qquad &\text{in } \Omega\\
b &= 2 &&\text{on } \Gamma_1\\
%
\shortintertext{and}
%
\begin{alignedat}{2}
c &= 3 && \text{on } \Gamma_2\\
d &= 4 && \text{on } \Gamma_3\\
\end{alignedat}
%
\end{alignat}

\end{document}

enter image description here

2
  • 3
    Why are you nesting alignedat?
    – egreg
    Jun 27, 2018 at 21:12
  • @egreg I would like to (1) control the columns spacing in addition to (2) assigning a single equation number to a set of equations. So, that is the first solution came to my mind. You are welcome to enhance my answer as you wish.
    – Diaa
    Jun 27, 2018 at 21:15

1 Answer 1

1

More of a hack than a solution:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}

\begin{document}

\begin{alignat}{2}
%
a &= 1 & \quad &\text{in } \Omega\\
b &= 2 &&\text{on } \Gamma_1\\
%
\shortintertext{and}
%
\MoveEqLeft[-2.95]\mathclap{\begin{alignedat}{2}
c &= 3 &\qquad&\mkern2mu \text{on } \Gamma_2\\
d &= 4 && \mkern2mu\text{on } \Gamma_3
\end{alignedat}}
%
\end{alignat}

\end{document} 

enter image description here

Edit :

A somewhat neater solution consists in adding \notag for the last two alignments and an empty (numbered) alignment between these last two, compensating for the supplementary vertical spacing:

   \begin{alignat}{2}
    %
    a &= 1 & \quad &\text{in } Ω\\
    b &= 2 &&\text{on } \Gamma₁\\
    %
    \shortintertext{and}
       c &= 3 &&\text{on } \Gamma₂ \notag\\[-0.5\baselineskip]
        & \\[-0.5\baselineskip]
    d &= 4 && \text{on } \Gamma₃ \notag
    %
    \end{alignat}

enter image description here

1
  • The second edit is pretty nice but it will affect the equation display when clicking on its cross-reference in the text since it would display only the dummy equation and below not the whole set of equations.
    – Diaa
    Jun 27, 2018 at 23:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .