Use ~p not ~w to format "weird" terms so that we get sensible formatting of strings embedded within them.