Oscar Lopez wrote: > * if the lyx preamble consists of \input{foo.tex} it does not work and > the aforementioned error appears. If I enclose \input{foo.tex} between > \makeatletter and \makeatother then it works, which really puzzles me. > > *if the content of the preamble foo.tex is directly included in the lyx > preamble > everything work like expected.
The glyph '@' has two different meanings in LaTeX. It is used as an active char (inside the document) and (for instance) as a namespace delimiter (in classes). The latter is the case in your preamble snippet, e.g. in l...@mkboth\markboth To switch between these two meanings, the commands \makeatletter and \makeatother are used. In general, you always need to embrace preamble code with \makeatletter ... \makeatother if it contains an '@'. LyX does this automatically for you, that's why your document works if the code is inserted directly to the preamble. In former versions, Lyx blindly embraced any preamble with this pair. Now, it tries to be smart and only embraces it if the preamble actually contains an @-glyph. In the \include-version, this is not the case. The solution is a.) to embrace the original code accordingly, if it is in a normal tex file or b.) make it a real sty-File (where this is not needed). HTH, Jürgen