3

I've more or less the same content, compiled with babel and polyglossia:

\documentclass{article}
\usepackage{fontspec}
\usepackage[italian]{babel}
\babelfont{rm}[Ligatures=TeX,Numbers=OldStyle]{Garamond Premier Pro}

\begin{document}
\textbf{Babel}

avvedutezza avanti l'articolo away ayo l'abaco l'accidente l'acerrimo adirato aedo
un'affranta afisico afoso l'agone ahhhh l'aiuto ajta alternativa ambedue ancora
annichilire aorta appurare acqua Aristarco artistica L'albero l'alternativa
l'enfasi l'eccezionalità l'altra l'ircocervo l'Illiria l'omeopatia astrattismo atroce
automobile avere avicola awak ayno l'azalea l'uguaglianza l'umanità l'abecedario
accoliti l'acqua l'addomesticare l'aereoplano affidare l'agone l'aiuto aja l'assurdo l'abaco
l'elemento l'eccezionalità l'inedia l'inutilità l'occasione l'Occitania allampanato
un'ampolla annoso un'aorta l'artatamente l'astrologia l'attenzione autore avanti avventure
away ayo azzardo L'Australia L'Europa l'uguaglianza l'umanità
\end{document}

and

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX,Numbers=OldStyle]{Garamond Premier Pro}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}

\begin{document}
\textbf{Polyglossia}

l'avvedutezza avanti l'articolo away ayo abaco l'accidente acerrimo l'adirato aedo
un'affranta afisico afoso l'agone ahhhh l'aiuto ajta alternativa ambedue ancora
annichilire l'aorta l'appurare acqua Aristarco artistica L'albero l'alternativa
l'enfasi l'eccezionalità l'altra l'ircocervo l'Illiria l'omeopatia l'astrattismo atroce
un'automobile avere avicola awak ayno l'azalea l'uguaglianza un'umanità l'abecedario
accolito un'acqua l'addomesticare l'aereoplano affidare l'agone l'aiuto l'assurdo l'abaco
un elemento un'eccezionalità un'inedia un'aorta un'occasione l'Occitania l'allampanato
ampolla annoso l'inutilità l'artatamente l'astrologia l'attenzione autore avanti avventure
away ayo azzardo L'Australia L'Europa l'uguaglianza l'umanità
\end{document}

The result is the following one:

enter image description here

It's evident that the presence of the apostrophe inhibits hyphenation with babel.

Is there anything wrong or lacking in my code? And how to solve? Thank you

2 Answers 2

3

The babel module for Italian should indeed set the \lccode for the apostrophe U+2019.

\documentclass{article}
\usepackage{fontspec}
\usepackage[italian]{babel}
\babelfont{rm}[Ligatures=TeX,Numbers=OldStyle]{EB Garamond}

