On 2013-03-15, Enrico Forestieri wrote:
> On Thu, Mar 14, 2013 at 11:37:58PM +0100, Uwe Stöhr wrote:
>> Am 13.03.2013 15:20, schrieb Enrico Forestieri:

...

>> Thanks for the pointer, this is indeed a general issue. On my MiKTeX
>> system I only get problems with Serbian and Kazakh, Belorussian and
>> Mongolian works without problems. Could you kindly send me a LyX
>> file showing the problem with Belorussian and Mongolian? This would
>> help me to sort out if there are perhaps MiKTeX issues.

> I simply changed the document language of
> http://www.lyx.org/trac/raw-attachment/ticket/8590/cyrillic.lyx

Besides try-and error with different Cyrillic-using languages, you can
also look into Babel's *.ldf files for the respective languages. For
example russian.ldf comes with code to set the font encoding to one of
the Cyrillic encodings (OT2, T2A, T2B, T2C, X2). This may be missing in
some cases - where the user is expected to do this "by hand", usually by
giving the respective font encoding as last argument to "fontenc". This
should also be documented in the Babel documentation.

>> >You will notice that in all these cases the \textcyr macro is not used.

>> >This means that lyx thinks that the characters are representable in
>> >the given text encoding, but does not take into account that, using
>> >those languages, also the font encoding is to be properly matched.
>> >So, this is a more general problem, not addressed by your patch.

>> I see. But LyX defines \textcyr in the preamble. Why is it not used
>> for the text?

LyX assumes Babel to set the correct font encoding for Cyrillic-using
languages. \textcyr is inserted if you use Cyrillic characters in a
"non-Cyrillic" language like German or English.

OTOH, Babel currently has no support for "Serbian Cyrillic" and LyX
addresses this shortcoming only partially.

>> The other question is why we don't add
>> \AtBeginDocument{
>>  \DeclareFontEncoding{T2A}{}{}
>>  \fontencoding{T2A}\selectfont
>> }
>> when Serbian (Cyrillic) is used?

> Something like that should be added to the languages file.

However, 

* Only the font encoding switch should be done \AtBeginDocument.

* We also need the LICR definitions (\cyra ... \CYRYA). Therefore,
  instead of just a \DeclareFontEncoding{T2A}{}{} we must read in the
  font encoding definition file t2aenc.def

* The font encoding switch should be added for every language switch where
  it is not already done by Babel.
  
With Serbian (Cyrillic) this means something like
  
        PostBabelPreamble
        \input{t2aenc.def}
        \AtBeginDocument{\fontencoding{T2A}\selectfont}
        \addto\extrasserbian{\fontencoding{T2A}\selectfont}
        EndPostBabelPreamble

(check with the documentation whether \extrasserbian exists and is
supported.)
  
This still does not solve the issue with Latin script for auto-generated
strings (Glava for Chapter, etc.).
  
Therefore, the better idea would be to add a serbian-cyrillic ldf file
which should be a merger of serbian.ldf, with Cyrillic auto-strings and
the font encoding code from russian.ldf.

The new Babel maintainer is open for contributions.
http://www.ctan.org/pkg/babel-beta/

For other Cyrillic-using languages the state of the art must be checked and
accounted for individually.


Günter  

Reply via email to