Recently I've seen LaTeX sources and convinced those are very complicated and difficult for understanding. So my question is: Is that possible to convert LaTeX kernel sources to some widely used language like C++ or Java sources?

  • 3
    LaTeX is a set of macros for TeX. How exactly would one convert that to some arbitrary other language and expect it to work? You'd need TeX itself as well, and even then you have the whole business that (La)TeX mixing code and output, as the realities of typesetting make a clean division very hard.
    – Joseph Wright
    Apr 7, 2011 at 11:57
  • I should add that the LaTeX2e sources were written ~20 years ago, and are optimised for computer restrictions that are difficult to imagine today!
    – Joseph Wright
    Apr 7, 2011 at 11:57
  • 1
    A lot of the code for ConTeXt MkIV is written in lua. Even for the TeX part, ConTeXt is easier to read than LaTeX.
    – Aditya
    Apr 7, 2011 at 15:06
  • 2
    C++ and Java aren't inherently understandable, and LaTeX isn't inherently difficult. Understandibility is temporal and in the eye of the understander. We can help you understand LaTeX, but not to avoid it. Apr 7, 2011 at 17:55

2 Answers 2


Sure, it is possible. But nobody finished the project by now ... Except the nts-System, written in Java, but without using the possibilities of Java. One of the last projects is ExTeX, written also in Java and also not finished ...

The real Problem is not to write it in C++ or whatelse, the problem is to finish it ... ;-)

  • 1
    LuaTeX is now fully written in C, but I don't think the question was a bout TeX the program bur rather about TeX macros that form LaTeX's kernel. Apr 7, 2011 at 13:58
  • LuaTeX is the more or less the code from web2C, but not rewritten in C, which nobody would do (I suppose)
    – user2478
    Apr 7, 2011 at 14:06
  • since luatex 0.50 all pascal code have been manually converted to C code, read Taco's article tug.org/TUGboat/tb30-3/tb96hoekwater-pascal.pdf Apr 7, 2011 at 16:30
  • @Khaled: I know, but this is what I wanted to say: it is converted from WEB to C with the same behaviour of all procedures and algorithmn. Nothing new, except the use of Lua,
    – user2478
    Apr 7, 2011 at 16:43
  • the question didn't ask about anything new either (besides luatex is not a 100% replication, the hyphenation subsystem have been rewritten based on libhnj, for example) Apr 7, 2011 at 17:01

No. Tex has too crazy a semantics for that. In any case, converting sources in this way rarely increases comprehensibility.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .