# XeTeX - Load packages before fontspec

```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