October 30, 2021

Reducing the LaTeX software to the core

 

The current tex-llve package is not only a piece of software but it is a software distribution which contains of millions of lines of code which are distributed over endless amount of packages and commands. The newbie has make sure that around 5GB are available on the harddrive so it seems, that desktop pubishing with LaTeX is a demanding task. To understand the latex system better we have to reduce all the programs to the minimum. The question is what is the core idea behind LaTeX?
The surprising answer is that LaTeX has such a core idea. It is about typesetting of justified text. That means the main ability of tex is the combination of the word wrap algorithm, plus hyphenation and very important the microtype package. All these things make sure that the right border of a column is straight from top to down.
All the other typographic elements of LaTeX for example the ability to manage different fonts, referencing of literature, typesetting mathematical formulas and so on is only a gimmick on top of the paragraph justification algorithm.
Realizing such algorithm in software is a complicated task. Especially the microtype text which adjusts even the spaces in a word itself is an example for an elegant software. The generated output of justified text has a better quality than what Libreoffice has to offer and it is the main reason why LaTeX is used everywhere.
The interestion situation is that without a justified text the latex generated pdf document will look not very impressive. It has the same or even a lower quality than the libreoffice counterpart. So the question is why is the abilty to typeset justified text so important? Because it is assumed that this technical trick will improve the impression for the reader drasticaly. He will see on the first look that the document was typeset professional. In the time before the advent of digital typography it was very hard to produce justified text and with modern word processors the task remains a challenge. Only LaTeX and professional software like Indesign is able to do so while normal word processing software including pandoc, asciitops and emacs can't do so.
The situation will become more obvious if someone tries to program an algorithm from scratch which creates justified text. Creating a simple word wrapping algorithm can be realized in under 100 lines of code, but this won't produce a correct right edge. To stretch each character similar to the microtype package, an advanced software is needed which includes the ability to handle different fonts. This is an advanced typesetting problem and latex is an expert for this task.
There is less common package available in the texlive distributio which is ragged2d. This package produces a left justified text similar to what Libreoffice is doing. Activating this package is from a technical perspective trivial but it will generate a pdf document which looks very different from a conference proceeding and an academic journal.