Escape special characters in to_latex()
Merge pull request #5374 from bjornarneson/patch-1

Escape special characters in to_latex() output