Align Environment Part 2: Narrow the Gap

  • Context:
  • Thread starter Thread starter Dustinsfl
  • Start date Start date
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 2K views
Dustinsfl
Messages
2,217
Reaction score
5
\begin{align}
\tau = k_1e_0t, & u = \frac{s}{s_0}, & v_1 = \frac{c_1}{e_0}, & v_2 = \frac{c_2}{e_0},\notag\\
a_1 = \frac{k_{-1}}{k_1s_0}, & a_2 = \frac{k_2}{k_1s0}, & a_3 = \frac{k_3}{k_1}, & a_4 = \frac{k_{-3}}{k_1s_0},\notag\\
a_5 = \frac{k_4}{k_1s_0}, & \epsilon = \frac{e_0}{s_0}, & & \notag
\end{align}

How can I narrow the gap between the 2nd and 3rd items? The gap is a lot worse in a pdf compared to on the forum too.
 
Physics news on Phys.org
The standard way is to use two &'s for each column: one before = to align each column on equalities and one between columns. Thus, an environment with n column has 2n - 1 &'s in every line.

\begin{align*}
\tau &= k_1e_0t, & u &= \frac{s}{s_0}, & v_1 &= \frac{c_1}{e_0}, & v_2 &= \frac{c_2}{e_0},\notag\\
a_1 &= \frac{k_{-1}}{k_1s_0}, & a_2 &= \frac{k_2}{k_1s0}, & a_3 &= \frac{k_3}{k_1}, & a_4 &= \frac{k_{-3}}{k_1s_0},\notag\\
a_5 &= \frac{k_4}{k_1s_0}, & \epsilon &= \frac{e_0}{s_0}
\end{align*}

To control the spacing between columns, use the alignat environment, which accepts an argument specifying the number of columns. Then the spacing between columns is eliminated. You can therefore specify spacing explicitly using \quad, etc.

\begin{alignat*}{4}
\tau &= k_1e_0t, & u &= \frac{s}{s_0}, & v_1 &= \frac{c_1}{e_0}, & v_2 &= \frac{c_2}{e_0},\notag\\
a_1 &= \frac{k_{-1}}{k_1s_0}, &\quad a_2 &= \frac{k_2}{k_1s0}, &\quad a_3 &= \frac{k_3}{k_1}, &\quad a_4 &= \frac{k_{-3}}{k_1s_0},\notag\\
a_5 &= \frac{k_4}{k_1s_0}, & \epsilon &= \frac{e_0}{s_0}
\end{alignat*}
 
I like the alignat* feature.