Variational principles in thermo- and magneto-elasticity