From 7be30a40f1d3c8a2441d618e3d2a0981a63f8846 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Tue, 17 May 2016 09:18:52 -0700
Subject: [PATCH] LaTeX writer: Don't escape underscore in labels.

Previously they were escaped as ux5f.

Closes #2921.
---
 src/Text/Pandoc/Writers/LaTeX.hs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 9284d18ee..be9fd7ad7 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -310,7 +310,7 @@ toLabel z = go `fmap` stringToLaTeX URLString z
  where go [] = ""
        go (x:xs)
          | (isLetter x || isDigit x) && isAscii x = x:go xs
-         | elem x ("-+=:;." :: String) = x:go xs
+         | elem x ("_-+=:;." :: String) = x:go xs
          | otherwise = "ux" ++ printf "%x" (ord x) ++ go xs
 
 -- | Puts contents into LaTeX command.