  Conformal field theories in curved backgrounds have been used to describe
inhomogeneous one-dimensional systems, such as quantum gases in trapping
potentials and non-equilibrium spin chains. This approach provided, in a
elegant and simple fashion, non-trivial analytic predictions for quantities,
such as the entanglement entropy, that are not accessible through other
methods. Here, we generalise this approach to low-lying excited states,
focusing on the entanglement and relative entropies in an inhomogeneous
free-fermionic system. Our most important finding is that the universal scaling
function characterising these entanglement measurements is the same as the one
for homogeneous systems, but expressed in terms of a different variable. This
new scaling variable is a non-trivial function of the subsystem length and
system's inhomogeneity that is easily written in terms of the curved metric. We
test our predictions against exact numerical calculations in the free Fermi gas
trapped by a harmonic potential, finding perfect agreement.
