Packaged food companies are struggling to adjust — and profit — as tastes, waistlines and wallets change.