David Bickel schrieb:
Thanks, Uwe. I reproduced the error using the following file contents.
The problem is that the file exported from SWP has a huge amount of definitions in the document
preamble that are not used in the further document. For example the counter "MaxMatrixCols" is set.
This can only be done when the package "graphics" is loaded. When importing to LyX, LyX's tex2lyx
converter checks what packages are used in the document. But in your document you don't have any
graphic and matrix, therefore tex2lyx kicks out the unneeded package "graphics" and you then get an
error when compiling your document that MaxMatrixCols is unknown. This has been proven useful
because every unneeded package may cause problems or interferences with other packages. But although
the export from SWP contains unneeded definitions, your file must work.
Can you therefore please file a bug report at bugzilla.lyx.org (CC me there), I'll try for fix this
for the next LyX release.
How should I modify the preamble for proper import?
Delete the packages from the preamble of your LaTeX documents that are not used in the further
document. But to know that, you must be a LaTeX expert, therefore there's no general workaround.
The easiest way is to add all lines starting with
\usepackage
that have been deleted by LyX to the preamble of the LyX document got by
importing a TeX file.
To see what packages you need to add, use in LyX the menu View->Source and use there the option
"complete source". Then compare the \usepackage lines with that from the LaTeX file and add the
missing ones to the document preamble in LyX (menu Document->Settings).
regards Uwe