10

I recently noticed on my thesis (template here) that words starting with upper case letter are not hyphenating. Then, I researched and found about the usage of \uchyph=0 How do I prevent TeX from hyphenating acronyms? Then, I tough some package mine was using it, but I could not find any one of them using it.

Then, I got this minimal example after one hour of binary search, i.e., trial and error by removing adding configurations and packages from my full thesis template until I got this minimal example:

\documentclass[10pt,a5paper]{memoir}
\usepackage[brazil]{babel}

\usepackage{anyfontsize}
\usepackage{lmodern}
\usepackage{microtype}

\setlrmarginsandblock{2.5cm}{1.5cm}{*}
\checkandfixthelayout

\emergencystretch=50em
\renewcommand{\normalsize}{\fontsize{10.5pt}{11pt}}

\begin{document}
    Linguagens Linguagens Linguagens Linguagens Linguagens Linguagens
    Linguagens Linguagens Linguagens Linguagens Linguagens Linguagens Linguagens
    Linguagens Linguagens Linguagens Linguagens Linguagens Linguagens Linguagens
    Linguagens Linguagens Linguagens Linguagens Linguagens Linguagens
    Linguagens Linguagens.

    linguagens linguagens linguagens linguagens linguagens linguagens linguagens
    linguagens linguagens linguagens linguagens linguagens linguagens linguagens
    linguagens linguagens linguagens linguagens linguagens linguagens linguagens
    linguagens linguagens linguagens linguagens linguagens linguagens linguagens.
\end{document}

The combined presence of all these elements in my preamble is causing this problem of not hyphenating words starting with upper case letter.

enter image description here

Can I fix it without removing one of these commands or packages from my thesis template?

In my full thesis, just removing the \usepackage{lmodern} package does not fix the issue. I have to remove both \usepackage{lmodern} and \usepackage{anyfontsize}.

Related:

  1. Overfull hbox in biblatex
  • 2
    +1 for the effort in finding the MWE. – Rmano Jul 11 at 11:11
10

enter image description here

It was unrelated to the capital letter other than that changed the widths so affected the possible linebreak points. You had a very large \emergencystretch so tex preferred to stretch the white space than hyphenate the word.

\documentclass[10pt,a5paper]{memoir}
\usepackage[brazil]{babel}

\usepackage{anyfontsize}
\usepackage{lmodern}
\usepackage{microtype}

\setlrmarginsandblock{2.5cm}{1.5cm}{*}
\checkandfixthelayout

%\emergencystretch=50em
\renewcommand{\normalsize}{\fontsize{10.5pt}{11pt}\selectfont}% \selectfont needed

\begin{document}

\showhyphens{Linguagens linguagens}

    Linguagens Linguagens Linguagens Linguagens Linguagens Linguagens
    Linguagens Linguagens Linguagens Linguagens Linguagens Linguagens Linguagens
    Linguagens Linguagens Linguagens Linguagens Linguagens Linguagens Linguagens
    Linguagens Linguagens Linguagens Linguagens Linguagens Linguagens
    Linguagens Linguagens.

    linguagens linguagens linguagens linguagens linguagens linguagens linguagens
    linguagens linguagens linguagens linguagens linguagens linguagens linguagens
    linguagens linguagens linguagens linguagens linguagens linguagens linguagens
    linguagens linguagens linguagens linguagens linguagens linguagens linguagens.
\end{document}

With no emergencystretch as above you get some overfull lines as there are no good linebreaking points, If you add a small amount of stretch then you can allow linebreaks without having excessive stretch. With 0.5em instead of 50em you get no overfull lines and

\emergencystretch=.5em

enter image description here

  • Is there an equivalent to \emergencyshrink, i.e., opposite of \emergencystretch? – user Jul 12 at 1:53
  • @user no, just stretch – David Carlisle Jul 12 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.