From 8e9d90504ca95ae28a0ab0dc6f1e13c05b7b71fb Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 26 Apr 2025 17:32:45 -0700 Subject: Typst writer: handle equation labels with spaces. Closes #10805. --- src/Text/Pandoc/Writers/Typst.hs | 2 +- test/command/10805.md | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Writers/Typst.hs b/src/Text/Pandoc/Writers/Typst.hs index d18b0fde3..d0c92c8ac 100644 --- a/src/Text/Pandoc/Writers/Typst.hs +++ b/src/Text/Pandoc/Writers/Typst.hs @@ -386,7 +386,7 @@ inlineToTypst inline = Right r -> (case extractLabel str of -- #10805 Nothing -> id - Just lab -> (<> ("<" <> literal lab <> ">"))) <$> + Just lab -> (<> (toLabel FreestandingLabel lab))) <$> case mathType of InlineMath -> return $ "$" <> literal r <> "$" DisplayMath -> return $ "$ " <> literal r <> " $" diff --git a/test/command/10805.md b/test/command/10805.md index e3d02bc51..a25f695ac 100644 --- a/test/command/10805.md +++ b/test/command/10805.md @@ -7,3 +7,13 @@ ^D $ U = A $ ``` + +``` +% pandoc -t typst -f latex +\begin{equation} + \label{eq:U 2} + U = A +\end{equation} +^D +$ U = A $#label("eq:U 2") +``` -- cgit v1.2.3