Change 1^\mathsf{W} to 1^{\mathfs{W}} 

The superscript and subscript tokens don't behave quite like ordinary macros in that things like 1^\mathsf{W} works.  If ^ were a macro, which took one argument, this wouldn't work as the ^ would get \mathsf as its argument and the {W} would be left outside.  Changing this to 1^{\mathsf{W}} makes no difference to the final typeset material but does mean that it is possible to make ^ into a macro, which is necessary for conversion to ePub.