Correctly handle nested lists in the motion PDF

See #1217