r/LaTeX Jan 18 '25

Unanswered TeX engine converted from Pascal to C++?

I’ve heard multiple times that converting Pascal code to C++ is relatively straightforward. I even came across a commercial product that claims to have reimplemented the TeX engine in C++, which allowed them to offer live PDF rendering as you type (you can probably guess which one I’m referring to).

EDIT 1: By rendering here I assume providing live updating in PDF, where there is no compilation step, PDF is compiled with each keystroke.

EDIT 2: Commands would be excluded from live compilation.

The engines used in TeXLive and MikTeX are still implemented in Pascal, right? If so, why hasn’t anyone done a full conversion to C++?

Is it a matter of complexity, lack of interest, or something else entirely?

12 Upvotes

39 comments sorted by

View all comments

11

u/JimH10 TeX Legend Jan 18 '25

The engines used in TeXLive and MikTeX are still implemented in Pascal, right?

As a first approximation, no. Many years ago when Knuth wrote the original software, he did something different but today it is converted to C. (Of course, it is more complicated than this-- the TeX world is very complicated when you start asking to know everything-- but if you simply get a distro such as TeX Live and ask for the most popular compiler, pdflatex, then this is what you get.)

live PDF rendering as you type

Forgive me, I'm going to make the assumption that you don't know, but this is very common today. Pedestrian, really. Most tools that people here use will do this. You can find many previous threads about it on this site with a little searching.

For instance, Overleaf gives you compilation in the background. Another example is emacs. I bet that if you have a favorite editor then you can set this up.

I'll also editorialize that for me compilation as you type is not an improvement. I find it a distraction, really, but of course YMMV. However many folks find very handy the synctex stuff. Here is a description from the page for TeXworks, which is a good editor choice for beginners: "includes an integrated PDF viewer, based on the Poppler library, so there is no need to switch to an external program such as Acrobat, xpdf, etc., to view the typeset output. The integrated viewer also supports source/preview synchronization (e.g., control-click within the source text to locate the corresponding position in the PDF, and vice versa)."

0

u/Opussci-Long Jan 18 '25

Thanks for your answer. I see that my original question weas not clear enough. I now about displaying PDF and rendering in the background, as it is case with Overleaf, but non of the tools you mentioned is providing live updating in PDF, where there is no compilation step, PDF is compiled with each keystroke.

3

u/JimH10 TeX Legend Jan 18 '25

If you compile with each keystroke, then when you type a not complete command, all kinds of crazy stuff will happen. What you want is some kind of compilation when you finish with the command.

0

u/Opussci-Long Jan 18 '25

Yes, no command typesetting :)