LyXLyX xetex output problem with foreign languages

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
gatoatigrado
Posts: 6
Joined: Mon Dec 01, 2008 10:40 pm

LyX xetex output problem with foreign languages

Post by gatoatigrado »

Dear all,

LyX seems to be inserting some unnecessary codes for foreign characters. When I try to type Cyrillic, the following headers are added:

\usepackage[]{fontenc}
\usepackage[utf8]{inputenc}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\DeclareRobustCommand{\cyrtext}{%
\fontencoding{T2A}\selectfont\def\encodingdefault{T2A}}
\DeclareRobustCommand{\textcyr}[1]{\leavevmode{\cyrtext #1}}
\AtBeginDocument{\DeclareFontEncoding{T2A}{}{}}

These cause XeTeX to fail with the message, "Corrupted NFSS tables" (I believe it is the last command in particular, which causes the error). I have a stylesheet (before I started using LyX) which takes care of all of this in the (I believe) more modern XeTeX way. If there's a way to disable this header generation, that would be much appreciated. I believe the more modern way to achieve this is (for Cyrillic, replacing all statements above):

\usepackage{xunicode,fontspec,xltxtra}
\usepackage[english]{polyglossia}
\setotherlanguages{russian} % set as "other" so English hyphenation active

% other package imports here

\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\setromanfont{CMU Serif}
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}

If anyone knows a way to disable the built-in headers, that would be great! Otherwise, I will probably just postprocess it with a script.

Thanks very much,
Nicholas
Last edited by gatoatigrado on Fri May 07, 2010 7:02 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: xetex (xelatex) problem with foreign languages

Post by josephwright »

You shouldn't be using inputenc with XeTeX: it is natively UTF-8. Try removing that package, then see what happens.
Joseph Wright
gatoatigrado
Posts: 6
Joined: Mon Dec 01, 2008 10:40 pm

Re: xetex (xelatex) problem with foreign languages

Post by gatoatigrado »

I know, these are things LyX inserts. If one selects no input encoding, it inserts all of the LaTeX escape codes. I'll rename the title so it's more clear. Thanks anyway though.
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

LyX xetex output problem with foreign languages

Post by josephwright »

That sounds like a Lyx bug, really. With UF-8 input, XeTeX should be used "as is". Can you try compiling an example using XeLaTeX directly, rather than via Lyx, and see what happens?
Joseph Wright
furykerry
Posts: 3
Joined: Thu Jun 24, 2010 6:22 am

Re: LyX xetex output problem with foreign languages

Post by furykerry »

also has the probem with my Lyx 1.6.5

I workaround the problem by modify Lyx-> Tools-> preference
In the language settings section, uncheck box e.g. use babel etc
In the Output->Latex section,clear the "Tex encoding" field

You can view the tex source to ensure these unwelcome generated tex is removed.

Any better solution?
Post Reply