@@ -971,17 +971,19 @@ rawEnv name = do
971971 let parseRaw = extensionEnabled Ext_raw_tex exts
972972 rawOptions <- mconcat <$> many rawopt
973973 let beginCommand = "\\begin{" ++ name ++ "}" ++ rawOptions
974− unless parseRaw $ do
975− pos1 <- getPosition
976− report $ SkippedContent beginCommand pos1
974+ pos1 <- getPosition
977975 (bs, raw) <- withRaw $ env name blocks
978− raw' <- applyMacros' raw
979− if parseRaw
980− then return $ rawBlock "latex" $ beginCommand ++ raw'
981− else do
982− pos2 <- getPosition
983− report $ SkippedContent ("\\end{" ++ name ++ "}") pos2
984− return bs
976+ raw' <- applyMacros' $ beginCommand ++ raw
977+ if raw' /= beginCommand ++ raw
978+ then parseFromString blocks raw'
979+ else if parseRaw
980+ then return $ rawBlock "latex" $ beginCommand ++ raw'
981+ else do
982+ unless parseRaw $ do
983+ report $ SkippedContent beginCommand pos1
984+ pos2 <- getPosition
985+ report $ SkippedContent ("\\end{" ++ name ++ "}") pos2
986+ return bs
985987
986988----
987989