Skip to content

Commit 6b956d8

Browse files
Better colon operators.
1 parent e1e5721 commit 6b956d8

File tree

6 files changed

+14
-4
lines changed

6 files changed

+14
-4
lines changed

EXAMPLES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ _This file was generated automatically from [MkSnippets.hs](test/PdfSnippets/MkS
4646
| `ψ◞"Foo" ` | `\psi{}_{\mathrm{Foo}}` | ![pdflatex-rendered version of `\psi{}_{\mathrm{Foo}}`](test/PdfSnippets/ᓭpsiⶈⶉ⣀ⶈᓭmathrmⶈFooⶉⶉ.png) |
4747
| `ψ◞𝐹‸𝑜‸𝑜 ` | `\psi{}_{Foo}` | ![pdflatex-rendered version of `\psi{}_{Foo}`](test/PdfSnippets/ᓭpsiⶈⶉ⣀ⶈFooⶉ.png) |
4848
| `𝑓◝(3☽"")☾𝑥 ` | `f^{\left(3\right)}\left(x\right)` | ![pdflatex-rendered version of `f^{\left(3\right)}\left(x\right)`](test/PdfSnippets/fᐞⶈᓭleftᑕ3ᓭrightᑐⶉᓭleftᑕxᓭrightᑐ.png) |
49-
### Function application
49+
### Function application and definition
5050
| Haskell | LaTeX | pdf |
5151
| ---: | --- | :--- |
5252
| `𝑓☾𝑥 ` | `f\left(x\right)` | ![pdflatex-rendered version of `f\left(x\right)`](test/PdfSnippets/fᓭleftᑕxᓭrightᑐ.png) |
@@ -56,6 +56,8 @@ _This file was generated automatically from [MkSnippets.hs](test/PdfSnippets/MkS
5656
| `(𝑓∘𝑔)☽𝑥 ` | `\left(f\circ{}g\right)x` | ![pdflatex-rendered version of `\left(f\circ{}g\right)x`](test/PdfSnippets/ᓭleftᑕfᓭcircⶈⶉgᓭrightᑐx.png) |
5757
| `(𝑓∘𝑔)☽(𝑥*𝑦) ` | `\left(f\circ{}g\right)\left(x{\cdot}y\right)` | ![pdflatex-rendered version of `\left(f\circ{}g\right)\left(x{\cdot}y\right)`](test/PdfSnippets/ᓭleftᑕfᓭcircⶈⶉgᓭrightᑐᓭleftᑕxⶈᓭcdotⶉyᓭrightᑐ.png) |
5858
| `𝑓∘𝑔☾𝑥 ` | `f\circ{}g\left(x\right)` | ![pdflatex-rendered version of `f\circ{}g\left(x\right)`](test/PdfSnippets/fᓭcircⶈⶉgᓭleftᑕxᓭrightᑐ.png) |
59+
| `𝑓 ÷ (ℤ-→ℝ) ` | `f:\mathbb{Z}\to{}\mathbb{R}` | ![pdflatex-rendered version of `f:\mathbb{Z}\to{}\mathbb{R}`](test/PdfSnippets/f⦂ᓭmathbbⶈZⶉᓭtoⶈⶉᓭmathbbⶈRⶉ.png) |
60+
| `𝑓☾𝑥 ÷= 𝑥+π ` | `f\left(x\right){:=}x+\pi{}` | ![pdflatex-rendered version of `f\left(x\right){:=}x+\pi{}`](test/PdfSnippets/fᓭleftᑕxᓭrightᑐⶈ⦂〧ⶉx⼦ᓭpiⶈⶉ.png) |
5961
### Logical
6062
| Haskell | LaTeX | pdf |
6163
| ---: | --- | :--- |

Math/LaTeX/Internal/MathExpr.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,10 @@ infixl 2 -\-, ⧵, ∖
135135
(∖) = opL' 2 LaTeX.setminus
136136

137137
infixr 5 , -→, ←-,
138-
(⸪), (-→), (←-), (↪) :: MathsInfix
138+
(÷), (⸪), (-→), (←-), (↪) :: MathsInfix
139+
{-# DEPRECATED (⸪) "Use (÷), i.e. U+00F7 DIVISION SIGN" #-}
139140
(⸪) = opR 5 ":"
141+
(÷) = opR 5 ":"
140142
(-→) = opR 5 LaTeX.to
141143
(←-) = opR 5 LaTeX.leftarrow
142144
(↪) = opR 5 $ LaTeX.comm0"hookrightarrow"
@@ -211,6 +213,8 @@ makeOperatorCaste "relationOperators"
211213
, ("⸪=", [e|raw"{:=}"|])
212214
, ("=⸪", [e|raw"{=:}"|])
213215
#endif
216+
, ("÷=", [e|raw"{:=}"|])
217+
, ("", [e|raw"{=:}"|])
214218
, ("", [e|LaTeX.comm0"equiv"|])
215219
, ("⩵!", [e|raw" \\overset{!}{=} "|])
216220
, ("", [e|""LaTeX./=:""|])

Math/LaTeX/Prelude.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ module Math.LaTeX.Prelude (
3131
#if __GLASGOW_HASKELL__ > 801
3232
, (،..،), (،), (⸪=), (=⸪)
3333
#endif
34+
, (÷=), (=÷)
3435
, (␣), (+..+), (*..*), (×), (∗), (⋆), (<،>), (<⍪>)
3536
, (⊗), (∘), factorial
3637
, (◝), (◝⁀), (◞), (◞◝), (|◞), (|◝), (|◞◝)
3738
, (⩵), (≡), (⩵!), (≠), (⪡), (⪢), (≤), (≥), (≪), (≫), (∝), (⟂), (∥), (₌₌), (╰─┬─╯)
3839
, (=→), (←=), (≈), (∼), (≃), (≅)
39-
, (⊂), (/⊂), (⊆), (⊃), (⊇), (∋), (∌), (∈), (∉), (∩), (∪), (⊎), (∖), (-\-), (⧵), (⸪), (⊕)
40+
, (⊂), (/⊂), (⊆), (⊃), (⊇), (∋), (∌), (∈), (∉), (∩), (∪), (⊎), (∖), (-\-), (⧵), (÷), (⸪), (⊕)
4041
, (∀:), (∃:), (∄:)
4142
, (-→), (←-), (↦), (↪), (==>), (<==), (<=>), (∧), (∨)
4243
, (∫), (◞∫), (◞∮), d, (∑), (◞∑), (∏), (◞∏)

test/PdfSnippets/MkSnippets.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ tests_U = testGroup "Tests"
154154
, [mkLaTeXSnip| ψ◞𝐹‸𝑜‸𝑜 |] "\\psi{}_{Foo}"
155155
, [mkLaTeXSnip| 𝑓◝(3☽"")☾𝑥 |] "f^{\\left(3\\right)}\\left(x\\right)"
156156
]
157-
, testGroup "Function application"
157+
, testGroup "Function application and definition"
158158
[ [mkLaTeXSnip| 𝑓☾𝑥 |] "f\\left(x\\right)"
159159
, [mkLaTeXSnip| 𝑓☾(𝑔☾𝑥) |] "f\\left(g\\left(x\\right)\\right)"
160160
#if __GLASGOW_HASKELL__ > 801
@@ -166,6 +166,8 @@ tests_U = testGroup "Tests"
166166
, [mkLaTeXSnip| (𝑓∘𝑔)☽(𝑥*𝑦) |]
167167
"\\left(f\\circ{}g\\right)\\left(x{\\cdot}y\\right)"
168168
, [mkLaTeXSnip| 𝑓∘𝑔☾𝑥 |] "f\\circ{}g\\left(x\\right)"
169+
, [mkLaTeXSnip| 𝑓 ÷ (ℤ-→ℝ) |] "f:\\mathbb{Z}\\to{}\\mathbb{R}"
170+
, [mkLaTeXSnip| 𝑓☾𝑥 ÷= 𝑥+π |] "f\\left(x\\right){:=}x+\\pi{}"
169171
]
170172
, testGroup "Logical"
171173
[ [mkLaTeXSnip| 𝑝 ∨ 𝑞 |] "p\\vee{}q"
@@ -327,6 +329,7 @@ encode = concatMap enc
327329
enc '>' = ""
328330
enc ',' = "،"
329331
enc '.' = ""
332+
enc ':' = ""
330333
enc ' ' = ""
331334
enc c = error $ "Unencodable character '"++[c]++"'"
332335

2.29 KB
Loading
2.15 KB
Loading

0 commit comments

Comments
 (0)