The finite-size energy spectrum of the anisotropic Heisenberg chain in an external magnetic field is calculated for free and twisted boundary conditions. As with periodic boundary conditions, it is found that the spectra exhibit non-analytical terms which do not fit into the form predicted on the basis of conformal invariance unless extra commensurability conditions between the size of the system and the external field are introduced. Taking these conditions into account some scaling dimensions for associated models are derived.