  The `directly Hamiltonian' field theory in the extended phase space is
applied to gauge fields in curved spacetime background. These fields being
differential 1-forms, have canonical momenta which are 2-forms. The
Poincare-Cartan 4-forms for matter and gauge fields have to be modified with
the exterior derivatives replaced by the covariant derivative for maintaining
gauge invariance.
