On Landau-Lifshitz's derivation of four-momentum I'm studying the ninth section of The Classical Theory of Fields by Landau & Lifshitz, where they introduce four-momentum through the principle of least action.
I can understand the derivation until the point in which they say (I'll use Greek indices instead of the Latin ones in the book)
\begin{equation*}
\delta S=-mc\eta_{\mu\nu}u^\nu\delta x^\mu. \tag{9.11}
\end{equation*}
Now, here's my doubt: I know that
\begin{equation*}
\delta S=\frac{\partial S}{\partial x^\mu}\delta x^\mu,
\end{equation*}
from which we obtain that
\begin{equation*}
\frac{\partial S}{\partial x^\mu}=-mc u_\mu,
\end{equation*}
but now L&L say that
\begin{equation*}
p_\mu~=~\color{red}{-}\frac{\partial S}{\partial x^\mu}  \tag{9.12}
\end{equation*}
is the four-momentum.
In their Mechanics book, however, canonical momentum is derived from the action as
\begin{equation*}
p_i~=~\color{red}{+}\frac{\partial S}{\partial q^i}, \tag{43.3}
\end{equation*}
so where does that minus sign come from? I thought that the canonical coordinates $q^i$ corresponded to the contravariant spacetime $x^\mu$ coordinates, i.e. $(ct,q^1,q^2,q^3)\leftrightarrow(x^0,x^1,x^2,x^3)$.
This would mean that
\begin{equation*}
\frac{\partial S}{\partial t}=c\frac{\partial S}{\partial x^0}
\quad\text{and}\quad
\frac{\partial S}{\partial q^i}=\frac{\partial S}{\partial x^i}
\quad
(i=1,2,3)
\end{equation*}
but this means that my results have a wrong sign.
So I ask you, where is my error?
 A: TL;DR: The minus sign comes from the Minkowski sign conventions.

*

*Ref. 1 uses only the Minkowski signature convention $(+, -, -, -)$, but we shall show both conventions for reference/clarity. Let us also put $c=1$ for simplicity. Ref. 1 defines the metric tensor
$$ g_{\mu\nu}~=~{\rm diag} (\mp 1, \pm 1, \pm 1, \pm 1) ,\tag{6.5} $$
the $4$-velocity
$$ u^{\mu}~:=~\frac{dx^{\mu}}{d\tau}~=~\gamma\frac{dx^{\mu}}{dt}, \qquad  \frac{dx^{\mu}}{dt}~=~(1,{\bf v}), \tag{7.1/2} $$
$$ \frac{d\tau}{dt}~=~\frac{1}{\gamma}
~=~\sqrt{ \mp g_{\mu\nu}\frac{dx^{\mu}}{dt}\frac{dx^{\nu}}{dt} }
~=~\sqrt{1-v^2}, \tag{7.1b} $$
the off-shell action functional
$$\begin{align} S[x]~=~&\int_{t_i}^{t_f} \! dt~ L\cr
~=~& -m_0\int_{\lambda_i}^{\lambda_f} \! d\lambda~\sqrt{ \mp g_{\mu\nu}\frac{dx^{\mu}}{d\lambda}\frac{dx^{\nu}}{d\lambda} }\cr  
~=~&-m_0 \Delta \tau, \cr 
\Delta \tau~:=~&\tau_f-\tau_i,\end{align}\tag{8.1} $$
and the Lagrangian
$$ L~=~-\frac{m_0}{\gamma}.  \tag{8.2} $$
We should point out that the overall normalization of the Lagrangian (8.2) is not arbitrary, but follows from the need to reproduce the correct non-relativistic formula
$$L~=~\frac{1}{2}m_0v^2 -(\text{rest energy})+ {\cal O}(v^4)\qquad\text{for}\qquad v~:=~|{\bf v}|~\ll~ 1. $$


*Ref. 1 concludes that the Dirichlet on-shell action function $S(x_f,x_i)$ satisfies
$$\begin{align} \delta S  
~\stackrel{(8.1)}{=}~~~&
\pm  m_0\int_{\lambda_i}^{\lambda_f} \! d\lambda~\frac{g_{\mu\nu}\frac{dx^{\mu}}{d\lambda}\frac{d\delta x^{\nu}}{d\lambda}}{\sqrt{ \mp g_{\rho\sigma}\frac{dx^{\rho}}{d\lambda}\frac{dx^{\sigma}}{d\lambda} }}\cr
~=~~~~&\pm  m_0\int_{t_i}^{t_f} \! dt~u_{\mu}\frac{d\delta x^{\mu}}{dt}  \cr
~\stackrel{\text{int. by parts}}{=}&
\pm m_0 \left[ u_{\mu} ~ \delta x^{\mu}\right]_{t=t_i}^{t=t_f}
~\mp  m_0\int_{t_i}^{t_f} \! dt~\underbrace{\frac{du_{\mu}}{dt}}_{\text{EOM}}~ \delta x^{\mu} \tag{9.10} \cr
~\stackrel{\text{EOM}}{\approx}~~&\pm m_0 \left( u_{\mu}^f ~ \delta x^{\mu}_f - u_{\mu}^i  ~\delta x^{\mu}_i\right), \tag{9.11} \cr 
u_{\mu}~:=~~~~&g_{\mu\nu} u^{\nu}, \end{align} $$
cf. e.g. my Phys.SE answers here & here. [Here the $\approx$ symbol means equality modulo EOM. The words on-shell and off-shell refer to whether EOM are satisfied or not.]


*Up until now there has been no room for different conventions. At this point Ref. 1 chooses the contravariant $4$-momentum to be
$$ (E,{\bf p}) ~=~p^{\mu}~=~m_0 u^{\mu}, \tag{9.13/14}$$
which means that the covariant $4$-momentum then reads
$$ (\mp E,\pm {\bf p}) ~=~p_{\mu}~=~m_0 u_{\mu}. $$


*For eqs. (9.11) & (9.13/14) to both hold, we then have to define
$$ {\bf p}~:=~ \frac{\partial L}{\partial {\bf v}},\tag{9.1} $$
$$ p^f_{\mu}~:=~\color{red}{\pm} \frac{\partial S}{\partial x^{\mu}_f}, \tag{9.12}$$
$$ p^i_{\mu}~:=~\mp \frac{\partial S}{\partial x^{\mu}_i}. $$
References:

*

*L.D. Landau & E.M. Lifshitz, Vol.2, The Classical Theory of Fields, $\S$9.

