Fixed LaTeX rendering of the equations.
This commit is contained in:
parent
c3f96e43a7
commit
d9c3a561ca
60
dollar.rkt
60
dollar.rkt
|
@ -161,45 +161,53 @@ EOTEX
|
||||||
))
|
))
|
||||||
|
|
||||||
(define math-inline-style-mathjax
|
(define math-inline-style-mathjax
|
||||||
(make-style "texMath"
|
(style "texMath"
|
||||||
(list #;(make-css-addition math-inline.css)
|
(list #;(make-css-addition math-inline.css)
|
||||||
(tex-addition tex-commands)
|
(install-resource mathjax-dir)
|
||||||
(install-resource mathjax-dir)
|
(js-addition load-mathjax-code)
|
||||||
(js-addition load-mathjax-code)
|
'exact-chars)))
|
||||||
'exact-chars)))
|
|
||||||
|
|
||||||
(define math-display-style-mathjax
|
(define math-display-style-mathjax
|
||||||
(make-style "texMath"
|
(style "texMath"
|
||||||
(list #;(make-css-addition math-inline.css)
|
(list #;(make-css-addition math-inline.css)
|
||||||
#;(make-tex-addition math-inline.tex)
|
(install-resource mathjax-dir)
|
||||||
(install-resource mathjax-dir)
|
(js-addition load-mathjax-code)
|
||||||
(js-addition load-mathjax-code)
|
'exact-chars)))
|
||||||
'exact-chars)))
|
|
||||||
|
|
||||||
(define math-inline-style-katex
|
(define math-inline-style-katex
|
||||||
(make-style "texMathInline"
|
(style "texMathInline"
|
||||||
(list (install-resource katex-dir)
|
(list (install-resource katex-dir)
|
||||||
(js-addition load-katex-code+style)
|
(js-addition load-katex-code+style)
|
||||||
'exact-chars)))
|
'exact-chars)))
|
||||||
|
|
||||||
(define math-display-style-katex
|
(define math-display-style-katex
|
||||||
(make-style "texMathDisplay"
|
(style "texMathDisplay"
|
||||||
(list (install-resource katex-dir)
|
(list (install-resource katex-dir)
|
||||||
(js-addition load-katex-code+style)
|
(js-addition load-katex-code+style)
|
||||||
'exact-chars)))
|
'exact-chars)))
|
||||||
|
|
||||||
|
(define math-inline-style-latex
|
||||||
|
(style "texMathInline"
|
||||||
|
(list (tex-addition tex-commands)
|
||||||
|
'exact-chars)))
|
||||||
|
|
||||||
|
(define math-display-style-latex
|
||||||
|
(style "texMathInline"
|
||||||
|
(list (tex-addition tex-commands)
|
||||||
|
'exact-chars)))
|
||||||
|
|
||||||
(define ($-mathjax strs)
|
(define ($-mathjax strs)
|
||||||
(make-element math-inline-style-mathjax `("$" ,@strs "$")))
|
(elem #:style math-inline-style-mathjax `("$" ,@strs "$")))
|
||||||
|
|
||||||
(define ($-katex strs)
|
(define ($-katex strs)
|
||||||
(make-element math-inline-style-katex
|
(elem #:style math-inline-style-katex
|
||||||
(map katex-convert-unicode (flatten strs))))
|
(map katex-convert-unicode (flatten strs))))
|
||||||
|
|
||||||
(define ($$-mathjax strs)
|
(define ($$-mathjax strs)
|
||||||
(make-element math-display-style-mathjax `("\\[" ,@strs "\\]")))
|
(elem #:style math-display-style-mathjax `("\\[" ,@strs "\\]")))
|
||||||
|
|
||||||
(define ($$-katex strs)
|
(define ($$-katex strs)
|
||||||
(make-element math-display-style-katex
|
(elem #:style math-display-style-katex
|
||||||
(map katex-convert-unicode (flatten strs))))
|
(map katex-convert-unicode (flatten strs))))
|
||||||
|
|
||||||
(define $-html-handler (make-parameter $-katex))
|
(define $-html-handler (make-parameter $-katex))
|
||||||
|
@ -219,7 +227,7 @@ EOTEX
|
||||||
(let ([$- ($-html-handler)])
|
(let ([$- ($-html-handler)])
|
||||||
(cond-element
|
(cond-element
|
||||||
[html ($- `(,s . ,strs))]
|
[html ($- `(,s . ,strs))]
|
||||||
[latex `("$" ,s ,@strs "$")]
|
[latex (elem #:style math-inline-style-latex `(,s ,@strs))]
|
||||||
;; TODO: use a unicode representation of math, e.g. x^2 becomes x²
|
;; TODO: use a unicode representation of math, e.g. x^2 becomes x²
|
||||||
[else `(,s . ,strs)])))
|
[else `(,s . ,strs)])))
|
||||||
|
|
||||||
|
@ -227,7 +235,7 @@ EOTEX
|
||||||
(let ([$$- ($$-html-handler)])
|
(let ([$$- ($$-html-handler)])
|
||||||
(cond-element
|
(cond-element
|
||||||
[html ($$- `(,s . ,strs))]
|
[html ($$- `(,s . ,strs))]
|
||||||
[latex `("\\[" ,s ,@strs "\\]")]
|
[latex (elem #:style math-display-style-latex `(,s ,@strs))]
|
||||||
;; TODO: use a spatial representation of display math, e.g.
|
;; TODO: use a spatial representation of display math, e.g.
|
||||||
;; \sum_{i=0}^n x_i^2
|
;; \sum_{i=0}^n x_i^2
|
||||||
;; becomes:
|
;; becomes:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user