  The construction of gauge theories beyond the realm of Lie groups and
algebras leads one to consider Lie groupoids and algebroids equipped with
additional geometrical structures which, for gauge invariance of the
construction, need to satisfy particular compatibility conditions. This paper
analyzes these compatibilities from a mathematical perspective.
  In particular, we show that the compatibility of a connection with a Lie
algebroid that one finds is the Cartan condition, introduced previously by A.
Blaom. For the metric on the base M of a Lie algebroid equipped with any
connection, we show that the compatibility suggested from gauge theories
implies that the (possibly singular) foliation induced by the Lie algebroid
becomes a Riemannian foliation. Building upon a result of del Hoyo and
Fernandes, we prove furthermore that every Lie algebroid integrating to a
proper Lie groupoid admits a compatible Riemannian base. We also consider the
case where the base is equipped with a compatible symplectic or generalized
metric structure.
