# Is the number of columns in align environment restricted?

I am using align environment to write First order conditions for Lagrangian.

This is how my code looks like:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{derivative}

\begin{document}

\begin{gather}
\begin{align}
&\left[u_t\right]: &\pdv{\mathcal{L}}{u_t} = 0 &\Rightarrow \theta^t \left[ R_t^k \overline{K}_t - \gamma^\prime (u_t)\overline{K}_t P_t^i \right] = 0  \nonumber \\
&&&\Rightarrow R_t^k = \gamma^\prime\left(u_t\right) P_t^i  \\
&\left[I_t\right]: &\pdv{\mathcal{L}}{I_t} = 0 &\Rightarrow \theta^t \left[ -P_t^i + \lambda_t  \left( 1- \tilde{S} \left(\frac{I_t}{I_{t-1}} \right) + I_t \left(- \tilde{S}^\prime \left(\frac{I_t}{I_{t-1}} \right) \frac{1}{I_{t-1}} \right) \right)\right] \nonumber  \\
&&&+ \theta^{t+1} E_t \left[ \lambda_{t+1} I_{t+1} \left( -\tilde{S}^\prime \left( \frac{I_{t+1}}{I_t} \right) \frac{I_{t+1}}{I_t^2} (-1)\right) \right] = 0 \nonumber \\
&&&\Rightarrow P_t^i = \lambda_t \left( - \tilde{S} \left( \frac{I_t}{I_{t-1}} \right) - \tilde{S}^\prime \left( \frac{I_t}{I_{t-1}} \right) \frac{I_t}{I_{t-1}} \right)
\end{align}
\end{gather}

\end{document}


In the sample above i have 3 columns in align environment. The only thin I would like to do is to align + sign on the forth line with $\theta^t$ on the third line. For this, I am adding the forth column by adding & on every line. However, what happens is that everything aligns on the left hand side like this:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{derivative}

\begin{document}

\begin{gather}
\begin{align}
&\left[u_t\right]: &\pdv{\mathcal{L}}{u_t} = 0 &\Rightarrow &\theta^t \left[ R_t^k \overline{K}_t - \gamma^\prime (u_t)\overline{K}_t P_t^i \right] = 0  \nonumber \\
&&&\Rightarrow &R_t^k = \gamma^\prime\left(u_t\right) P_t^i  \\
&\left[I_t\right]: &\pdv{\mathcal{L}}{I_t} = 0 &\Rightarrow &\theta^t \left[ -P_t^i + \lambda_t  \left( 1- \tilde{S} \left(\frac{I_t}{I_{t-1}} \right) + I_t \left(- \tilde{S}^\prime \left(\frac{I_t}{I_{t-1}} \right) \frac{1}{I_{t-1}} \right) \right)\right] \nonumber  \\
&&&&+ \theta^{t+1} E_t \left[ \lambda_{t+1} I_{t+1} \left( -\tilde{S}^\prime \left( \frac{I_{t+1}}{I_t} \right) \frac{I_{t+1}}{I_t^2} (-1)\right) \right] = 0 \nonumber \\
&&&\Rightarrow &P_t^i = \lambda_t \left( - \tilde{S} \left( \frac{I_t}{I_{t-1}} \right) - \tilde{S}^\prime \left( \frac{I_t}{I_{t-1}} \right) \frac{I_t}{I_{t-1}} \right)
\end{align}
\end{gather}

\end{document}


I am really confused why does align do this. It seems to me I am doing everything well. Is a way to have + on the third align aligned with $\theta^t$ and have all the equations centered at the same time.

I have tried all possible combinations for the last 2 hours but could not find any solution. So, would be grateful if more advanced and experienced user of align environment suggested his/her solution.

Update: It seems that I solved the problem by removing & from the beginning of each line, but the it looks still not elegant. It seems align environment aligns each part of the line to the left with each column. Is there a way to align in the center of each column?

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{derivative}

\begin{document}

