Repaired latex expression and fixed bug

This merge request does two things:

 1. Repairs latex regular expression (the same repair fix has also been submitted to typogrify)
 2. Fixes the logic for ignoring things between `<code>` and `<pre>` tags.