Chess number one Magnus Carlsen has quit a world championship event in New York after being fined and threatened with exclusion for breaching the dress code by wearing jeans.