Theory of the field-induced gap in $S=1/2$ antiferromagnetic chains