improved logic for pretty printing text symbols