A variational framework is defined for vertical slice models with three dimensional velocity depending only on x and z. The models that result from this framework are Hamiltonian, and have a Kelvin-Noether circulation theorem that results in a conserved potential vorticity in the slice geometry. These results are demonstrated for the incompressible Euler--Boussinesq equations with a constant temperature gradient in the $y$-direction (the Eady--Boussinesq model), which is an idealised problem used to study the formation and subsequent evolution of weather fronts. We then introduce a new compressible extension of this model. Unlike the incompressible model, the compressible model does not produce solutions that are also solutions of the three-dimensional equations, but it does reduce to the Eady--Boussinesq model in the low Mach number limit. This means that this new model can be used in asymptotic limit error testing for compressible weather models running in a vertical slice configuration.