4

The documentation of hyph-utf8 package states:

Since Babel’s hyphen.cfg is built in the XeLaTeX format, hyphenation patterns can be used without even loading Babel or Polyglossia.

However running xelatex on this minimal example:

\documentclass{article}
\usepackage{lipsum}
\makeatletter
\language=\l@latin
\makeatother
\hyphenrules{latin}
\begin{document}
\lipsum
\end{document}

produces the following error:

./test.tex:6: Undefined control sequence.
<argument> ...{\languagename }\languageshorthands 
                                                  {none}\expandafter \ifx \c...
l.6 \hyphenrules{latin}

? 

What is the problem?

4

As documentated \hyphenrules deactivates the language shorthands (it is curious how some subjects come in bunches: just yesterday I diskussed with Javier the question if hyphenrules should do this as it affects e.g. the french spacing) and so it works only with a package that provides a definition for \languageshorthands. You can add a dummy definition:

\documentclass{article}
\usepackage{lipsum}
\providecommand\languageshorthands[1]{}%
\hyphenrules{latin}
\begin{document}
\lipsum
\end{document}

But you don't need the hyphenrules command in your example. The \language command already changes the hyphenation patterns, but I would suggest to use \bbl@patterns as it contains code which takes the font encoding into account:

\documentclass{article}
\usepackage{lipsum}


\begin{document}
\makeatletter
%\language=\l@english% 
\bbl@patterns{english}
\makeatother

\showhyphens{testing}

\makeatletter
%\language=\l@ngerman%
\bbl@patterns{ngerman} 
\makeatother

\showhyphens{testing}
\end{document}

Your Answer

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