From d21304bab08248b6b41b7fc7305a5000505e59f6 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Thu, 2 Aug 2012 21:14:43 -0700
Subject: [PATCH] Made markdown reader sensitive to Ext_raw_tex.

---
 src/Text/Pandoc/Writers/Markdown.hs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index f8681825f..5426beabe 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -466,8 +466,9 @@ inlineToMarkdown _ (Math InlineMath str) =
   return $ "$" <> text str <> "$"
 inlineToMarkdown _ (Math DisplayMath str) =
   return $ "$$" <> text str <> "$$"
-inlineToMarkdown _ (RawInline f str)
-  | f == "html" || f == "latex" || f == "tex" || f == "markdown" =
+inlineToMarkdown opts (RawInline f str)
+  | f == "html" || f == "markdown" ||
+    (isEnabled Ext_raw_tex opts && (f == "latex" || f == "tex")) =
     return $ text str
 inlineToMarkdown _ (RawInline _ _) = return empty
 inlineToMarkdown opts (LineBreak)