11

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?

3
  • 2
    Yes, a quick Google search reveals Lisp-Augmented TeX. There are probably dozens of others. The LaTeX macro system is actually quite powerful, although not for the faint of heart. You can build your own, copying the design of XML-in-Lisp packages.
    – Macneil
    Jul 10, 2011 at 3:46
  • 2
    Note there is a tex stackexchange as well: tex.stackexchange.com Jul 10, 2011 at 23:05
  • By the way, LaTeX pays homage to Lisp by calling alternative versions of operators that do something slightly different with a * suffix. Lisp has let and let* and so on, LaTeX has \section and \section*.
    – Kaz
    Dec 16, 2015 at 2:05

1 Answer 1

13

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.

7
  • So ... your comment on macros - are you saying that Python is just as good as Lisps at emitting Latex?
    – Job
    Jul 10, 2011 at 13:32
  • Well, IMO Lisps are better than Python because of macros (among other things) -- so let's just say that for emitting latex, Python doesn't suffer from any new problems compared to lisps... Jul 11, 2011 at 17:56
  • @Eli What do you mean by "new problems"?
    – Mark C
    Jul 25, 2011 at 23:55
  • 1
    Mark C: in both cases (a Lisp or Python) a system like this is writing code that generates (la)tex code. There's no particular reason that one would be better than the other other than the usual claim that Lispers will have that their language is better and vice versa. In that sense, there are no new problems on either side. Jul 26, 2011 at 1:49
  • Oh, thanks for answering. I misread that "compared to" means Lisps have problems doing this job. By the way, you need an "@" to send a notification. (You'll get one because this is your answer.)
    – Mark C
    Jul 29, 2011 at 4:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.