  The transverse spatial structure of a paraxial beam of light is fully
characterized by a set of parameters that vary only slowly under free
propagation. They specify bosonic ladder operators that connect modes of
different order, in analogy to the ladder operators connecting
harmonic-oscillator wave functions. The parameter spaces underlying sets of
higher-order modes are isomorphic to the parameter space of the ladder
operators. We study the geometry of this space and the geometric phase that
arises from it. This phase constitutes the ultimate generalization of the Gouy
phase in paraxial wave optics. It reduces to the ordinary Gouy phase and the
geometric phase of non-astigmatic optical modes with orbital angular momentum
states in limiting cases. We briefly discuss the well-known analogy between
geometric phases and the Aharonov-Bohm effect, which provides some
complementary insights in the geometric nature and origin of the generalized
Gouy phase shift. Our method also applies to the quantum-mechanical description
of wave packets. It allows for obtaining complete sets of normalized solutions
of the Schr\"odinger equation. Cyclic transformations of such wave packets give
rise to a phase shift, which has a geometric interpretation in terms of the
other degrees of freedom involved.
