Search code examples
latexalignment

Latex alignat syntax


To align several equations in Latex, I write a code like this:

\begin{alignat*}{7}
    d &= \frac{1}{1 + 0.2316419x} & \quad & a_1 &= 0.31938153 & \quad & a_2 &= -0.356563782 \\
    a_3 &= 1.781477937 & \quad & a_4 &= -1.821255978 & \quad & a_5 &= 1.330274429
\end{alignat*}

And I got something like this. What I got

I don't understand why there is a space between a_1 and '='. Could you please tell me how to eliminate that space ? Thank you for your time.


Solution

  • You can use the following approach:

    \begin{alignat*}{3}
        & d   = \frac{1}{1 + 0.2316419x}  \quad && a_1  = 0.31938153   \quad && a_2 = -0.356563782 \\
        & a_3 = 1.781477937               \quad && a_4  = -1.821255978 \quad && a_5 = 1.330274429
    \end{alignat*}
    

    that results into:

    enter image description here