diff --git a/Text/Highlighting/Kate/Format/HTML.hs b/Text/Highlighting/Kate/Format/HTML.hs
--- a/Text/Highlighting/Kate/Format/HTML.hs
+++ b/Text/Highlighting/Kate/Format/HTML.hs
@@ -89,10 +89,10 @@
                      $ H.pre
                      $ mapM_ lineNum [startNum..(startNum + length ls - 1)]
          lineNum n = if lineAnchors opts
-                        then (H.a ! A.id (toValue $ show n) $ toHtml $ show n)
+                        then (H.a ! A.id (toValue nStr) ! A.href (toValue $ "#" ++ nStr) $ toHtml $ show n)
                               >> toHtml "\n"
                         else toHtml $ show n ++ "\n"
-
+           where nStr = show n
 -- | Returns CSS for styling highlighted code according to the given style.
 styleToCss :: Style -> String
 styleToCss f = unlines $ tablespec ++ colorspec ++ map toCss (tokenStyles f)
diff --git a/Text/Highlighting/Kate/Format/LaTeX.hs b/Text/Highlighting/Kate/Format/LaTeX.hs
--- a/Text/Highlighting/Kate/Format/LaTeX.hs
+++ b/Text/Highlighting/Kate/Format/LaTeX.hs
@@ -42,6 +42,8 @@
         escapeLaTeXChar '{'  = "\\{"
         escapeLaTeXChar '}'  = "\\}"
         escapeLaTeXChar '|'  = "\\textbar{}" -- used in inline verbatim
+        escapeLaTeXChar '`'  = "{\\char18}"  -- otherwise will be curly
+        escapeLaTeXChar '\'' = "{\\char13}"  -- otherwise will be curly
         escapeLaTeXChar x    = [x]
 
 -- LaTeX
diff --git a/changelog b/changelog
--- a/changelog
+++ b/changelog
@@ -1,3 +1,13 @@
+highlighting-kate 0.5.3.3 (12 Oct 2012)
+
+  * Use \char13 and \char18 for ' and ` in LaTeX output.
+    Otherwise these appear as curly quotes (unless a package
+    like upquote is used).
+
+  * Make line number anchors into clickable links.
+    This makes it easier to obtain the URL for a specific line
+    of code.  (Alp Mestanogullari)
+
 highlighting-kate 0.5.3.2 (07 Sep 2012)
 
   * Fixed handling of backslash in bash highlighting.
diff --git a/highlighting-kate.cabal b/highlighting-kate.cabal
--- a/highlighting-kate.cabal
+++ b/highlighting-kate.cabal
@@ -1,5 +1,5 @@
 Name:                highlighting-kate
-Version:             0.5.3.2
+Version:             0.5.3.3
 Cabal-Version:       >= 1.6
 Build-Type:          Simple
 Category:            Text
