TeX-my-math 0.202.2.0 → 0.203.0.0
raw patch · 6 files changed
+76/−34 lines, 6 filesdep ~basesetup-changed
Dependency ranges changed: base
Files
- CAS/Dumb/LaTeX/Symbols.hs +4/−2
- Math/LaTeX/Internal/MathExpr.hs +36/−9
- Math/LaTeX/Prelude.hs +6/−4
- Setup.hs +0/−2
- TeX-my-math.cabal +2/−2
- test/PdfSnippets/MkSnippets.hs +28/−15
CAS/Dumb/LaTeX/Symbols.hs view
@@ -241,8 +241,10 @@ "CHQRZN" <|> mapToLaTeXWith mathcal ['𝓐'..'𝓩'] ['A'..'Z']- <|> mapToLaTeXWith mathfrak "𝔄𝔅ℭ𝔇𝔈𝔉𝔊ℌℑ𝔍𝔎𝔏𝔐𝔑𝔒𝔓𝔔ℜ𝔖𝔗𝔘𝔙𝔚𝔛𝔜"- "ABCDEFGHIJKLMNOPQRSTUVWXY"+ <|> mapToLaTeXWith mathfrak "𝔄𝔅ℭ𝔇𝔈𝔉𝔊ℌℑ𝔍𝔎𝔏𝔐𝔑𝔒𝔓𝔔ℜ𝔖𝔗𝔘𝔙𝔚𝔛𝔜ℨ"+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"+ <|> mapToLaTeXWith mathfrak "𝔞𝔟𝔠𝔡𝔢𝔣𝔤𝔥𝔦𝔧𝔨𝔩𝔪𝔫𝔬𝔭𝔮𝔯𝔰𝔱𝔲𝔳𝔴𝔵𝔶𝔷"+ "abcdefghijklmnopqrstuvwxyz" <|> fromAssocList (zip ['α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η','θ', 'ϑ', 'ι', 'κ', 'λ' ] [alpha,beta,gamma,delta,varepsilon,zeta,eta,theta,vartheta,iota,kappa,lambda])
Math/LaTeX/Internal/MathExpr.hs view
@@ -18,6 +18,7 @@ {-# LANGUAGE UnicodeSyntax #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TupleSections #-}+{-# LANGUAGE TypeOperators #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE CPP #-} {-# LANGUAGE NoMonomorphismRestriction #-}@@ -135,8 +136,10 @@ (∖) = opL' 2 LaTeX.setminus infixr 5 ⸪, -→, ←-, ↪-(⸪), (-→), (←-), (↪) :: MathsInfix+(÷), (⸪), (-→), (←-), (↪) :: MathsInfix+{-# DEPRECATED (⸪) "Use (÷), i.e. U+00F7 DIVISION SIGN" #-} (⸪) = opR 5 ":"+(÷) = opR 5 ":" (-→) = opR 5 LaTeX.to (←-) = opR 5 LaTeX.leftarrow (↪) = opR 5 $ LaTeX.comm0"hookrightarrow"@@ -147,22 +150,34 @@ (∃:) = opN 2 $ raw"\\ \\:\\exists{}" (∄:) = opN 2 $ raw"\\ \\:\\nexists{}" -infixl 7 °-infixr 9 ◝, ⁀, ◝⁀+infixl 7 °, ☾+infixr 7 ☽+infixr 9 ◝, ⁀, ‸, ◝⁀ infixr 9 ◞ infixl 8 |◞, |◝, |◞◝ infixl 8 ◞◝, ₌₌-(°), (⁀), (◝), (◝⁀), (◞), (|◞), (₌₌) :: MathsInfix+(°), (☾), (☽), (⁀), (◝), (◝⁀), (◞), (|◞), (₌₌), (╰─┬─╯) :: MathsInfix+{-# DEPRECATED (°) "Use (☾), i.e. U+263E LAST QUARTER MOON" #-}+f☽x = opR 7 mempty (encapsulation (raw"\\left(") (raw"\\right)") f) x+f☾x = opL 7 mempty f (encapsulation (raw"\\left(") (raw"\\right)") x) f°x = opL 7 mempty f (encapsulation (raw"\\left(") (raw"\\right)") x)+{-# DEPRECATED (⁀) "Use (‸), i.e. U+2038 CARET" #-} (⁀) = opR 9 mempty+(‸) = opR 9 mempty+{-# DEPRECATED (◝⁀) "Use manual parenthesization" #-} l◝⁀s = opR 9 mempty l $ encapsulation (raw"^{\\left(") (raw"\\right)}") s l◝s = Operator (Infix (Hs.Fixity 9 Hs.InfixR) mempty) l (Function (SpecialEncapsulation Superscript) s) l◞s = Operator (Infix (Hs.Fixity 9 Hs.InfixR) mempty) l (Function (SpecialEncapsulation Subscript) s)-l₌₌s = Operator (Infix (Hs.Fixity 8 Hs.InfixR) mempty)- (encapsulation (raw "\\underbrace{") (raw "}") l)- (encapsulation (raw "_{") (raw "}") s)+expression+ ╰─┬─╯+ label+ = Operator (Infix (Hs.Fixity 8 Hs.InfixR) mempty)+ (encapsulation (raw "\\underbrace{") (raw "}") expression)+ (encapsulation (raw "_{") (raw "}") label)+{-# DEPRECATED (₌₌) "Use (╰─┬─╯), i.e. Unicode box drawings" #-}+(₌₌) = (╰─┬─╯) l◞◝(s,p) = Operator (Infix (Hs.Fixity 9 Hs.InfixR) mempty) l $ Operator (Infix (Hs.Fixity 9 Hs.InfixR) mempty)@@ -199,6 +214,8 @@ , ("⸪=", [e|raw"{:=}"|]) , ("=⸪", [e|raw"{=:}"|]) #endif+ , ("÷=", [e|raw"{:=}"|])+ , ("=÷", [e|raw"{=:}"|]) , ("≡", [e|LaTeX.comm0"equiv"|]) , ("⩵!", [e|raw" \\overset{!}{=} "|]) , ("≠", [e|""LaTeX./=:""|])@@ -308,20 +325,24 @@ norm = encapsulation (raw "\\left\\|") (raw "\\right\\|") - makeOperatorCaste "juxtapositionOperators" (''MathsInfix, ''LaTeX) (Fixity 0 InfixR) True [ ("␣", [e|LaTeX.space|]) , ("...", [e|LaTeX.comm0"ldots"|])+ , ("⍪", [e|raw","|])+ , ("⍪..⍪", [e|raw",\\ldots,"|]) #if __GLASGOW_HASKELL__ > 801 , ("،", [e|raw","|]) , ("،..،", [e|raw",\\ldots,"|]) #endif ] +{-# DEPRECATED (،) "Use (⍪), i.e. U+236A APL FUNCTIONAL SYMBOL COMMA" #-}+{-# DEPRECATED (،..،) "Use (⍪..⍪), i.e. U+236A APL FUNCTIONAL SYMBOL COMMA" #-} + matrix :: LaTeXC l => [[CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)]] -> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)@@ -436,10 +457,16 @@ type Scalar (LaTeXMath σ) = LaTeXMath σ (*^) = (*) +infix 7 <⍪>+(<⍪>) :: MathsInfix+l <⍪> r = encapsulation (raw"\\left\\langle{") (raw"}\\right\\rangle")+ $ opN 0 (raw",") l r+ infix 7 <،>+{-# DEPRECATED (<،>) "Use (<⍪>), i.e. U+236A APL FUNCTIONAL SYMBOL COMMA" #-} (<،>) :: MathsInfix l <،> r = encapsulation (raw"\\left\\langle{") (raw"}\\right\\rangle") $ opN 0 (raw",") l r instance LaTeXSymbol σ => InnerSpace (LaTeXMath σ) where- (<.>) = (<،>)+ (<.>) = (<⍪>)
Math/LaTeX/Prelude.hs view
@@ -26,16 +26,18 @@ , LaTeX.dot, LaTeX.ddot, LaTeX.bar, LaTeX.hat , LaTeX.vec, LaTeX.underline, LaTeX.tilde -- * Maths operators- , (°), (⁀), (...)+ , (☾), (☽), (°), (‸), (⁀), (...)+ , (⍪..⍪), (⍪) #if __GLASGOW_HASKELL__ > 801 , (،..،), (،), (⸪=), (=⸪) #endif- , (␣), (+..+), (*..*), (×), (∗), (⋆), (<،>)+ , (÷=), (=÷)+ , (␣), (+..+), (*..*), (×), (∗), (⋆), (<،>), (<⍪>) , (⊗), (∘), factorial , (◝), (◝⁀), (◞), (◞◝), (|◞), (|◝), (|◞◝)- , (⩵), (≡), (⩵!), (≠), (⪡), (⪢), (≤), (≥), (≪), (≫), (∝), (⟂), (∥), (₌₌)+ , (⩵), (≡), (⩵!), (≠), (⪡), (⪢), (≤), (≥), (≪), (≫), (∝), (⟂), (∥), (₌₌), (╰─┬─╯) , (=→), (←=), (≈), (∼), (≃), (≅)- , (⊂), (/⊂), (⊆), (⊃), (⊇), (∋), (∌), (∈), (∉), (∩), (∪), (⊎), (∖), (-\-), (⧵), (⸪), (⊕)+ , (⊂), (/⊂), (⊆), (⊃), (⊇), (∋), (∌), (∈), (∉), (∩), (∪), (⊎), (∖), (-\-), (⧵), (÷), (⸪), (⊕) , (∀:), (∃:), (∄:) , (-→), (←-), (↦), (↪), (==>), (<==), (<=>), (∧), (∨) , (∫), (◞∫), (◞∮), d, (∑), (◞∑), (∏), (◞∏)
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
TeX-my-math.cabal view
@@ -1,5 +1,5 @@ Name: TeX-my-math-Version: 0.202.2.0+Version: 0.203.0.0 Category: math Synopsis: Render general Haskell math to LaTeX. Or: math typesetting with high signal-to-noise–ratio. Description: For tl;dr: look at <https://github.com/leftaroundabout/Symbolic-math-HaTeX/blob/master/EXAMPLES.md>.@@ -41,7 +41,7 @@ Cabal-Version: >=1.10 Library- Build-Depends: base>=4.8 && <4.14+ Build-Depends: base>=4.8 && <4.18 , HaTeX>=3.22.3.0 , vector-space , dumb-cas >= 0.2.1 && < 0.3
test/PdfSnippets/MkSnippets.hs view
@@ -28,8 +28,6 @@ import CAS.Dumb import CAS.Dumb.Symbols.ASCII hiding (d)-import CAS.Dumb.Symbols.Unicode.MathLatin_RomanGreek__BopomofoGaps- (Unicode_MathLatin_RomanGreek__BopomofoGaps) import System.FilePath import System.Directory@@ -142,7 +140,7 @@ [ [mkLaTeXSnip| 𝑎 + 𝑏 |] "a+b" , [mkLaTeXSnip| 𝑎 - 𝑏 |] "a-b" , [mkLaTeXSnip| 𝑎 * 𝑏 |] "a{\\cdot}b"- , [mkLaTeXSnip| 𝑎 <،> 𝑏 |] "\\left\\langle{a,b}\\right\\rangle"+ , [mkLaTeXSnip| 𝑎<⍪>𝑏 |] "\\left\\langle{a,b}\\right\\rangle" , [mkLaTeXSnip| 𝑎 × 𝑏 |] "a\\times{}b" , [mkLaTeXSnip| 𝑎 ± 𝑏 |] "a\\pm{}b" , [mkLaTeXSnip| 𝑎 ∓ 𝑏 |] "a\\mp{}b"@@ -153,16 +151,23 @@ [ [mkLaTeXSnip| 𝑎◞𝑏 |] "a_{b}" , [mkLaTeXSnip| 𝑎◞◝(𝑏,𝑐) |] "a_{b}^{c}" , [mkLaTeXSnip| ψ◞"Foo" |] "\\psi{}_{\\mathrm{Foo}}"-#if __GLASGOW_HASKELL__ > 801- , [mkLaTeXSnip| ψ◞𝐹⁀𝑜⁀𝑜 |] "\\psi{}_{Foo}"- , [mkLaTeXSnip| 𝑓◝⁀3°𝑥 |] "f^{\\left(3\\right)}\\left(x\\right)"-#endif+ , [mkLaTeXSnip| ψ◞𝐹‸𝑜‸𝑜 |] "\\psi{}_{Foo}"+ , [mkLaTeXSnip| 𝑓◝(3☽"")☾𝑥 |] "f^{\\left(3\\right)}\\left(x\\right)" ]- , testGroup "Function application"- [ [mkLaTeXSnip| 𝑓°𝑥 |] "f\\left(x\\right)"+ , testGroup "Function application and definition"+ [ [mkLaTeXSnip| 𝑓☾𝑥 |] "f\\left(x\\right)"+ , [mkLaTeXSnip| 𝑓☾(𝑔☾𝑥) |] "f\\left(g\\left(x\\right)\\right)" #if __GLASGOW_HASKELL__ > 801- , [mkLaTeXSnip| 𝑓°(𝑥،𝑦) |] "f\\left(x,y\\right)"+ , [mkLaTeXSnip| 𝑓☾(𝑥⍪𝑦) |] "f\\left(x,y\\right)" #endif+ , [mkLaTeXSnip| 𝓕☾φ☾𝑥 |] + "\\mathcal{F}\\left(\\varphi{}\\right)\\left(x\\right)"+ , [mkLaTeXSnip| (𝑓∘𝑔)☽𝑥 |] "\\left(f\\circ{}g\\right)x"+ , [mkLaTeXSnip| (𝑓∘𝑔)☽(𝑥*𝑦) |]+ "\\left(f\\circ{}g\\right)\\left(x{\\cdot}y\\right)"+ , [mkLaTeXSnip| 𝑓∘𝑔☾𝑥 |] "f\\circ{}g\\left(x\\right)"+ , [mkLaTeXSnip| 𝑓 ÷ (ℤ-→ℝ) |] "f:\\mathbb{Z}\\to{}\\mathbb{R}"+ , [mkLaTeXSnip| 𝑓☾𝑥 ÷= 𝑥+π |] "f\\left(x\\right){:=}x+\\pi{}" ] , testGroup "Logical" [ [mkLaTeXSnip| 𝑝 ∨ 𝑞 |] "p\\vee{}q"@@ -210,9 +215,9 @@ "x+y=x+x{\\cdot}\\left(1+x\\right)=2^{p}+2^{p}{\\cdot}\\left(1+2^{p}\\right)" ] , testGroup "Juxtaposition"- [ [mkLaTeXSnip| 𝑚 + 𝑝⁀𝑞⁀𝑟 |]+ [ [mkLaTeXSnip| 𝑚 + 𝑝‸𝑞‸𝑟 |] "m+pqr"- , [mkLaTeXSnip| 𝑚 + 𝑝⁀(2+𝑞)⁀𝑟 |]+ , [mkLaTeXSnip| 𝑚 + 𝑝‸(2+𝑞)‸𝑟 |] "m+p\\left(2+q\\right)r" , [mkLaTeXSnip| 𝑚 + (𝑝␣𝑞␣𝑟) |] "m+\\left(p\\ {}q\\ {}r\\right)"@@ -226,15 +231,19 @@ "m{\\cdot}\\left(1+23+4\\right)" ] , testGroup "Set-builders"- [ [mkLaTeXSnip| set(3،4،5) |]+ [ [mkLaTeXSnip| set(3⍪4⍪5) |] "\\left\\{3,4,5\\right\\}" , [mkLaTeXSnip| setCompr (𝑥◝2) (𝑥∈ℕ) |] "\\left\\{x^{2}\\middle|x\\in{}\\mathbb{N}\\right\\}"- , [mkLaTeXSnip| setCompr (𝑥/𝑦) (𝑥∈ℤ، 𝑦∈ℕ، 𝑦⪢0) |]+ , [mkLaTeXSnip| setCompr (𝑥/𝑦) (𝑥∈ℤ⍪ 𝑦∈ℕ⍪ 𝑦⪢0) |] "\\left\\{\\frac{x}{y}\\middle|x\\in{}\\mathbb{Z},y\\in{}\\mathbb{N},y>0\\right\\}"- , [mkLaTeXSnip| setCompr (𝑥،𝑦) (𝑥∈ℤ، 𝑦∈ℝ) |]+ , [mkLaTeXSnip| setCompr (𝑥⍪𝑦) (𝑥∈ℤ⍪ 𝑦∈ℝ) |] "\\left\\{\\left(x,y\\right)\\middle|x\\in{}\\mathbb{Z},y\\in{}\\mathbb{R}\\right\\}" ]+ , testGroup "Stylised symbols"+ [ [mkLaTeXSnip| 𝓐<>𝔅<>𝔥<>𝐏<>𝐳 |]+ "\\mathcal{A}\\mathfrak{B}\\mathfrak{h}\\mathbf{P}\\mathbf{z}"+ ] , testGroup "Misc" [ [mkLaTeXSnip| 3*𝑧 - 1 |] "3{\\cdot}z-1"@@ -242,6 +251,9 @@ "a-b+c" , [mkLaTeXSnip| (𝑥/2)|◞◝(𝑥⩵0,1) |] "\\left.\\frac{x}{2}\\right|_{x=0}^{1}"+ , [mkLaTeXSnip| 𝑏 + (𝑥/2)+ ╰─┬─╯"fraction" |]+ "b+\\underbrace{\\frac{x}{2}}_{\\mathrm{fraction}}" , TestCase (3 - 1 &~~! [ ㄒ-ㄗ ⩵ -(ㄗ-ㄒ) ]) "3 - 1 &~~! [ ㄒ-ㄗ ⩵ -(ㄗ-ㄒ) ]" "3-1= -\\left(1-3\\right)" , [mkLaTeXSnip| 𝑎 ∗ 𝑏 |] "a\\ast{}b"@@ -317,6 +329,7 @@ enc '>' = "ᐳ" enc ',' = "،" enc '.' = "៰"+ enc ':' = "⦂" enc ' ' = "ᐧ" enc c = error $ "Unencodable character '"++[c]++"'"