[Tex/LaTex] Using hyph-utf8 with plain TeX

hyphenationpdftexplain-texunicode

I want to use the UTF-8 hyphenation patterns (for Croatian) with plain TeX (pdftex). I've read the documentation on the hyph-utf8 package but I haven't found it very useful. There's mention of a \uselanguage{langname} command but I don't know where to put it.

When I tried putting the command in the text file I'm trying to process, an e-TeX error occurs saying language hr is undefined (also tried with other languages, like US English, and none of them is recognised; also tried full language names like croatian, etc.).

When I try to use the command during format generation, the error "command is undefined" occurs.

I've tried directly including the loadhyph-hr.tex file (found in hyph-utf8 package) in the .tex file I use to create a format, that failed too.

Does anyone know how to make this work?

EDIT:
This is what my format-generating file (F.tex) looks like now:

\let\keptdump\dump \let\dump\relax    
\input pdfetex.ini
\let\enc=u
\input csplain.ini
\let\dump\keptdump \let\keptdump=\undefined
\dump

where csplain.ini is a file in encTeX with the following content:

\input csfonts  % re-defines primitive \font
\input plain    % format Plain
\restorefont    % original meaning of primitive \font
\input il2code  % extra codes for czech / slovak letters in ISO-8859-2 encoding
\input hyphen.lan  % czech / slovak hyphenation pattern (may be others too)
\input plaina4  % \hsize and \vsize for A4
\everyjob=\expandafter{\the\everyjob
   \message{The format: csplain <Sep. 2005>.}
   \message{The cs-fonts are preloaded and A4 size implicitly defined.}}
\ifx\enc\undefined \else \input csenc-\enc.tex \fi % re-encoding using encTeX
\ifx\xprncode\undefined \else %% The encTeX is detected
   \count255=128               % All codes > 128 are printable: 
   \loop \xprncode\count255=1 \advance\count255 by 1
   \ifnum \count255<256 \repeat
\fi

\ifx\pdfoutput\undefined \else % added in Feb. 2005
   \def\tmpa{\pdfcsplain}
   \expandafter\def\expandafter\tmpb\expandafter{\csname\jobname\endcsname}
   \ifx\tmpa\tmpb %% PDFTeX with PDF output
      \message {jobname=pdfcsplain, PDF output initialised.}
      \openin0=pdftexconfig.tex
      \ifeof0 \message{WARNING: pdftexconfig.tex does not exist. 
                       I set \string\pdfoutput=1 only.}%
      \else \closein0 \input pdftexconfig.tex
      \fi
      \pdfoutput=1
   \else
      \message {jobname=csplain with pdftex, DVI output initialised.}
      \pdfoutput=0
      \let\oripdfoutput=\pdfoutput \let\pdfoutput=\undefined
   \fi
   \let\tmpa=\undefined \let\tmpb=\undefined
\fi

\dump

I haven't changed anything in this file, but I have modified files csfonts and csenc-u.

Best Answer

Since you have TeX Live (on a Unix system, I guess), you should have the language available: a UTF-8 encoded file

\uselanguage{croatian}
\font\tenrm="Latin Modern Roman/S=10;mapping=tex-text"

\tenrm\hsize=1pt

\hskip0pt Republika Hrvatska Položajem

\bye

processed with xetex should show hyphenation as Re-pu-bli-ka Hr-vat-ska Po-lo-ža-jem.

Are you sure to have installed the support files for Croatian, that is, the Debian package texlive-lang-croatian?

Note that using plain TeX with pdftex won't give correct results, unless the default fonts are changed and some catcode trickery is performed or encTeX is used.

You need to prepare your format with

pdftex -ini -enc -etex -pdf "\def\enc{u}\input F.tex"

where F.tex is

\input csfonts  % re-defines primitive \font

\let\keptdump\dump \let\dump\relax
\input pdfetex.ini

\restorefont    % original meaning of primitive \font
\input il2code  % extra codes for czech / slovak letters in ISO-8859-2 encoding
\input plaina4  % \hsize and \vsize for A4
\everyjob=\expandafter{\the\everyjob
   \message{The format: csplain <Sep. 2005>.}
   \message{The cs-fonts are preloaded and A4 size implicitly defined.}}
\input csenc-u.tex % re-encoding using encTeX
\ifx\xprncode\undefined \else %% The encTeX is detected
   \count255=128               % All codes > 128 are printable: 
   \loop \xprncode\count255=1 \advance\count255 by 1
   \ifnum \count255<256 \repeat
\fi

\ifnum\pdfoutput=0
  \message {jobname=csplain with pdftex, DVI output initialised.}
  \pdfoutput=0
  \let\oripdfoutput=\pdfoutput \let\pdfoutput=\undefined
\else
  \message {jobname=pdfcsplain, PDF output initialised.}
    \openin0=pdftexconfig.tex
    \ifeof0 \message{WARNING: pdftexconfig.tex does not exist. 
                     I set \string\pdfoutput=1 only.}%
    \else \closein0 \input pdftexconfig.tex
    \fi
    \pdfoutput=1
\fi

\let\dump\keptdump \let\keptdump=\undefined
\dump

Here I assume that your modifications to csfonts.tex and csenc-u.tex are consistent with your purposes.