Preparation by reacting sulfur or a sulfur compound with a hydrocarbon