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?
Asked
Active
Viewed 4,302 times
11

Job
- 6,459
1 Answers
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.

Eli Barzilay
- 432
-
So ... your comment on macros - are you saying that Python is just as good as Lisps at emitting Latex? – Job Jul 10 '11 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... – Eli Barzilay Jul 11 '11 at 17:56
-
-
1Mark 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. – Eli Barzilay Jul 26 '11 at 01: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 '11 at 04:14
-
-
This is interesting, hadn't heard of Scribble. I think a greater problem is global variables that are abundant in TeX, and taking a functional-programming approach might mitigate complexity for "larger" or more complex documents. Unfortunately, I think you'd have to make it a pretty pure interface to TeX, and leave LaTeX behind. Otherwise you could still get in to trouble. – bbarker May 27 '14 at 17:08
*
suffix. Lisp haslet
andlet*
and so on, LaTeX has\section
and\section*
. – Kaz Dec 16 '15 at 02:05