Skip to content

Commit

Permalink
TeX reader: Ignore @{..} and !{..} in array alignment specifiers.
Browse files Browse the repository at this point in the history
Closes #241.
  • Loading branch information
jgm committed Sep 28, 2024
1 parent 44ae413 commit d47229b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Text/TeXMath/Readers/TeX.hs
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,10 @@ arrayLine =

arrayAlignments :: TP [Alignment]
arrayAlignments = mconcat <$>
braces (many (((:[]) . letterToAlignment <$> letter)
braces (many (
((:[]) . letterToAlignment <$> letter)
<|> ([] <$ char '|')
<|> ([] <$ ((char '@' <|> char '!') <* inbraces))
<|> (do char '*'
num <- T.pack <$> braces (many1 digit)
cols <- arrayAlignments
Expand Down
30 changes: 30 additions & 0 deletions test/regression/241.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<<< tex
\begin{array}{l@{\qquad}l}
\text{Infection/colonization episode} & \text{Waning immunity episode}\\
b^{\prime}(t) = \mu_{0}b(t) - cy(t) & b(t) = 0
\end{array}
>>> native
[ EArray
[ AlignLeft , AlignLeft ]
[ [ [ EText TextNormal "Infection/colonization episode" ]
, [ EText TextNormal "Waning immunity episode" ]
]
, [ [ ESuper (EIdentifier "b") (ESymbol Ord "\8242")
, EDelimited "(" ")" [ Right (EIdentifier "t") ]
, ESymbol Rel "="
, ESub (EIdentifier "\956") (ENumber "0")
, EIdentifier "b"
, EDelimited "(" ")" [ Right (EIdentifier "t") ]
, ESymbol Bin "\8722"
, EIdentifier "c"
, EIdentifier "y"
, EDelimited "(" ")" [ Right (EIdentifier "t") ]
]
, [ EIdentifier "b"
, EDelimited "(" ")" [ Right (EIdentifier "t") ]
, ESymbol Rel "="
, ENumber "0"
]
]
]
]

0 comments on commit d47229b

Please sign in to comment.