Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
1  
It depends on your TeX distribution: in TeX Live the \uselanguage{croatian} works with the preloaded format with pdftex, xetex and luatex. Note that you can't directly use UTF-8 input with plain TeX, unless you change fonts and probably do some tricks to get the right result. –  egreg Jul 26 '11 at 17:46
    
Thanks for your answer. I have TeXLive 2009. I've made some modifications to the encTeX package so that I can process UTF-8 input files in Croatian with pdftex directly. But I still can't use UTF-8 hyphenation patterns, neither using the encTeX-made format nor using plain format. Just to be clear, what exactly do you mean by "preloaded format"? Maybe I'm missing something... –  Maja Jul 26 '11 at 17:59

2 Answers 2

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.

share|improve this answer
    
Oh boy... I didn't have it installed; I thought hyph-utf8 would be enough. This worked when processed as pdftex file.tex, even though the characters weren't printed right (as expected). Thank you!! Still, when I generate a format F using the -enc option (which I need for utf8 inputting of Croatian characters) and try to run pdftex \&F file.tex, I get the error "Undefined control sequence...\uselanguage" again. If you would happen to have an idea why this happens, please let me know... In any case, thanks very much for your help! –  Maja Jul 26 '11 at 18:33
    
I've added the instruction for preparing correctly a format that knows about \uselanguage. –  egreg Jul 26 '11 at 18:45
    
I get a "Duplicate pattern" error while processing this: ... (/usr/share/texmf-texlive/tex/generic/hyphen/hyphen.tex ! Duplicate pattern. l.6 .ach4 (that's the first entry in the hyphen.tex file) –  Maja Jul 26 '11 at 19:06
    
You shouldn't load plain.tex in your customization file F.tex, it's already done by pdfetex.ini. You can add it to your question, so that we are able to check it. –  egreg Jul 26 '11 at 19:33
    
I added the files I used to my original post. Thanks again for the suggestions! –  Maja Jul 26 '11 at 20:04

You must add the patterns to the format. For this a suitable line must be added to your local language.def and then the formats must be regenerated. E.g. my local version of language.def contains beside others these lines

\addlanguage{ngerman}{loadhyph-de-1996.tex}{}{2}{2}
\addlanguage{ngerman-x-2009-06-19}{dehyphn-x-2009-06-19.tex}{}{2}{2}

In a modern tex installation the language.def is managed through a configuration GUI. E.g. in miktex you should use the tab "languages" in miktex-settings.

share|improve this answer
    
Thanks for the suggestion, but it didn't help. I've added such a line in language.def, regenerated the format (as in, pdftex'd the format .tex file), tried to process the file with the given format and I got the "Undefined control sequence" error again. Also, I'm using TeXLive and I don't think there's a GUI where I could manage this. –  Maja Jul 26 '11 at 18:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.