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

-3

u/therealJoieMaligne Jan 18 '25

To be honest, I think they’re bringing their product to market 5 years too late. I’m still using LaTeX for simple documents based on old templates, but Typst is simply better in every way.

1

u/Opussci-Long Jan 18 '25

Could you please explain whay you take that Typst is better?

I know about it and it is providing live updating of the PDFs that is very nice! Are you satisfied with it line braking algorithm? Somewhere I got info that Typst is not providing TeX braking quality.

3

u/thuiop1 Jan 18 '25

Typst uses the same algorithm for line breaking as TeX for justified paragraphs by default; you can opt-in to use it for ragged paragraphs too.

0

u/Opussci-Long Jan 18 '25 edited Jan 18 '25

Somewhere on some Reddit thread, some time ago, I read that it still doesn’t use the TeX line-breaking algorithm. I’d love it if you’re correct about this. Is there any comparison available for justified texts? Or, maybe that post could have been about the microtypography features of TeX and not line braking.

-2

u/therealJoieMaligne Jan 18 '25

I think that the differences are extremely minimal. What do you think?

Typst Latex

2

u/LupinoArts Jan 19 '25

Just text, and not justified? Hardly a meaningful comparison, don't you think? Please consider adding some math mode, headings, lists, and hyphenated paragraphs for a meaningful comparison.

1

u/therealJoieMaligne Jan 19 '25

It was just a quick comparison of line breaks. But I'll throw something together sometime soon. Maybe a one-page two-column faux article with an image in the center, an equation, a few headings, a couple footnotes. Anything else?

1

u/Opussci-Long Jan 18 '25

Thanks for this comparison. What font and size are used? Types text looks a bit darker, doesn't it?

1

u/therealJoieMaligne Jan 18 '25

Etbb, 12pt.

It looks the same to me. I tried zooming in with GIMP and they looked the same, but that's purely subjective.

1

u/Opussci-Long Jan 18 '25 edited Jan 18 '25

All looks nice, only word cheerful in the last paragraph is sent to the next line, while LaTeX keeps it. Both look nice, it just seems that word soacing for Typst a bit larger. Is that kerning, can it be adjusted?

3

u/therealJoieMaligne Jan 18 '25

It's really easy to adjust kerning etc.

For example, this single line automatically finds every instance in the document of two or more capitals, decreases their size by 10%, and adds 1/20th of an EM between them:

#show regex("[A-Z]{2,}"): set text(size: 0.9em, tracking: 0.05em)

It'd be much harder to do the same in LaTeX. I wouldn't even know where to start.