\makeatletter
\addto\extrasitalian{%
  \babel@savevariable{\lccode"2019}%
  \lccode"2019="2019
}
\makeatother

\begin{document}

\parbox{0pt}{
\hspace{0pt}%
avvedutezza avanti l'articolo away ayo l'abaco 
%l'accidente l'acerrimo adirato aedo
%un'affranta afisico afoso l'agone ahhhh l'aiuto ajta alternativa ambedue ancora
%annichilire aorta appurare acqua Aristarco artistica L'albero l'alternativa
%l'enfasi l'eccezionalità l'altra l'ircocervo l'Illiria l'omeopatia astrattismo atroce
%automobile avere avicola awak ayno l'azalea l'uguaglianza l'umanità l'abecedario
%accoliti l'acqua l'addomesticare l'aereoplano affidare l'agone l'aiuto aja l'assurdo l'abaco
%l'elemento l'eccezionalità l'inedia l'inutilità l'occasione l'Occitania allampanato
%un'ampolla annoso un'aorta l'artatamente l'astrologia l'attenzione autore avanti avventure
%away ayo azzardo L'Australia L'Europa l'uguaglianza l'umanità
}

\end{document}

enter image description here

Let's see that this respects language changes. Setting the \lccode for French is not needed, as it is taken care of in french.ldf.

\documentclass{article}
\usepackage{fontspec}
\usepackage[english,french,italian]{babel}
\babelfont{rm}[Ligatures=TeX,Numbers=OldStyle]{EB Garamond}

\makeatletter
\addto\extrasitalian{%
  \babel@savevariable{\lccode"2019}%
  \lccode"2019="2019
}
\makeatother

\begin{document}

Italian: \the\lccode"2019

{\selectlanguage{english} English: \the\lccode"2019}

{\selectlanguage{french} French: \the\lccode"2019}

{\selectlanguage{english} English: \the\lccode"2019}

{\selectlanguage{italian} Italian: \the\lccode"2019}

{\selectlanguage{french} French: \the\lccode"2019}

{\selectlanguage{english} English: \the\lccode"2019}

\languagename

\parbox{0pt}{
\hspace{0pt}%
avvedutezza avanti l'articolo away ayo l'abaco 
%l'accidente l'acerrimo adirato aedo
%un'affranta afisico afoso l'agone ahhhh l'aiuto ajta alternativa ambedue ancora
%annichilire aorta appurare acqua Aristarco artistica L'albero l'alternativa
%l'enfasi l'eccezionalità l'altra l'ircocervo l'Illiria l'omeopatia astrattismo atroce
%automobile avere avicola awak ayno l'azalea l'uguaglianza l'umanità l'abecedario
%accoliti l'acqua l'addomesticare l'aereoplano affidare l'agone l'aiuto aja l'assurdo l'abaco
%l'elemento l'eccezionalità l'inedia l'inutilità l'occasione l'Occitania allampanato
%un'ampolla annoso un'aorta l'artatamente l'astrologia l'attenzione autore avanti avventure
%away ayo azzardo L'Australia L'Europa l'uguaglianza l'umanità
}

\end{document}

enter image description here

3
  • For generally this applies to both Italian and French (calt for quoteright is localized just for these two langages in many fonts), is there a way to apply your code to both languages?
    – user41063
    Jan 1, 2019 at 18:54
  • @user41063 I changed a bit the setting, so the original \lccode is restored to what it was at language change time. It's not needed for French, because it is already taken care of.
    – egreg
    Jan 1, 2019 at 21:55
  • the umpteenth magic of egreg ... thank you!
    – user41063
    Jan 2, 2019 at 1:34
2

Better searching, I found this solution:

\lccode"2019="2019

The Unicode right-single-quote (or apostrophe) character U+2019 has not been given a non-zero \lccode, and therefore it is considered a nonletter by the hyphenation routine.

I read too:

Duplicating patterns is doable (if you tell me that I should do it, I will implement it), but seems like yet another ugly hack to me. One thing that I still consider clean is replacing all the "27 with "2019 in patterns themselves and properly read the input in 8bit engines. But that's not the final answer since people might just as well complain that "27 doesn't hyphenate properly in XeTeX.

I would much more prefer explaining to hyphenating engine that "2019 should be treated identical to "27 if that was possible.

However, I do not understand what in concrete should be done in order to avoid incurring the "ugly solution of duplicating patterns".

But have we to consider this one a babel bug?

5
  • Yes, also babel should do this.
    – egreg
    Jan 1, 2019 at 16:54
  • you should probably report this to the maintainer of babel-italian. The address is in italian.ldf. Jan 1, 2019 at 17:09
  • inside that file I find only JLBraams@cistron.nl (Johannes Braams, not Brahms :) ). I'll write to him
    – user41063
    Jan 1, 2019 at 17:20
  • then your version is very old. The current maintainer is imho Claudio Beccari. Jan 1, 2019 at 17:35
  • Yes, find Cbeccari!. I'll write stright to him
    – user41063
    Jan 1, 2019 at 18:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .