texmath 0.12.10.2 → 0.12.10.3
raw patch · 6 files changed
+120/−13 lines, 6 filesdep ~typst-symbols
Dependency ranges changed: typst-symbols
Files
- changelog.md +10/−0
- src/Text/TeXMath/Shared.hs +8/−6
- src/Text/TeXMath/Writers/MathML.hs +15/−2
- test/regression/264.test +82/−0
- test/writer/mml/sphere_volume.test +3/−3
- texmath.cabal +2/−2
changelog.md view
@@ -1,3 +1,13 @@+texmath (0.12.10.3)++ * MathML writer: fix rendering of EScaled (#264, Ewan Davies).+ Use `%` values for `maxwidth` and `minwidth`, and set `stretchy` to+ `true`. Otherwise browsers do not rescale.++ * TeX reader: Support all r/l variants of `\big`, `\bigg`, `\Big` (#266).++ * Require typst-symbols >= 0.1.8.1.+ texmath (0.12.10.2) * Use texmath-symbols 0.1.8 (supports typst 0.13 symbols).
@@ -230,16 +230,18 @@ scalers :: [(T.Text, Rational)] scalers = [ ("\\bigg", widthbigg)- , ("\\Bigg", widthBigg)- , ("\\big", widthbig)- , ("\\Big", widthBig)+ , ("\\biggl", widthbigg) , ("\\biggr", widthbigg)+ , ("\\Bigg", widthBigg)+ , ("\\Biggl", widthBigg) , ("\\Biggr", widthBigg)+ , ("\\big", widthbig)+ , ("\\bigl", widthbig) , ("\\bigr", widthbig)+ , ("\\Big", widthBig)+ , ("\\Bigl", widthBig) , ("\\Bigr", widthBig)- , ("\\biggl", widthbigg)- , ("\\Biggl", widthBigg)- , ("\\bigl", widthbig)]+ ] where widthbig = 6 / 5 widthBig = 9 / 5 widthbigg = 12 / 5
src/Text/TeXMath/Writers/MathML.hs view
@@ -80,8 +80,9 @@ fromForm FPrefix = "prefix" makeScaled :: Rational -> Element -> Element-makeScaled x = withAttribute "minsize" s . withAttribute "maxsize" s- where s = dropTrailing0s $ T.pack $ printf "%.3f" (fromRational x :: Double)+makeScaled x = withAttribute "minsize" p . withAttribute "maxsize" p + . setAttribute "stretchy" "true"+ where p = T.pack $ printf "%d%%" (round (100*x) :: Int) dropTrailing0s :: T.Text -> T.Text@@ -136,6 +137,18 @@ withAttribute :: String -> T.Text -> Element -> Element withAttribute a = add_attr . Attr (unqual a) . T.unpack +-- Preserves the order of any existing attributes+setAttribute :: String -> T.Text -> Element -> Element+setAttribute a v e = e { elAttribs = update (elAttribs e) }+ where+ newAttr = Attr (unqual a) (T.unpack v)+ update [] = [newAttr]+ update (x:xs)+ | qName (attrKey x) == a = + newAttr : xs+ | otherwise = + x : update xs+ accent :: T.Text -> Element accent = add_attr (Attr (unqual "accent") "true") . tunode "mo"
+ test/regression/264.test view
@@ -0,0 +1,82 @@+<<< native+[ ESymbol Op "\8707"+, EIdentifier "x"+, ESymbol Op "\8704"+, EIdentifier "y"+, ESymbol Op "\8704"+, EIdentifier "z"+, EScaled (9 % 5) (ESymbol Open "(")+, EScaled (6 % 5) (ESymbol Open "(")+, EIdentifier "F"+, ESymbol Open "("+, EIdentifier "x"+, ESymbol Pun ","+, EIdentifier "y"+, ESymbol Close ")"+, ESymbol Bin "\8743"+, EIdentifier "F"+, ESymbol Open "("+, EIdentifier "x"+, ESymbol Pun ","+, EIdentifier "z"+, ESymbol Close ")"+, ESymbol Bin "\8743"+, ESymbol Open "("+, EIdentifier "y"+, ESymbol Rel "\8800"+, EIdentifier "z"+, ESymbol Close ")"+, EScaled (6 % 5) (ESymbol Close ")")+, ESymbol Rel "\8594"+, ESymbol Op "\172"+, EIdentifier "F"+, ESymbol Open "("+, EIdentifier "y"+, ESymbol Pun ","+, EIdentifier "z"+, ESymbol Close ")"+, EScaled (9 % 5) (ESymbol Close ")")+]+>>> mml+<?xml version='1.0' ?>+<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">+ <mrow>+ <mo>∃</mo>+ <mi>x</mi>+ <mo>∀</mo>+ <mi>y</mi>+ <mo>∀</mo>+ <mi>z</mi>+ <mo minsize="180%" maxsize="180%" stretchy="true" form="prefix">(</mo>+ <mo minsize="120%" maxsize="120%" stretchy="true" form="prefix">(</mo>+ <mi>F</mi>+ <mo stretchy="false" form="prefix">(</mo>+ <mi>x</mi>+ <mo>,</mo>+ <mi>y</mi>+ <mo stretchy="false" form="postfix">)</mo>+ <mo>∧</mo>+ <mi>F</mi>+ <mo stretchy="false" form="prefix">(</mo>+ <mi>x</mi>+ <mo>,</mo>+ <mi>z</mi>+ <mo stretchy="false" form="postfix">)</mo>+ <mo>∧</mo>+ <mo stretchy="false" form="prefix">(</mo>+ <mi>y</mi>+ <mo>≠</mo>+ <mi>z</mi>+ <mo stretchy="false" form="postfix">)</mo>+ <mo minsize="120%" maxsize="120%" stretchy="true" form="postfix">)</mo>+ <mo>→</mo>+ <mo>¬</mo>+ <mi>F</mi>+ <mo stretchy="false" form="prefix">(</mo>+ <mi>y</mi>+ <mo>,</mo>+ <mi>z</mi>+ <mo stretchy="false" form="postfix">)</mo>+ <mo minsize="180%" maxsize="180%" stretchy="true" form="postfix">)</mo>+ </mrow>+</math>
test/writer/mml/sphere_volume.test view
@@ -243,7 +243,7 @@ <mo>=</mo> <mi>ϕ</mi> <msubsup>- <mo minsize="1.8" maxsize="1.8" stretchy="false" form="prefix">|</mo>+ <mo minsize="180%" maxsize="180%" stretchy="true" form="prefix">|</mo> <mn>0</mn> <mrow> <mn>2</mn>@@ -259,7 +259,7 @@ <mo stretchy="true" form="postfix">)</mo> </mrow> <msubsup>- <mo minsize="1.8" maxsize="1.8" stretchy="false" form="prefix">|</mo>+ <mo minsize="180%" maxsize="180%" stretchy="true" form="prefix">|</mo> <mn>0</mn> <mi>π</mi> </msubsup>@@ -275,7 +275,7 @@ <mn>3</mn> </msup> <msubsup>- <mo minsize="1.8" maxsize="1.8" stretchy="false" form="prefix">|</mo>+ <mo minsize="180%" maxsize="180%" stretchy="true" form="prefix">|</mo> <mn>0</mn> <mi>R</mi> </msubsup>
texmath.cabal view
@@ -1,5 +1,5 @@ Name: texmath-Version: 0.12.10.2+Version: 0.12.10.3 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 >= 0.1.8 && < 0.1.9,+ typst-symbols >= 0.1.8.1 && < 0.1.9, split Exposed-modules: Text.TeXMath,