Skip to content

Commit

Permalink
TeX reader: ignore \color instead of crashing.
Browse files Browse the repository at this point in the history
Later we might support color, but for now just ignore it.
See #225.
  • Loading branch information
jgm committed Sep 28, 2024
1 parent 76f3db1 commit 71a25f3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Text/TeXMath/Readers/TeX.hs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ command = try $ do
choice
[ text c
, styled c
, colored c
, root c
, xspace c
, mathop c
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 71a25f3

Please sign in to comment.