allow (and discard) optional argument for \caption

Fixes #1335.