Using phantom in align environment

  • 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
3 replies · 3K views
Dustinsfl
Messages
2,217
Reaction score
5
The extra align row at the top contributes a lot of white space but I need phantom equal at spacing of a previous align above it. How can I keep the spacing but remove the white space gap?
Code:
\begin{alignat*}{3}
\phantom{\sigma_1:} & \phantom{\begin{bmatrix}
3 - \sigma_1 & -10 & 0\\
-10 & 0 - \sigma_1 & 30\\
0 & 30 & -27 - \sigma_1
\end{bmatrix}} & \phantom{=} &\phantom{\begin{bmatrix}
3 + 47 & -10 & 0\\
-10 & 47 & 30\\
0 & 30 & -27 + 47
\end{bmatrix}}\\
\sigma_3: & \begin{bmatrix}
3 - \sigma_3 & -10 & 0\\
-10 & 0 - \sigma_3 & 30\\
0 & 30 & -27 - \sigma_3
\end{bmatrix} & = & \begin{bmatrix}
3 - 23 & -10 & 0\\
-10 & -23 & 30\\
0 & 30 & -27 - 23
\end{bmatrix}\\
 & & = & \begin{bmatrix}
-20 & -10 & 0\\
-10 & -23 & 30\\
0 & 30 & -50
\end{bmatrix}\\
 & & = & \begin{bmatrix}
-2 & -1 & 0\\
-10 & -23 & 30\\
0 & 3 & -5
\end{bmatrix}\\
 & & = & \begin{bmatrix}
-2 & -1 & 0\\
0 & -18 & 30\\
0 & 3 & -5
\end{bmatrix}\\
 & & = & \begin{bmatrix}
-2 & -1 & 0\\
0 & -3 & 5\\
0 & 3 & -5
\end{bmatrix}\\
 & & = & \begin{bmatrix}
-2 & -1 & 0\\
0 & -3 & 5\\
0 & 0 & 0
\end{bmatrix}\\
\end{alignat*}
 
Physics news on Phys.org
I would use the aligned environment rather than alignat*.
Code:
\begin{aligned}
\sigma_3: \begin{bmatrix}3 - \sigma_3 & -10 & 0 \\-10 & 0 - \sigma_3 & 30 \\ 0 & 30 & -27 - \sigma_3 \end{bmatrix} 
& = \begin{bmatrix}3 - 23 & -10 & 0 \\-10 & -23 & 30 \\0 & 30 & -27 - 23\end{bmatrix} \\ 
& = \begin{bmatrix}-20 & -10 & 0 \\-10 & -23 & 30 \\0 & 30 & -50\end{bmatrix} \\ 
& = \begin{bmatrix}-2 & -1 & 0 \\-10 & -23 & 30 \\0 & 3 & -5\end{bmatrix} \\
& = \begin{bmatrix}-2 & -1 & 0 \\0 & -18 & 30 \\0 & 3 & -5\end{bmatrix} \\
& = \begin{bmatrix}-2 & -1 & 0 \\0 & -3 & 5 \\0 & 3 & -5\end{bmatrix} \\
& = \begin{bmatrix}-2 & -1 & 0 \\0 & -3 & 5 \\0 & 0 & 0\end{bmatrix} \\ 
\end{aligned}
That produces $$\begin{aligned}\sigma_3: \begin{bmatrix}3 - \sigma_3 & -10 & 0 \\-10 & 0 - \sigma_3 & 30 \\ 0 & 30 & -27 - \sigma_3
\end{bmatrix} & = \begin{bmatrix}3 - 23 & -10 & 0 \\-10 & -23 & 30 \\0 & 30 & -27 - 23\end{bmatrix} \\ & = \begin{bmatrix}-20 & -10 & 0 \\-10 & -23 & 30 \\0 & 30 & -50\end{bmatrix} \\ & = \begin{bmatrix}-2 & -1 & 0 \\-10 & -23 & 30 \\0 & 3 & -5\end{bmatrix} \\& = \begin{bmatrix}-2 & -1 & 0 \\0 & -18 & 30 \\0 & 3 & -5\end{bmatrix} \\& = \begin{bmatrix}-2 & -1 & 0 \\0 & -3 & 5 \\0 & 3 & -5\end{bmatrix} \\& = \begin{bmatrix}-2 & -1 & 0 \\0 & -3 & 5 \\0 & 0 & 0\end{bmatrix} \\ \end{aligned}$$

