Fixes to printing

This fixes issue 3354 (printing of Piecewise), and also offers a better fix to
issue 3260 (#1788, printing of powers of Integral).