(Qmechanic has already given the answer. However since i spent some time writing the answer below so i am anyway posting it)
Consider charged particle with charge $q$, and (nonzero) rest mass $m$ moving in a spacetime with coordinates $(x^0,x^1,...,x^{n-1})$. When there is no electromagnetic field then the action of particle is given as
$\tag {1} S=-mc\displaystyle\int \sqrt {\eta_{\mu\nu}\dot x^\mu(\lambda)\dot x^\nu(\lambda)}d\lambda$
Where $\lambda$ is the parameter along the trajectory $x^{\mu}(\lambda)$ of the particle and $\dot x^{\mu}$ means $\partial x^{\mu}(\lambda)/\partial\lambda$. Note that the action is Lorentz invariant. When there is a $U(1)$ gauge field $-iA_{\mu}dx^{\mu}$ then we can add one more Lorentz invariant term to this action to generalize it as :-
$\tag{2}S=-mc\displaystyle\int \sqrt {\eta_{\mu\nu}\dot x^\mu (\lambda)\dot x^\nu (\lambda)}d\lambda-(q/c)\displaystyle\int \eta_{\mu\nu}A^{\mu}\dot x^{\mu}(\lambda)d\lambda$
Now in order to proceed its convenient to work in a particular inertial frame, and look at things from the viewpoint of inertial observer corresponding to that frame. In such a frame we can take $x^0(\lambda)/c=t=\lambda$. Above integral was from some point $\lambda_{0}$ to some $\lambda_{1}$. Now it becomes an integral from $t_0=x^0(\lambda_0)/c$ to $t_1=x^0(\lambda_1)/c$ and can be written as
$\tag{3} S=-mc^2\displaystyle\int \sqrt {1-v^2/c^2}dt-\displaystyle\int (qA^{0}-\frac {q}{c} \sum_{i}v^{i}.A^{i}) dt$
So
$\tag{4} L=-mc^2\sqrt {1-v^2/c^2}- (qA^{0}-\displaystyle \frac {q}{c} \sum_{i}v^{i}.A^{i})$
canonical momentum corresponding to $x^i$ can now be obtained as partial derivative of $L$ wrt $v^i=dx^i/dt$ and is given as :-
$\tag{5} \pi_i=mv^i/\sqrt {1-v^2/c^2}+\displaystyle\frac{q}{c}A^{i}$
Thus, as Qmechanic has answered, canonical momentum corresponding to $i$ th coordinate is physical momentum along that coordinate plus a contribution from gauge potential.
Even without chosing a particular inertial frame we could find the canonical momentum $\pi_{\mu}$ corresponding to $x^\mu$ by taking the derivative of $L$ in its covariant form wrt $\dot x^\mu$. This would give -
$\tag{6}\pi_{\mu}=-mc\eta_{\mu\nu}\dot x^{\nu}/\sqrt {\eta_{\alpha\beta}\dot x^\alpha\dot x^\beta}-\displaystyle\frac{q}{c}A_{\mu}$
Now in classical mechanics above equation is nothing but a map from velocity space to phase space. Its only when we move to QM that we represent canonical momentums as derivatives wrt spatial coordinates. Again for convenience lets work in a particular inertial frame. Here momentum conjugate to $x^i$ is $\pi_i$ as given by the equation [5]. So as usual in QM we quantize by requiring the corresponding operators to satisfy
$\tag{7}[ X^i,\Pi_j]=i\delta^i_{j}\hbar$
We can represent this algebra on Hilbert space of functions on space $R^{n-1}$ (note that spacetime is $R^n$) by defining $X^i$ to be the operator which acts as multiplication by $x^i$, and $\Pi_i$ to be the operator which acts as the derivative $-i\hbar\partial/\partial x^i$. From equation [5] we see that
$$\tag{8}mechanical\: momentum\: operator=-i\hbar\partial/\partial x^i-\displaystyle\frac{q}{c}A^{i}$$
Or taking $-i\hbar$ common we get
$$\tag{9}mechanical\: momentum\: operator=-i\hbar(\partial/\partial x^i-i\displaystyle\frac{q}{c\hbar}A^{i})=-i\hbar D_i$$
Where $D_i=\partial/\partial x^i-i\displaystyle\frac{q}{c\hbar}A^{i}$
This post imported from StackExchange Physics at 2015-03-30 13:52 (UTC), posted by SE-user user10001