add test cases for #166

let's make sure that particularly freaky, "LaTeX omelette" bug doesn't
happen again