Skip to content

Commit

Permalink
Typst writer: use mid() for middle delimiters.
Browse files Browse the repository at this point in the history
Partially resolves #238.
  • Loading branch information
jgm committed Aug 6, 2024
1 parent d74bd09 commit d819ebc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Text/TeXMath/Writers/Typst.hs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ writeExp (EDelimited open close es) =
then open <> body <> close
else "lr" <> inParens (open <> body <> close)
else esc open <> body <> esc close
where fromDelimited (Left e) = e
where fromDelimited (Left e) =
"mid(" <> fromMaybe (esc e) (M.lookup e typstSymbolMap) <> ")"
fromDelimited (Right e) = writeExp e
isDelim c = c `elem` ["(",")","[","]","{","}","|","||"]
matchedPair "(" ")" = True
Expand Down
4 changes: 4 additions & 0 deletions test/regression/238.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<<< tex
\left\{ x \in \mathbb{R}^n \middle| \lVert x \rVert_2^2 = \sum_{i=1}^n x_i^2 = 1\right\}
>>> typst
{x in bb(R)^n mid(bar.v) parallel x parallel_2^2 = sum_(i = 1)^n x_i^2 = 1}

0 comments on commit d819ebc

Please sign in to comment.