latex3 / babel

The babel system for LaTeX, LuaLaTeX and XeLaTeX
LaTeX Project Public License v1.3c
126 stars 34 forks source link

hyphenrules and \hyphenation #122

Closed u-fischer closed 1 year ago

u-fischer commented 3 years ago

The documentation of the experimental german patterns, dehyph-exptl, recommend to use \babelprovide{hyphenrules...} to activate the patterns. This works but disables the \hyphenation command, unless one explicitly reset the language:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[main=ngerman]{babel}
%\babelprovide[hyphenrules=ngerman-x-latest]{ngerman}
% \selectlanguage{ngerman}
\hyphenation{Steg-lei-tung}
\begin{document}
\showhyphens{Abendstern}
\showhyphens{Stegleitung}
\end{document}

Result as is:

\T1/cmr/m/n/10 Abends-tern     % old, wrong
\T1/cmr/m/n/10 Steg-lei-tung    % correct

Result with \babelprovide line

 \T1/cmr/m/n/10 Abend-stern  %new, correct
 \T1/cmr/m/n/10 Ste-glei-tung % wrong

Result with additional \selectlanguage

\T1/cmr/m/n/10 Abend-stern   %new, correct
\T1/cmr/m/n/10 Steg-lei-tung  %correct
jbezos commented 3 years ago

I'm not sure if \babelprovide should apply the patterns in addition to setting them. Note \hyphenation is not expected to always work (and this is the very reason \babelhyphenation was added):

\documentclass{article}
\usepackage[italian]{babel}

% \hyphenation{l’a-qui-la}  % Fails when not commented out

\begin{document}
\showhyphens{l’aquila}
\end{document}

But I will think about it.

lemzwerg commented 3 years ago

I have no opinion on that. However, it should be documented in case the current behaviour is desired.

jbezos commented 3 years ago

It's not desired in the sense ideally \hyphenation should always work. But it doesn't and it's one of the reasons the manual states “To set hyphenation exceptions, use \babelhyphenation”.

lemzwerg commented 3 years ago

I suggest to extend this sentence to

“To set hyphenation exceptions, use \babelhyphenation instead of \hyphenation.”

jbezos commented 3 years ago

@lemzwerg 👌 And I'll promote it to a note or even a warning.

jbezos commented 1 year ago

After two issues in the same direction, even if I'm not quite convinced, the hyphenation rules are selected and applied. This seems to be the expected behaviour.