Edit. If you want the left side of the top row to occupy the same space as $\sigma_1: \begin{bmatrix}3 - \sigma_1 & -10 & 0 \\ -10 & 0 - \sigma_1 & 30\\0 & 30 & -27 - \sigma_1 \end{bmatrix}$ then (in the above code) you can replace
Code:
\sigma_3: \begin{bmatrix}3 - \sigma_3 & -10 & 0 \\-10 & 0 - \sigma_3 & 30 \\ 0 & 30 & -27 - \sigma_3 \end{bmatrix}
by
Code:
\phantom{\sigma_1: \begin{bmatrix}3 - \sigma_1 & -10 & 0 \\-10 & 0 - \sigma_1 & 30 \\0 & 30 & -27 - \sigma_1 \end{bmatrix}}
 \llap{$\sigma_3: \begin{bmatrix}3 - \sigma_3 & -10 & 0 \\-10 & 0 - \sigma_3 & 30 \\ 0 & 30 & -27 - \sigma_3 \end{bmatrix}$}
That material will be aligned close to the $=$ sign, without unwanted white space.
 
Last edited:
Opalg said:
I would use the aligned environment rather than alignat*.
Code:
\begin{aligned}
\sigma_3: \begin{bmatrix}3 - \sigma_3 & -10 & 0 \\-10 & 0 - \sigma_3 & 30 \\ 0 & 30 & -27 - \sigma_3 \end{bmatrix} 
& = \begin{bmatrix}3 - 23 & -10 & 0 \\-10 & -23 & 30 \\0 & 30 & -27 - 23\end{bmatrix} \\ 
& = \begin{bmatrix}-20 & -10 & 0 \\-10 & -23 & 30 \\0 & 30 & -50\end{bmatrix} \\ 
& = \begin{bmatrix}-2 & -1 & 0 \\-10 & -23 & 30 \\0 & 3 & -5\end{bmatrix} \\
& = \begin{bmatrix}-2 & -1 & 0 \\0 & -18 & 30 \\0 & 3 & -5\end{bmatrix} \\
& = \begin{bmatrix}-2 & -1 & 0 \\0 & -3 & 5 \\0 & 3 & -5\end{bmatrix} \\
& = \begin{bmatrix}-2 & -1 & 0 \\0 & -3 & 5 \\0 & 0 & 0\end{bmatrix} \\ 
\end{aligned}
That produces $$\begin{aligned}\sigma_3: \begin{bmatrix}3 - \sigma_3 & -10 & 0 \\-10 & 0 - \sigma_3 & 30 \\ 0 & 30 & -27 - \sigma_3
\end{bmatrix} & = \begin{bmatrix}3 - 23 & -10 & 0 \\-10 & -23 & 30 \\0 & 30 & -27 - 23\end{bmatrix} \\ & = \begin{bmatrix}-20 & -10 & 0 \\-10 & -23 & 30 \\0 & 30 & -50\end{bmatrix} \\ & = \begin{bmatrix}-2 & -1 & 0 \\-10 & -23 & 30 \\0 & 3 & -5\end{bmatrix} \\& = \begin{bmatrix}-2 & -1 & 0 \\0 & -18 & 30 \\0 & 3 & -5\end{bmatrix} \\& = \begin{bmatrix}-2 & -1 & 0 \\0 & -3 & 5 \\0 & 3 & -5\end{bmatrix} \\& = \begin{bmatrix}-2 & -1 & 0 \\0 & -3 & 5 \\0 & 0 & 0\end{bmatrix} \\ \end{aligned}$$

Edit. If you want the left side of the top row to occupy the same space as $\sigma_1: \begin{bmatrix}3 - \sigma_1 & -10 & 0 \\ -10 & 0 - \sigma_1 & 30\\0 & 30 & -27 - \sigma_1 \end{bmatrix}$ then (in the above code) you can replace
Code:
\sigma_3: \begin{bmatrix}3 - \sigma_3 & -10 & 0 \\-10 & 0 - \sigma_3 & 30 \\ 0 & 30 & -27 - \sigma_3 \end{bmatrix}
by
Code:
\phantom{\sigma_1: \begin{bmatrix}3 - \sigma_1 & -10 & 0 \\-10 & 0 - \sigma_1 & 30 \\0 & 30 & -27 - \sigma_1 \end{bmatrix}}
 \llap{$\sigma_3: \begin{bmatrix}3 - \sigma_3 & -10 & 0 \\-10 & 0 - \sigma_3 & 30 \\ 0 & 30 & -27 - \sigma_3 \end{bmatrix}$}
That material will be aligned close to the $=$ sign, without unwanted white space.


Thanks it did remove the white space, but it doesn't align correct then with the align environment above it.
 
The tabbing environment provides more direct control over where things align, and you can make them consistent even when interrupted by text in-between environments. See http://www.mathhelpboards.com/f26/possibly-tricky-alignment-problem-1493/. Also see http://www.mathhelpboards.com/f26/align*-environment-inside-tabbing-environment-2150/.