The density profile of a confined fluid