I'm using the first option already since I need to pass options to the font definitions. Still the problem lies with fontspec not the font definition. I've also thought about the second method but that way I lose the nice integration with polyglossia since LyX will be using babel (instead of polyglossia) for multilingual text.
Spyros On 10/04/2011 10:54 AM, Guenter Milde wrote: > On 2011-10-01, Spyros Stathopoulos wrote: >> Hello everyone! I've been using TeX for quite a long time now but I'm new to >> LyX. I've managed to create some fairly long documents with it and XeTeX and >> I'm quite happy, however there is one little thing that troubles me. A lot of >> regular LaTeX packages that affect fonts need to be loaded before fontspec in >> order to work properly. One such package, for example, is mathdesign. In >> order >> to apply a mathdesign font to the math text using XeTeX/fontspec, mathdesign >> must be loaded before fontspec, like this > >> \usepackage[mdugm]{mathdesign} >> \usepackage{fontspec} >> ... > >> However, LyX automatically inserts fontspec at the very top of the preamble >> (actually, after amsmath but you get the point). Therefore if I put >> \usepackage[...]{mathdesign} in the preamble settings it always comes after >> fontspec and renders the fontspec font definitions useless. Of course the >> same >> happends if I \usepackage{fontspec} again in the preamble (since it's already >> loaded). > >> Is there any (hackish?) way to tell LyX to load mathdesign (or any other >> package) before fontspec? I'm using LyX 2.0.1 + TeXLive 2010 on ArchLinux. > > Two options: > > * Try with the font definitions in the user preamble, e.g. > > \setmainfont[Mapping=tex-text]{Asana Math} > ... > > (You can find the commands with View>Source ticking the "Complete source" > box. Set the GUI font selection to "Default" afterwards.) > > * - Leave "use non-Tex fonts" unchecked. > - Select Language>Encoding Unicode (utf-8) (XeTeX) > - Do the complete fontspec loading and configuration in the user preamble. > - View/Export with XeTeX. > > Günter >