@@ -790,9 +790,12 @@ inlineLaTeX :: PandocMonad m => OrgParser m (F Inlines)
790inlineLaTeX = try $ do
790inlineLaTeX = try $ do
791 cmd <- inlineLaTeXCommand
791 cmd <- inlineLaTeXCommand
792 texOpt <- getExportSetting exportWithLatex
792 texOpt <- getExportSetting exportWithLatex
793+ allowEntities <- getExportSetting exportWithEntities
793 ils <- parseAsInlineLaTeX cmd texOpt
794 ils <- parseAsInlineLaTeX cmd texOpt
794 maybe mzero returnF $
795 maybe mzero returnF $
796+ parseAsMathMLSym allowEntities cmd `mplus`
795− parseAsMathMLSym cmd `mplus` parseAsMath cmd texOpt `mplus` ils
797+ parseAsMath cmd texOpt `mplus`
797 parseAsInlineLaTeX :: PandocMonad m
800 parseAsInlineLaTeX :: PandocMonad m
798 => Text -> TeXExport -> OrgParser m (Maybe Inlines)
801 => Text -> TeXExport -> OrgParser m (Maybe Inlines)
@@ -801,10 +804,15 @@ inlineLaTeX = try $ do
801 TeXIgnore -> return (Just mempty)
804 TeXIgnore -> return (Just mempty)
802 TeXVerbatim -> return (Just $ B.str cs)
805 TeXVerbatim -> return (Just $ B.str cs)
804− parseAsMathMLSym :: Text -> Maybe Inlines
807+ parseAsMathMLSym :: Bool -> Text -> Maybe Inlines
805− parseAsMathMLSym cs = B.str <$> MathMLEntityMap.getUnicode (clean cs)
808+ parseAsMathMLSym allowEntities cs = do
806− -- drop initial backslash and any trailing "{}"
809+ -- drop initial backslash and any trailing "{}"
807− where clean = T.dropWhileEnd (`elem` ("{}" :: String)) . T.drop 1
810+ let clean = T.dropWhileEnd (`elem` ("{}" :: String)) . T.drop 1
811+ -- If entities are disabled, then return the string as text, but
812+ -- only if this *is* a MathML entity.
813+ case B.str <$> MathMLEntityMap.getUnicode (clean cs) of
814+ Just _ | not allowEntities -> Just $ B.str cs
809 state :: ParserState
817 state :: ParserState
810 state = def{ stateOptions = def{ readerExtensions =
818 state = def{ stateOptions = def{ readerExtensions =