mathjax-convert-unicode, shortened javascript which loads MathJax so that it is easier to compare for removal (since we unfortunately cannot set its ID).
This commit is contained in:
parent
fbb7f162a0
commit
d4e21dff28
|
@ -8,6 +8,7 @@
|
||||||
racket/runtime-path
|
racket/runtime-path
|
||||||
setup/collects
|
setup/collects
|
||||||
"katex-convert-unicode.rkt"
|
"katex-convert-unicode.rkt"
|
||||||
|
"mathjax-convert-unicode.rkt"
|
||||||
racket/list)
|
racket/list)
|
||||||
|
|
||||||
(provide $
|
(provide $
|
||||||
|
@ -114,13 +115,11 @@ EOJS
|
||||||
(define (load-style-string src)
|
(define (load-style-string src)
|
||||||
(string-append
|
(string-append
|
||||||
#<<EOJS
|
#<<EOJS
|
||||||
(function() {
|
(function() {document.write('<link rel="stylesheet" href="
|
||||||
document.write('<link rel="stylesheet" href="
|
|
||||||
EOJS
|
EOJS
|
||||||
src
|
src
|
||||||
#<<EOJS
|
#<<EOJS
|
||||||
" />');
|
" />');})();
|
||||||
})();
|
|
||||||
EOJS
|
EOJS
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#lang at-exp racket/base
|
#lang at-exp racket/base
|
||||||
(require racket/string)
|
(require racket/string)
|
||||||
|
|
||||||
(provide katex-convert-unicode)
|
(provide katex-convert-unicode
|
||||||
|
string-replace*)
|
||||||
|
|
||||||
(define (literal-alternatives→regexp literal-alternatives)
|
(define (literal-alternatives→regexp literal-alternatives)
|
||||||
(string-append "("
|
(string-append "("
|
||||||
|
@ -22,11 +23,8 @@
|
||||||
replacement
|
replacement
|
||||||
(string-append "$" replacement "$"))))))
|
(string-append "$" replacement "$"))))))
|
||||||
|
|
||||||
(define (katex-convert-unicode str mathmode?)
|
(define (katex-convert-unicode str mathmode? [more-sym→* '()])
|
||||||
(if (string? str)
|
(define sym→*
|
||||||
(string-replace*
|
|
||||||
str
|
|
||||||
mathmode?
|
|
||||||
`([₀ "{}_0"]
|
`([₀ "{}_0"]
|
||||||
[₁ "{}_1"]
|
[₁ "{}_1"]
|
||||||
[₂ "{}_2"]
|
[₂ "{}_2"]
|
||||||
|
@ -114,4 +112,9 @@
|
||||||
[⋁ "\\bigvee{}"]
|
[⋁ "\\bigvee{}"]
|
||||||
[± "\\pm{}"]
|
[± "\\pm{}"]
|
||||||
))
|
))
|
||||||
|
(if (string? str)
|
||||||
|
(string-replace*
|
||||||
|
str
|
||||||
|
mathmode?
|
||||||
|
(append more-sym→* sym→*))
|
||||||
str))
|
str))
|
21
mathjax-convert-unicode.rkt
Normal file
21
mathjax-convert-unicode.rkt
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#lang at-exp racket/base
|
||||||
|
(require racket/string
|
||||||
|
scriblib/render-cond
|
||||||
|
"katex-convert-unicode.rkt")
|
||||||
|
|
||||||
|
(provide mathjax-convert-unicode)
|
||||||
|
|
||||||
|
(define (mathjax-convert-unicode str* mathmode?)
|
||||||
|
(define more-sym→*
|
||||||
|
`([⩴ ,(string-append
|
||||||
|
"\\ifmathjax{\\mathrel{{\\raise0.9mu{::}\\hspace{-4mu}=}}}"
|
||||||
|
"\\iflatex{\\Coloneqq}")]
|
||||||
|
[∈ "\\in{}"]
|
||||||
|
[κ "\\kappa"]
|
||||||
|
[⁺ "{}^+"]
|
||||||
|
[⁻ "{}^-"]
|
||||||
|
;; TODO:
|
||||||
|
[❲ "\\ifmathjax{\\unicode{x2272}}\\iflatex{❲}"]
|
||||||
|
[❳ "\\ifmathjax{\\unicode{x2273}}\\iflatex{❳}"]
|
||||||
|
))
|
||||||
|
(katex-convert-unicode str* mathmode? more-sym→*))
|
Loading…
Reference in New Issue
Block a user