From 71a25f3ede582ebd8c01b1c39720e460e899aa20 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 28 Sep 2024 09:45:29 -0700 Subject: [PATCH] TeX reader: ignore `\color` instead of crashing. Later we might support color, but for now just ignore it. See #225. --- src/Text/TeXMath/Readers/TeX.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Text/TeXMath/Readers/TeX.hs b/src/Text/TeXMath/Readers/TeX.hs index e1c46891..6e7849aa 100644 --- a/src/Text/TeXMath/Readers/TeX.hs +++ b/src/Text/TeXMath/Readers/TeX.hs @@ -202,6 +202,7 @@ command = try $ do choice [ text c , styled c + , colored c , root c , xspace c , mathop c @@ -674,6 +675,13 @@ styled c = do _ -> f [x] Nothing -> mzero +colored :: Text -> TP Exp +colored "\\color" = do + _ <- inbraces -- skip the color + -- in the future we might add color to the types or to the styles + texSymbol <|> inbraces <|> texChar +colored _ = mzero + -- note: sqrt can be unary, \sqrt{2}, or binary, \sqrt[3]{2} root :: Text -> TP Exp root c = do