aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsilby <[email protected]>2025-03-19 16:33:19 -0700
committerGitHub <[email protected]>2025-03-19 16:33:19 -0700
commit0f71b9e8c473c0edb1c0c7523e8ba2da890e8aa9 (patch)
tree25bd25f3e9cb38dedda460d6e88f846355b5c040
parentbfa81a52a5e2d487724867cf544be8af59250c7b (diff)
Skip at most one argument to LaTeX tabular newline (#10707)
In LaTeX's tabular environment, the tabular newline takes an optional argument that we skip. But it only takes a single optional argument, and any further square-bracketed text that follows shouldn't be skipped. Fixes #7512, and also adds a test for the original problem raised in that issue which was already fixed at some point.
-rw-r--r--src/Text/Pandoc/Readers/LaTeX/Table.hs2
-rw-r--r--test/command/7512.md65
2 files changed, 66 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX/Table.hs b/src/Text/Pandoc/Readers/LaTeX/Table.hs
index 298e60749..3ac887309 100644
--- a/src/Text/Pandoc/Readers/LaTeX/Table.hs
+++ b/src/Text/Pandoc/Readers/LaTeX/Table.hs
@@ -57,7 +57,7 @@ hline = try $ do
lbreak :: PandocMonad m => LP m Tok
lbreak = (controlSeq "\\" <|> controlSeq "tabularnewline")
- <* skipopts <* spaces
+ <* optional (void rawopt) <* spaces
amp :: PandocMonad m => LP m Tok
amp = symbol '&'
diff --git a/test/command/7512.md b/test/command/7512.md
new file mode 100644
index 000000000..032cfe565
--- /dev/null
+++ b/test/command/7512.md
@@ -0,0 +1,65 @@
+```
+% pandoc -t native -f latex
+\begin{equation*}
+[d,\delta]=0.
+\end{equation*}
+^D
+[ Para [ Math DisplayMath "[d,\\delta]=0." ] ]
+```
+
+```
+% pandoc -t native -f latex
+\begin{table}[htb]
+ \begin{tabular}{|c|c|}
+ $W$ & rel. err. \\[0mm]
+ [$\mu$m] & [\%]\\
+ \end{tabular}
+\end{table}
+^D
+[ Table
+ ( "" , [] , [] )
+ (Caption Nothing [])
+ [ ( AlignCenter , ColWidthDefault )
+ , ( AlignCenter , ColWidthDefault )
+ ]
+ (TableHead ( "" , [] , [] ) [])
+ [ TableBody
+ ( "" , [] , [] )
+ (RowHeadColumns 0)
+ []
+ [ Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Math InlineMath "W" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "rel." , Space , Str "err." ] ]
+ ]
+ , Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "[" , Math InlineMath "\\mu" , Str "m]" ]
+ ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "[%]" ] ]
+ ]
+ ]
+ ]
+ (TableFoot ( "" , [] , [] ) [])
+]
+```