\begin{gather}
\begin{align}
\left[u_t\right]: &\pdv{\mathcal{L}}{u_t} = 0 &\Rightarrow &\theta^t \left[ R_t^k \overline{K}_t - \gamma^\prime (u_t)\overline{K}_t P_t^i \right] = 0  \nonumber \\
&&\Rightarrow &R_t^k = \gamma^\prime\left(u_t\right) P_t^i  \\
\left[I_t\right]: &\pdv{\mathcal{L}}{I_t} = 0 &\Rightarrow &\theta^t \left[ -P_t^i + \lambda_t  \left( 1- \tilde{S} \left(\frac{I_t}{I_{t-1}} \right) + I_t \left(- \tilde{S}^\prime \left(\frac{I_t}{I_{t-1}} \right) \frac{1}{I_{t-1}} \right) \right)\right] \nonumber  \\
&&&+ \theta^{t+1} E_t \left[ \lambda_{t+1} I_{t+1} \left( -\tilde{S}^\prime \left( \frac{I_{t+1}}{I_t} \right) \frac{I_{t+1}}{I_t^2} (-1)\right) \right] = 0 \nonumber \\
&&\Rightarrow &P_t^i = \lambda_t \left( - \tilde{S} \left( \frac{I_t}{I_{t-1}} \right) - \tilde{S}^\prime \left( \frac{I_t}{I_{t-1}} \right) \frac{I_t}{I_{t-1}} \right)
\end{align}
\end{gather}

\end{document} • align (why are you wrapping it in gather?) is designed to work with pairs of columns aligning left and right so two equations on the same line use a&=b & c&=d\\  so four columns. May 20, 2020 at 11:57
• I am using gather in order to have each part of the line in the center of the corresponding column. or at least, thinking to be using for this purpose.
– G.T.
May 20, 2020 at 12:00
• I get undefined control sequence \pdv on your example May 20, 2020 at 12:00
• I am editing the code now. \pdv comes from \usepackage{derivative}
– G.T.
May 20, 2020 at 12:02
• Try it now. It should work now.
– G.T.
May 20, 2020 at 12:03

I think you need only one column of & alignment points. Observe the use of explicit parenthesis-sizing instructions and of \mleft and \mright in lieu of \left and \right; they serve mainly to conserve on horizontal whitespace.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,mleftright,derivative}

\begin{document}
\begin{align}
&\Rightarrow \theta^t \bigl[ R_t^k \overline{K}_t -
\gamma'(u_t)\overline{K}_t P_t^i \, \bigr] = 0  \nonumber \\
&\Rightarrow R_t^k = \gamma'(u_t) P_t^i  \\
&\Rightarrow \theta^t \biggl\{ -P_t^i + \lambda_t
\mleft[ 1- \tilde{S} \Bigl(\frac{I_t}{I_{t-1}} \Bigr) + I_t
\mleft(- \tilde{S}'\Bigl(\frac{I_t}{I_{t-1}} \Bigr) \frac{1}{I_{t-1}} \mright)
\mright]\biggr\} \nonumber  \\
&\qquad + \theta^{t+1} E_t \biggl[ \lambda_{t+1} I_{t+1}
\mleft( -\tilde{S}'\Bigl( \frac{I_{t+1}}{I_t} \Bigr)
\frac{I_{t+1}}{I_t^2} (-1)\mright) \biggr] = 0 \nonumber \\
&\Rightarrow P_t^i = \lambda_t \mleft[ - \tilde{S}
\Bigl( \frac{I_t}{I_{t-1}} \Bigr) -
\tilde{S}'\Bigl( \frac{I_t}{I_{t-1}} \Bigr) \frac{I_t}{I_{t-1}} \mright]
\end{align}
\end{document}

• Thanks. Is it possible to center second and forth line after \Rightarrow? That would be the most elegant and cool-looking.
– G.T.
May 20, 2020 at 12:35
• And why do u use sometimes \Bigg[ and sometimes \mright[? Is not it better to be consistent and use one of them all the time?
– G.T.
May 20, 2020 at 12:38
• @G.T. - To be completely open, I began by replacing \left and \right with \mleft and \mright. I then downsized several pairs of parentheses by using \Bigl and \Bigr. I suppose the task of making everything consistent -- by replacing the remaining instances of \mleft and \mright with \biggl and \biggr, right? -- is left as an exercise for the reader. :-) If one were to center the 2nd line, I suspect it would simply "disappear", visually speaking. BTW, for me to judge what's cool, I should have some understanding of the meaning of these equations -- which I sadly do not.
– Mico
May 20, 2020 at 13:09