citation2latex filter (using HTMLParser)

Finishing up #4323

Fixes #4251 and #4283.