Theory of the gliding-anchoring phase transition in a lyotropic liquid crystal