@@ -790,9 +790,12 @@ inlineLaTeX :: PandocMonad m => OrgParser m (F Inlines)
790790inlineLaTeX = try $ do
791791 cmd <- inlineLaTeXCommand
792792 texOpt <- getExportSetting exportWithLatex
793+ allowEntities <- getExportSetting exportWithEntities
793794 ils <- parseAsInlineLaTeX cmd texOpt
794795 maybe mzero returnF $
795− parseAsMathMLSym cmd `mplus` parseAsMath cmd texOpt `mplus` ils
796+ parseAsMathMLSym allowEntities cmd `mplus`
797+ parseAsMath cmd texOpt `mplus`
798+ ils
796799 where
797800 parseAsInlineLaTeX :: PandocMonad m
798801 => Text -> TeXExport -> OrgParser m (Maybe Inlines)
@@ -801,10 +804,15 @@ inlineLaTeX = try $ do
801804 TeXIgnore -> return (Just mempty)
802805 TeXVerbatim -> return (Just $ B.str cs)
803806
804− parseAsMathMLSym :: Text -> Maybe Inlines
805− parseAsMathMLSym cs = B.str <$> MathMLEntityMap.getUnicode (clean cs)
806− -- drop initial backslash and any trailing "{}"
807− where clean = T.dropWhileEnd (`elem` ("{}" :: String)) . T.drop 1
807+ parseAsMathMLSym :: Bool -> Text -> Maybe Inlines
808+ parseAsMathMLSym allowEntities cs = do
809+ -- drop initial backslash and any trailing "{}"
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
815+ x -> x
808816
809817 state :: ParserState
810818 state = def{ stateOptions = def{ readerExtensions =