  We introduce a systematic framework to calculate the bipartite entanglement
entropy of a spatial subsystem in a one-dimensional quantum gas which can be
mapped into a noninteracting fermion system. To show the wide range of
applicability of the proposed formalism, we use it for the calculation of the
entanglement in the eigenstates of periodic systems, in a gas confined by
boundaries or external potentials, in junctions of quantum wires and in a
time-dependent parabolic potential.
