Align Environment Part 2: Narrow the Gap

  • Context: MHB 
  • Thread starter Thread starter Dustinsfl
  • Start date Start date
Click For Summary
SUMMARY

This discussion focuses on narrowing the gap between items in LaTeX align environments, specifically addressing the use of the align and alignat environments. The standard method to align columns involves using two '&' symbols for each column, resulting in 2n - 1 '&' symbols for n columns. The alignat environment is recommended for better control over spacing, allowing users to specify the number of columns and eliminate unwanted spacing between them. The use of \quad for explicit spacing is also highlighted as a useful technique.

PREREQUISITES
  • Familiarity with LaTeX typesetting
  • Understanding of mathematical environments in LaTeX
  • Knowledge of the align and alignat environments
  • Basic experience with LaTeX spacing commands
NEXT STEPS
  • Explore advanced LaTeX typesetting techniques
  • Learn about the differences between align and alignat environments
  • Research LaTeX spacing commands for fine-tuning document layouts
  • Practice creating complex mathematical documents in LaTeX
USEFUL FOR

Mathematicians, researchers, and anyone involved in typesetting complex mathematical documents using LaTeX.

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.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 101 ·
4
Replies
101
Views
10K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 3 ·
Replies
3
Views
3K