Use XeLatex instead of XeLatex

This commit is contained in:
Wei Tang 2017-01-22 19:10:12 +08:00 committed by Matthew Flatt
parent 640488bab1
commit 5e49131e44
3 changed files with 22 additions and 7 deletions

View File

@ -4,7 +4,8 @@
(prefix-in latex: "latex-render.rkt"))
(provide render-mixin
dvi-render-mixin)
dvi-render-mixin
xelatex-render-mixin)
(define render-mixin
(make-indirect-renderer-mixin
@ -15,3 +16,8 @@
(make-indirect-renderer-mixin
(λ (%) (latex:render-mixin % #:image-mode 'ps)) #".tex" #".pdf"
run-dvipdf-latex))
(define xelatex-render-mixin
(make-indirect-renderer-mixin
(λ (%) (latex:render-mixin % #:image-mode 'pdf)) #".tex" #".pdf"
run-xelatex))

View File

@ -2,16 +2,22 @@
(require scheme/system scheme/port)
(provide run-pdflatex run-dvipdf-latex)
(provide run-pdflatex run-dvipdf-latex run-xelatex)
(define (run-pdflatex file [notify void]) (run file notify #f))
(define (run-pdflatex file [notify void]) (run file notify 'pdflatex))
(define (run-dvipdf-latex file [notify void])
(parameterize ([function-name 'run-dvipdf-latex])
(run file notify #t)))
(run file notify 'dvipdf)))
(define (run-xelatex file [notify void])
(parameterize ([function-name 'run-xelatex])
(run file notify 'xelatex)))
(define max-runs 5)
(define (run file notify via-dvipdf?)
(define latex-cmd-name (if via-dvipdf? "latex" "pdflatex"))
(define (run file notify type)
(define latex-cmd-name (cond [(equal? type 'pdflatex) "pdflatex"]
[(equal? type 'dvipdf) "latex"]
[(equal? type 'xelatex) "xelatex"]
[else (err "unknown run type ~a" type)]))
(define cmd
(list (get-latex-binary latex-cmd-name)
"-interaction=batchmode"
@ -43,7 +49,7 @@
[(zero? n)
(notify "WARNING: no \"Rerun\" found in first run of pdflatex for ~a"
file)]))
(when via-dvipdf?
(when (equal? type 'dvipdf)
(define dvi-file (path-replace-suffix file #".dvi"))
(define ps-file (path-replace-suffix file #".ps"))
(unless (file-exists? dvi-file) (err "didn't find .dvi file"))

View File

@ -67,6 +67,9 @@
[("--pdf") "generate PDF-format output (via PDFLaTeX)"
(current-html #f)
(current-render-mixin pdf:render-mixin)]
[("--xelatex") "generate PDF-format output (via XeLaTeX)"
(current-html #f)
(current-render-mixin pdf:xelatex-render-mixin)]
[("--dvipdf") "generate PDF-format output (via LaTeX, dvips, and pstopdf)"
(current-html #f)
(current-render-mixin pdf:dvi-render-mixin)]