Marriage of Lisp and LaTeX – has it been done

lisp

I like LaTeX, but I find its macro system and logic both complex and weak.
languages such as Schem/Lisp/Clojure are very good at macros. I imagine the entire document written in a lisp family language, which, when run, would emit LaTeX code and produce a document. Has this been done before? Any links?

Best Answer

Racket does exactly that in Scribble, its documentation system. There are now thousands of documentation pages written in this system, and it's very much alive. Note specifically the syntax that is used, which makes lots of such hybrid commands via-spitting-out-text very conveniet.

Note, however, that while macros are used as usual in any Lisp/Scheme code, they are not a central point of this. Functions are just fine for most things -- they just happen to consume text and produce text. LaTeX (or more generally TeX) happens to have chosen a kind of low-level macro based evaluation strategy that fits some cases.