The formation of solar prominences by magnetic reconnection and condensation