In my last text, justification is dysfunctional: I've had to use about 200 \linebreak commands, sometimes 2-3 in one paragraph, whereas I didn't need any in my previous texts (I didn't even know about \linebreak before). Why is this the case? Thanks in advance for your help.
Here is a MWE with actual text in attached file to show the problem.
Certains pubs anglais ont donné l'impression d'obtempérer en affichant une pancarte sur leur porte avec les mots \textit{Black Troops Only} (réservé aux militaires noirs) — sauf qu'à l'intérieur il y avait les clients habituels, si bien que les soldats noirs qui entraient se retrouvaient dans un pub normal et fraternisaient avec les locaux blancs, y compris des jeunes femmes ravies de découvrir les danses des États-Unis, particulièrement le jitterbug. Cette façon ironique d'implanter la ségrégation enrageait les racistes américains, ce qui réjouissait d'autant plus les patrons des pubs concernés.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
I cannot test it, because you have not marked the code as code (simply select the code with the mouse and click the »Code« button in the toolbar) and it is not a minimal working example, because it does not show the problem but only a not working snippet. However I would expect that these are overfull \hboxes. In this case there should be several warnings in the log file. To get less such overfull \hboxes you can remove your changes of \righthyphenmin and \lefthyphenmin to allow some more hyphenation. You can also try package microtype.
Thank you very much for your explanation! I've corrected my post.
The problem with changing \righthyphenmin and \lefthyphenmin is that I then get faulty hyphenation cases (for instance, in French, it's forbidden to have "chan-gent").
I've just found a solution: replacing \usepackage{ebgaramond} with \usepackage{libertinus} solves almost all cases of lengthened lines.
The last remaining ones were solved with the line \usepackage[protrusion=true,expansion=true,final,babel]{microtype}. Thanks a lot MJK !
PierreJ wrote:Thank you very much for your explanation! I've corrected my post.
The problem with changing \righthyphenmin and \lefthyphenmin is that I then get faulty hyphenation cases (for instance, in French, it's forbidden to have "chan-gent").
babel sets \lefthyphenmin to 2 and \righthyphenmin to 3 for french which AFAIK is correct for French (if it isn't, you should make a bug report). But if only some words are faulty hyphenated, you should correct these words, e.g., using \hyphenation{changent} in your document preamble. Global settings of \lefthyphenmin and \righthyphenmin to large values make hyphenation and therefore paragraph breaking difficult to TeX. So it is not recommended to do so to solve hyphenations problems of some words only.
Certains pubs anglais ont donné l'impression d'obtempérer en affichant une pancarte sur leur porte avec les mots \textit{Black Troops Only} (réservé aux militaires noirs) — sauf qu'à l'intérieur il y avait les clients habituels, si bien que les soldats noirs qui entraient se retrouvaient dans un pub normal et fraternisaient avec les locaux blancs, y compris des jeunes femmes ravies de découvrir les danses des États-Unis, particulièrement le jitterbug. Cette façon ironique d'implanter la ségrégation enrageait les racistes américains, ce qui réjouissait d'autant plus les patrons des pubs concernés.
used only allowed hyphenations. So there is also no need to change the font. However, of you like Linux Libertine more than Garamond, just use it. (But don't expect, that this solves all hyphenation problems for every text and for all time).
Moreover, if you are using the current French hyphenation pattern, changent will not be hyphenated with the default settings:
in the log-file. So there are not any hyphenation points in «changent». If you get another result, you should check, if the hyphenation patterns for french are installed and activated and if your TeX installation is up-to-date.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms.
Ijon Tichy, thank you very much for your input. I'll follow your advice and use \hyphenation to solve special cases. I'm not sure it's a bug problem, maybe it's just too complicated to manage. For instance, "pa-rent" is legal if it means "relative" but it's illegal if it means "(they) avert".
Funnily, changing fonts did solve most of my hyphenation problems (please see the attached picture, to be compared with the picture attached to my first post). The last issues (line 6 and 18) were solved by the microtype package.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p