Intereting Posts

# Resetting alignment in the align environment

I have a few aligned lists of coefficients. One set of coefficients has three columns and the other has four. At the moment I display them with two align environments:

\begin{align}
\gamma_1 &= 8/15 & \gamma_2 &= 5/12   & \gamma_3 &= 3/4 \\
\zeta_1  &= 0    & \zeta_2  &= -17/60 & \zeta_3  &= -5/12 \\
\beta_1  &= 4/15 & \beta_2  &= 1/15   & \beta_3  &= 1/6
\end{align}
\begin{align}
a_0 &= 0 & a_1 &= 8/15 & a_2 &= 2/3 & a_3 &= 1
\end{align}


The alignment and spacing between elements in each row is exactly as I want but there is too much space between the three column coefficients and the four column coefficients. Essentially, I want the alignment to reset at a certain point so that the next line of the align environment has four columns and is centered.

I learned about the aligned environment as I searched for an answer. The question asked there is essentially what I am asking, but the code provided there does not do what I want. I have not successfully been able to produce code to do exactly what I want.

This is the closest I can get:

\begin{align}
\begin{aligned}
\gamma_1 &= 8/15 & \gamma_2 &= 5/12   & \gamma_3 &= 3/4 \\
\zeta_1  &= 0    & \zeta_2  &= -17/60 & \zeta_3  &= -5/12 \\
\beta_1  &= 4/15 & \beta_2  &= 1/15   & \beta_3  &= 1/6 \\
\end{aligned} \\
\begin{aligned}
a_0 &= 0 & a_1 &= 8/15 & a_2 &= 2/3 & a_3 &= 1
\end{aligned}
\end{align}


This has two problems:

1. The coefficients are compressed rather than expanded as they are with two aligns.
2. Each aligned environment has one equation number. I’d prefer to refer to each set of coefficients (gamma, zeta, beta, and a) directly.

Likely I could manipulate the spacing at the bottom and/or top of the align environment and use my original code, but that’s sloppy and I’m confident a simple way to do what I want exists but I’m not aware of it.

Also, the a0 and a3 coefficients are required to be 0 and 1 respectively by definition, so I can leave one out, but I want to include both of them for clarity.

#### Solutions Collecting From Web of "Resetting alignment in the align environment"

You can play around with columns to fool the alignment mechanism as:

\begin{align}
\gamma_1 &= 8/15 &&& \gamma_2&= 5/12         &&& \gamma_3 &= 3/4 &\\
\zeta_1  &= 0    &&& \zeta_2&= -17/60        &&& \zeta_3  &= -5/12& \\
\beta_1  &= 4/15 &&& \beta_2&= 1/15          &&& \beta_3  &= 1/6&\\
a_0 ={}&0      &&& a_1 = 8/15 && a_2 = 2/3 &&&\qquad a_3 = 1
\end{align}


but with all due respect, what you want to do, does not read well. I would have done something like the following

\begin{align}
\gamma_1 &= 8/15 & \gamma_2&= 5/12  & \gamma_3 &= 3/4 \\
\zeta_1  &= 0    & \zeta_2&= -17/60 & \zeta_3  &= -5/12 \\
\beta_1  &= 4/15 & \beta_2&= 1/15   & \beta_3  &= 1/6\\
a_0 &= 0    & a_1    &= 8/15   & a_2      &= 2/3 \\ \notag
&       & a_3    &= 1      &          &
\end{align}


You can deliberately put some vertical space between the first three and the last to highlight the grouping effect which is, in my opinion, more important in order to convey the message rather than to be able to command a LaTeX array.

For full control of the alignment you can use the alignat environment.

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}

\begin{document}
\begin{alignat}{4}
&          & \gamma_1  &= 8/15\qquad & \gamma_2 &= 5/12         & \gamma_3 &= 3/4 \\
&          & \zeta_1   &= 0          & \zeta_2  &= -17/60\qquad & \zeta_3  &= -5/12 \\
&          & \beta_1   &= 4/15       & \beta_2  &= 1/15         & \beta_3  &= 1/6 \\
a_0 &= 0\qquad & a_1       &= 8/15       & a_2      &= 2/3          & a_3      &= 1
\end{alignat}
\end{document}


Here is one viable alternative to your alignment issue:

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{align}
\gamma_1 &= 8/15 & \gamma_2 &= 5/12   & \gamma_3 &= 3/4 \\[\jot]
\zeta_1  &= 0    & \zeta_2  &= -17/60 & \zeta_3  &= -5/12 \\[\jot]
\beta_1  &= 4/15 & \beta_2  &= 1/15   & \beta_3  &= 1/6
\end{array}} \label{gammas} \\ \label{zetas} \\ \label{betas} \\
a_0 &= 0 & a_1 &= 8/15 & a_2 &= 2/3 & a_3 &= 1
\end{array} \label{as}
\end{align}
$\gamma$ is~\eqref{gammas}, $\zeta$ is~\eqref{zetas}, $\beta$ is~\eqref{betas} and $a$ is~\eqref{as}.
\end{document}​


The equation elements are placed inside an array. Proper vertical alignment is assured using \\[\jot], while horizontal adjustment is obtained via \qquad for the column spacing. Modify this to suit your need (to say \quad, or \hspace{<len>} where <len> is any known TeX length unit).

A very crude solution is to simply subtract some vertical space.

\begin{align}
\gamma_1 &= 8/15 & \gamma_2 &= 5/12   & \gamma_3 &= 3/4 \\
\zeta_1  &= 0    & \zeta_2  &= -17/60 & \zeta_3  &= -5/12 \\
\beta_1  &= 4/15 & \beta_2  &= 1/15   & \beta_3  &= 1/6
\end{align}
\vspace{-\belowdisplayskip}
\vspace{-\abovedisplayskip}
\vspace{-3\jot}
\begin{align}
a_0 &= 0 & a_1 &= 8/15 & a_2 &= 2/3 & a_3 &= 1
\end{align}


It’s not perfect though. Does anyone know what the separation between lines in align is?