texmath 0.12.8 → 0.12.8.1
raw patch · 5 files changed
+29/−6 lines, 5 filesdep ~typst-symbols
Dependency ranges changed: typst-symbols
Files
- changelog +8/−0
- src/Text/TeXMath/Writers/Typst.hs +17/−2
- test/writer/typst/differentiable_manifold.test +1/−1
- test/writer/typst/divergence.test +1/−1
- texmath.cabal +2/−2
changelog view
@@ -1,3 +1,11 @@+texmath (0.12.8.1)++ * Typst Writer: several fixes (#223, Lleu Yang).++ + Escape quotes (") in inQuotes+ + Accent `\8407` corresponds to `arrow()`+ + Write `#none`'s for matrices with blanks at the beginning of a row+ texmath (0.12.8) * Expose Text.TeXMath.Shared [API change]
src/Text/TeXMath/Writers/Typst.hs view
@@ -45,7 +45,7 @@ inParens s = "(" <> s <> ")" inQuotes :: Text -> Text-inQuotes s = "\"" <> s <> "\""+inQuotes s = "\"" <> escInQuotes s <> "\"" esc :: Text -> Text esc t =@@ -66,6 +66,16 @@ needsEscape '_' = True needsEscape _ = False +escInQuotes :: Text -> Text+escInQuotes t =+ if T.any (== '"') t+ then T.concatMap escapeChar t+ else t+ where+ escapeChar c+ | c == '"' = "\\" <> T.singleton c+ | otherwise = T.singleton c+ writeExpS :: Exp -> Text writeExpS (EGrouped es) = "(" <> writeExps es <> ")" writeExpS e =@@ -129,6 +139,7 @@ ESymbol Accent "\x2c7" -> "caron" <> inParens (writeExp b) ESymbol Accent "\x2192" -> "->" <> inParens (writeExp b) ESymbol Accent "\x2190" -> "<-" <> inParens (writeExp b)+ ESymbol Accent "\8407" -> "arrow" <> inParens (writeExp b) ESymbol TOver "\9182" -> "overbrace(" <> writeExp b <> ")" ESymbol TOver "\9140" -> "overbracket(" <> writeExp b <> ")" ESymbol TOver "\175" -> "overline(" <> writeExp b <> ")"@@ -239,7 +250,11 @@ mkArray rows = T.intercalate "; " $ map mkRow rows where- mkRow = T.intercalate ", " . map mkCell+ mkRow = T.intercalate ", " . mkCells . map mkCell+ mkCells cs =+ case cs of+ ("":rest) -> "#none" : rest+ _ -> cs mkCell = writeExps tshow :: Show a => a -> Text
test/writer/typst/differentiable_manifold.test view
@@ -59,5 +59,5 @@ ] ] >>> typst-gamma_1 ident gamma_2 arrow.l.r.double {gamma_1 lr((0)) eq gamma_2 lr((0)) eq p comma upright(" and ")\+gamma_1 equiv gamma_2 arrow.l.r.double {gamma_1 lr((0)) eq gamma_2 lr((0)) eq p comma upright(" and ")\ frac(upright(d), upright(d) t) phi.alt compose gamma_1 lr((t))\|_(t eq 0) eq frac(upright(d), upright(d) t) phi.alt compose gamma_2 lr((t))\|_(t eq 0)
test/writer/typst/divergence.test view
@@ -22,4 +22,4 @@ (EGrouped [ ESymbol Ord "\8706" , EIdentifier "z" ]) ] >>> typst-nabla dot.op v^(⃗) eq frac(diff v_x, diff x) plus frac(diff v_y, diff y) plus frac(diff v_z, diff z)+nabla dot.op arrow(v) eq frac(diff v_x, diff x) plus frac(diff v_y, diff y) plus frac(diff v_z, diff z)
texmath.cabal view
@@ -1,5 +1,5 @@ Name: texmath-Version: 0.12.8+Version: 0.12.8.1 Cabal-Version: >= 1.10 Build-type: Simple Synopsis: Conversion between math formats.@@ -80,7 +80,7 @@ pandoc-types >= 1.20 && < 1.24, mtl >= 2.2.1, text,- typst-symbols,+ typst-symbols >= 0.1.4 && < 0.1.5, split Exposed-modules: Text.TeXMath,