#lang scheme/base (provide texblog->dvi (all-from-out (planet zwizwa/lib/latex))) (require "sweb.ss" scheme/file (planet zwizwa/lib/latex) (planet zwizwa/lib/mfile) (planet zwizwa/lib/x/file)) ;; Late binding thunks so the files can be edited. (define (header) (file->string/utf-8 (sweb-file "templates/blog_header.tex"))) (define (footer) (file->string/utf-8 (sweb-file "templates/blog_footer.tex"))) ;; Don't store image data in memory. It's read from disk when needed. (define (mfile->bytes/thunk mfile) (lambda () (mfile->bytes mfile))) ;; Evaluate string as a .tex file in a \begin{document} context and ;; return a function that generates pages as binary .png files. (define (texblog->dvi str) (parameterize ((texinputs ".:/home/tom/papers:")) ;; LaTeX library (tex->dvi (string->mfile/utf-8 (string-append (header) str (footer)))))) ;; (texblog->pngs "$$1 + 1$$"))