1

I am trying to add hyphenation for the albanian language. After modifying languages.ini and adding the appropriate files, format is having problems reading two letters in patterns (ë and ç).

This was added in language.ini :

[albanian]
loader=loadhyph-al.tex
lefthyphenmin=2
righthyphenmin=2
patterns=hyph-al.pat.txt
hyphenation=hyph-al.hyp.txt

This is the content of loadhyph-al.tex :

\begingroup
\lccode`\'=`\'
% Test for pTeX
\ifx\kanjiskip\undefined
% Test for native UTF-8 (which gets only a single argument)
% That's Tau (as in Taco or ΤΕΧ, Tau-Epsilon-Chi), a 2-byte UTF-8 character
\def\testengine#1#2!{\def\secondarg{#2}}\testengine Τ!\relax
\ifx\secondarg\empty
    % Unicode-aware engine (such as XeTeX or LuaTeX) only sees a single (2-byte) argument
    \message{UTF-8 Albanian hyphenation patterns}
    \input hyph-al.tex
    \input hyph-quote-al.tex
\else
    % 8-bit engine (such as TeX or pdfTeX)
    \message{ASCII Albanian hyphenation patterns}
    \input hyph-al.tex
\fi\else
    % pTeX
    \message{ASCII Albanian hyphenation patterns}
    \input hyph-al.tex
\fi
\endgroup

This is the content of hyph-al.tex :

\patterns{
.bashkë1
.dh2
.fj8
.çm8 }

This is the content of hyph-quote-al.tex :

\bgroup
\lccode`\’=`\’
\patterns{
2’2
2ç’
2sh’
4s’
2t’
}
\egroup

This is the content of hyph-al.pat.txt :

.bashkë1
.dh2
.fj8
.çm8

And hyph-al.hyp.txt is empty.

The letter ë is not recognized as according to log :

("C:\Program Files\MiKTeX 2.9\tex\generic\hyph-utf8\patterns\tex\hyph-al.tex"

! Nonletter.

l.45 .bashkÃ

            «1

Sorry, but miktex-makefmt did not succeed for the following reason:

miktex-pdftex.exe failed on etex.ini.

Can I add something there so ë and ç are recognized ?

Checked hyph-tr.tex (turkish) and hyph-fr.tex (french) but they simply use special characters with no problems.

[EDIT] After solving the formatting error, LuaLaTex recognized the new language, but not XeLaTeX.

The document :

\documentclass[11pt]{book}
\usepackage[paperwidth=140mm,paperheight=210mm,top=25mm,bottom=20mm,left=20mm,right=20mm,heightrounded]{geometry}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{chngcntr}
\usepackage{tocloft}
\usepackage{polyglossia}

\setmainlanguage{albanian}

\begin{document}
test
\end{document}

Answer when compiling with XeLaTex :

Package polyglossia Warning: No hyphenation patterns were loaded for `Albanian'

(polyglossia)      I will use \language=\l@nohyphenation instead on input line 8.


Package polyglossia Warning: \setlocalhyphenmin useless for unhyphenated language albanian on input line 8.

Answer when compiling with LuaLaTex :

("C:/Program Files/MiKTeX 2.9/tex/latex/polyglossia/gloss-albanian.ldf"
Language data for albanian loader loadhyph-al.tex
righthyphenmin 2
lefthyphenmin 2
patterns hyph-al.pat.txt
hyphenation hyph-al.hyp.txt
synonyms table: 0000018D1841DD20

hyph-al.pat.txt
Language albanian was not yet loaded; created with id 4
Language albanian already loaded; id is 4
Language albanian already loaded; id is 4) (./test-hyphenation2.aux
Language albanian already loaded; id is 4)
  • 1
    Do you have written a loader file? (see e.g. loadhyph-fr.tex). Side remark: You shouldn't put your local files in C:\Program Files, and also not in the original hyph-utf8-folders. – Ulrike Fischer Oct 22 '17 at 13:24
  • yes created loadhyph-al.tex hyph-al.tex hyph-al.pat.txt and hyph-quote-al.tex. I will transfer them later to local folders, for the moment I just wanted to test – alfred Oct 22 '17 at 13:27
  • 1
    Well without all the files and the exact content of your languages.ini I can't test. – Ulrike Fischer Oct 22 '17 at 13:29
  • 2
    Why should I spent my time to build up a test environment? It is your problem. – Ulrike Fischer Oct 22 '17 at 13:34
  • 2
    Better than a zip file would be a MWE. Provide the contents of the smallest possible files containing the problem, and also specify the program invocation with which you try to build the format. – Harald Hanche-Olsen Oct 22 '17 at 13:37
2

In the loadhyph-al.tex you are missing to load conv-utf8-ec.tex which adds the definitions for the non-ascii letters:

\else
    % 8-bit engine (such as TeX or pdfTeX)
    \message{ASCII Albanian hyphenation patterns}
     \input conv-utf8-ec.tex %<-----------
    \input hyph-al.tex
\fi

Side remark: The ptex-case normally needs its own set of hyphenation patterns (see e.g. the french loader, where hyph-fr.ec.tex is used here). If you don't want to create them, it would be imho better to simply remove this case. Better no pattern than wrong patterns,

  • Ok I will remove ptex. LuaLaTex/polyglossia is recognizing the language but not XeLaTex/polyglossia, any idea ? – alfred Oct 22 '17 at 14:29
  • Did you build the xelatex format? – Ulrike Fischer Oct 22 '17 at 14:35
  • I used MiKTeX Options (Admin)/Update formats. Xelatex showed last in the little window while working. – alfred Oct 22 '17 at 14:38
  • Add your tex document. – Ulrike Fischer Oct 22 '17 at 14:44
  • Added the tex document. Meanwhile the turkish patterns are a smarter example of what I should have done, maybe will rewrite the whole thing. – alfred Oct 22 '17 at 15:15

Your Answer

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

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