We study the interplay of structural and polar distortions in hexagonal YMnO${}_{3}$ and short-period PbTiO${}_{3}$/SrTiO${}_{3}$ (PTO/STO) superlattices by means of first-principles calculations at constrained electric displacement field $D$. We find that in YMnO${}_{3}$ the tilts of the oxygen polyhedra produce a robustly polar ground state, which persists at any choice of the electrical boundary conditions. Conversely, in PTO/STO the antiferrodistortive instabilities alone do not break inversion symmetry, and open-circuit boundary conditions restore a nonpolar state. We suggest that this qualitative difference naturally provides a route to rationalizing the concept of ``improper ferroelectricity'' from the point of view of first-principles theory. We discuss the implications of our arguments for the design of novel multiferroic materials with enhanced functionalities and for the symmetry analysis of the phase transitions.