[XeTeX] polyglossia becoming reality...

François Charette firmicus at ankabut.net
Thu Jan 10 16:39:46 CET 2008


Jonathan Kew a écrit :
> On 10 Jan 2008, at 10:34 am, François Charette wrote:
>
>   
>> By the way: when trying test1.tex I have encountered two problems I
>> cannot solve:
>>
>> * The command \today in Latvian does not print the year. I don't
>> understand why.
>>     
>
> If you add \relax before \number\year, it prints OK. The problem is  
> that "\inlineextras at latvian" ends with the macro    "\local at hyphenmins 
> {latvian}{2}{2}", which in turn expands to something ending with  
> "\lefthyphenmin=2\righthyphenmin=2". When TeX reads this, it looks  
> ahead past the final "2", to see if the number continues.... which it  
> does, if the next thing it finds is "\number\year"!
>
> You can show this is the problem by changing \today in gloss-latvian  
> to say
>
>        \number\year.\thinspace gada\showthe\righthyphenmin%
>
> which will show "22008" as the value of \righthyphenmin at that point!
>
> To fix this better, modify \local at hyphenmins in polyglossia.sty to  
> add a \relax:
>
> \newcommand{\local at hyphenmins}[3]{%
>     \@ifundefined{#1hyphenmins}%
>        {\lefthyphenmin=#2\righthyphenmin=#3\relax}%
>        {\csname #1hyphenmins\endcsname}%
>
> Then the individual gloss files don't need to watch out for initial  
> numbers in this situation.
>
>   
Wonderful, thanks Jonathan!


>> * I had to comment out \local at hyphenmins{russian}{2}{2} from
>> gloss-russian.ldf, otherwise the number 22 would be printed at the
>> beginning of the russian environment (and before the date). Again I  
>> find this very puzzling, because this does not occur with other languages.
>>     
>
> This comes from \local at hyphenmins trying to use the pre-existing  
> hyphenmins values; see:
>
> \newcommand{\local at hyphenmins}[3]{%
>     \@ifundefined{#1hyphenmins}%
>        {\lefthyphenmin=#2\righthyphenmin=#3\relax}%
>        {\csname #1hyphenmins\endcsname}%
> }
>
> The macro \russianhyphenmins (I guess it comes from Babel?), however,  
> simply expands to "22", not to the full \lefthyphenmin=.... commands.  
> So that's your "22" that appears in the text.
>   

OK, I found where it comes from: xu-ruhyphen.tex defines 
\lefthyphenmin=2 and \righthyphenmin=2 and hence \russianhyphenmins 
becomes hard-wired in xelatex.fmt (and expands to 22). Now I redefined 
\local at hyphenmins so that setting the hyphenmins will be forced even if 
they were previously defined:

\newcommand{\local at hyphenmins}[3]{%
   \@ifundefined{#1hyphenmins}{}% do nothing when undefined
   {\expandafter\xdef\csname #1hyphenmins\endcsname\relax}%
   \lefthyphenmin=#2\righthyphenmin=#3\relax%
}

Does that make sense?

More generally I have written a new hyphen.cfg (based on those that come 
with babel and antomega), which at one point should be used for creating 
the xelatex format (hopefully for TeXLive 2008). That will give us more 
control and allow us to eliminate the unnecessary portions of Babel's 
hyphenation code from xelatex.

F



More information about the XeTeX mailing list