When averaged over large scales, star formation in galaxies is observed to follow the empirical Kennicutt-Schmidt (KS) law for surface densities above a constant threshold. While the observed law involves surface densities, theoretical models and simulations generally work with volume density laws (i.e. Schmidt laws). We derive analytic relations between star formation laws expressed in terms of surface densities, volume densities, and pressures and we show how these relations depend on parameters such as the effective equation of state of the multiphase interstellar medium. Our analytic relations enable us to implement observed surface density laws into simulations. Because the parameters of our prescription for star formation are observables, we are not free to tune them to match the observations. We test our theoretical framework using high-resolution simulations of isolated disc galaxies that assume an effective equation of state for the multiphase interstellar medium. We are able to reproduce the star formation threshold and both the slope and the normalisation of arbitrary input KS laws without tuning any parameters and with very little scatter, even for unstable galaxies and even if we use poor numerical resolution. Moreover, we can do so for arbitrary effective equations of state. Our prescription therefore enables simulations of galaxies to bypass our current inability to simulate the formation of stars. On the other hand, the fact that we can reproduce arbitrary input thresholds and KS laws, rather than just the particular ones picked out by nature, indicates that simulations that lack the physics and/or resolution to simulate the multiphase interstellar medium can only provide limited insight into the origin of the observed star formation laws.