forked from ps-tuebingen/informatik-1-skript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath-utilities.rkt
35 lines (28 loc) · 1021 Bytes
/
math-utilities.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#lang racket/base
; From http://con.racket-lang.org/pr-slides.pdf
; by Prabhakar Ragde
(require scribble/html-properties
scribble/base
scribble/core)
(provide setup-math math-in math-disp $ $$)
(define mathjax-source
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js"
;"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
; "http://c328740.r40.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=default"
;"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-HTML"
)
(define setup-math
(paragraph
(style
#f (list (alt-tag "script")
(attributes `((type . "text/javascript")
(src . ,mathjax-source )))))
'()))
(define (mymath start end . strs)
(make-element (make-style "relax" '(exact-chars)) `(,start ,@strs ,end)))
(define (math-in . strs)
(apply mymath "\\(" "\\)" strs))
(define (math-disp . strs)
(apply mymath "\\[" "\\]" strs))
(define $ math-in)
(define $$ math-disp)