October 27, 2021

The \raggedright command in LaTex

 

There is a seldom used command available in LaTeX which is not introducing a new feature to improve the layout of the document but \raggedright deactivates the justified text. After inserting the command at the beginning no hyphenation is done and the text will use a simple word wrap algorithm known from text editors and libreoffice. The rest of the formatting remains in charge.
The interesting situation is that with this simple command the resulting document will look very different. It has nothing in common with a normal LaTeX file but it looks like a bad formated pdf file which was either created by a php script or was created with libreofice. That means, the subjective quality judgement that the \raggedright command has reduced the quality from excellent down to zero. It was mentioned already that the font is the same, and the picture are placed at the same position, only the word wrap algorithm was modified. Is it possible that the elegance of a latex generated documents is only the result of the word wrap algoirthm?
THis remains unclear because the ocmmand is nearly unknown in the LaTeX community. Most users have no reason to use this command because high quality word wrapping is the reason why they have switched to latex.
To understand the situation we have to focus on the normal word wrapping algorithm in LaTeX. By default, LaTeX formats the text justified, that means the right edge forms a straight line. This is realized with paragraph wide optimization, hyphenation and micro typography. The result looks amazing. LaTeX outperforms easily possible alternative likes Libreoffice because most paragraphs doesn't need any hyphenations and the amount of whitespace is low.
The \raggedright command deactivates the entire feature. No aadjustment is made but the line wrapping works the same what is known from webbrowsers. The text can be read but it looks not very well written.