-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest-render-tex.rkt
34 lines (24 loc) · 1.02 KB
/
test-render-tex.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
#lang racket
(require racket-poppler/render-tex pict)
;;; This demonstrates how to use "render-tex.rkt".
(latex-debug? #t) ; #t turns on useful debug information
; turn this on to see paths and errors.
; the location of pdflatex where TeXLive installed it
(latex-path
(case (system-type)
[(macosx) "/usr/local/texlive/2013/bin/universal-darwin/pdflatex"]
[(unix) "pdflatex"]
[(windows) "c:/texlive/2014/bin/win32/pdflatex.exe"]))
; make a Racket pict from a piece of TeX
(define p (latex->pict "$\\sqrt{x^2+y^2+z}$"))
(pict->bitmap p)
(define beside hc-append)
(define above vc-append)
(pict->bitmap ; pict->bitmap is need in DrRacket
; DrRacket won't display picts that draw directly
; to the Cairo drawing context
; This shows that the pict can be used as a normal pict.
(above (beside (rotate p (- pi (/ pi 3))) (rotate p (/ pi 3)))
(beside (rotate p (+ pi (/ pi 3))) (rotate p (- (/ pi 3))))))
(pict->bitmap p)
(define (tex s) (pict->bitmap (inset (latex->pict s) 4)))