Clean up math in compact layout.