Correctly handle nested lists in the motion PDF

See also #1217