[Tex/LaTex] Subequations inside align result in too wide equation

alignhorizontal alignmentsubequations

I want to create subequations and allign them such that nice 'inquality constraints' arise. My current code:

\begin{subequations}
\begin{align}
a & \le b & \le c \label{eq:constr1}\\
d & \le effff & \le f \label{eq:constr1}\\
\end{align}
\label{eq:constr}%
\end{subequations}

The result in PDF is a much too large distance between "b and c" and "efffff and f". I would like to have \le exactly below eachother. Have b and effff centered between those. Finally a and d should be right aligned to the \le and c and f should be left aligned to the \le.

Best Answer

If you want the middle column to be centered than you need to either resort to using a \makebox to reserve enough width for that column, which requires knowing what the widest element is beforehand, or to use an array:

enter image description here

Notes

  • The alignat provides pairs of rl aligned equations. Since we want the third column to be left aligned, we need to use a && to skip past the prior column that would have been right aligned.
  • For the array solution we need to use {} to make the inequality symbols be treated as relational operators, similar to the difference in spacing of $-x$ and ${}-x$.
  • The calc package was used for the \widthof{} macro, so is only required for the alignat solution.
  • As Qrrbrbirlbel commented, you could make use of the array package and incorporate the required {} into the column specification, as shown in the last example in the code below.

Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{calc}
\usepackage{array}

\newcommand*{\Widest}{effff}%
\newcommand*{\WideAs}[1]{\makebox[\widthof{$\Widest$}][c]{$#1$}}%
\begin{document}\noindent
You can use \verb|alignat|:
%
\begin{alignat*}{3}
    a & \le \WideAs{b}     && \le c \\
    d & \le \WideAs{effff} && \le f 
\end{alignat*}
%
Or use \verb|array|:
%
\[\begin{array}{r@{}c@{}l}
    a \le {}& b     &{} \le c \\
    d \le {}& effff &{} \le f 
\end{array}\]
%
Alternatively using the \verb|array| package:
\[\begin{array}{r<{{}}@{}c@{}>{{}}l}
    a \le & b     & \le c \\
    d \le & effff & \le f 
\end{array}\]
\end{document}
Related Question