# [tex-eplain] Babel in Plain TeX

John Was john.was at ntlworld.com
Thu Sep 3 12:47:31 CEST 2009

```Hello

It recently became apparent that XeTeX has Babel  preloaded (something I hadn't realized), and Karl Berry kindly provided some eplain code allowing easy invocation of the different hyphenation patterns, viz.:

\eplainsetlanguage{portuguese}{2}{3}

using:

{\catcode`@=11
\gdef\eplainsetlanguage#1#2#3{%
% do not set the language if the name is undefined in the current TeX.
\expandafter\ifx\csname lang@#1\endcsname \relax
\message{no patterns for #1}%
\else
\global\language = \csname lang@#1\endcsname
\fi
% but there is no harm in adjusting the hyphenmin values regardless.
\global\lefthyphenmin = #2\relax
\global\righthyphenmin = #3\relax
}
}

This works nicely in XeTeX, and I have now tried the code in an old EmTeX distribution (which I sometimes have to use for a long-standing job that will take years to complete).  The code itself processes without fuss, but then tells me that the language patterns for e.g. Latin are not found (i.e. the error message built into the above code).  That's hardly surprising since the EmTeX distribution doesn't have Babel preloaded.  I was hoping to find that I could simply \input the appropriate Babel code (just as one can say \input soul.sty to get the SOUL package to work), but although the older Babel documentation that I have found says it will work with plain TeX without the need to create a special format, I haven't been able to discover how to invoke Babel from within a plain TeX file.

Does anyone know how to do this?

And apologies if that isn't a question for this list - I couldn't see another Babel-dedicated list (and suspect that nearly all current Babel users employ flavours of LaTeX).