Fixed bugs introducd by merging PR #2732.

Printing of vectors and dyadics were broken when PR #2732 was merged due to
some missing imports. There were no tests for this, so I've added a couple for
pretty printing. I have some tests for latex printing in PR #2772 that has not
been merged yet.