I am new to Lyx and Latex.
I want to write my thesis in Lyx but the template provided by the university is for for LaTeX.
So, here is what I did:
- Created a new layout file called
mithesis.layout
- Created a class document called
mitheis.cls
in MikTex containing the same code as the cls file provided by the university. - Copied the tex file preamble options into lyx documents's preamble.
Everything is working fine, except for figure floats because I get an error saying There's an option clash for package graphicx
The package graphicx has already been loaded with options:
[]
There has now been an attempt to load it with options
[pdftex]
Adding the global options:
,pdftex
to your \documentclass declaration may fix this.
Try typing <return> to proceed.
I have checked the sty and cls files being used and I cannot find anywhere any reference to the package graphicx. The only place where I found the package is being loaded is in the LaTeX preamble of my Lyx document.
Any idea where else can the package be loaded from? Or any idea on how to solve this kind of issue?
Thanks.
Question also posted in
https://latex.org/forum/viewtopic.php?f=19&t=31294
Best Answer
If I understand correctly, you have added, among other things,
in Document --> Settings --> LaTeX preamble.
Don't.
When you insert an image in LyX, LyX will add
\usepackage{graphicx}
to the preamble of the generated.tex
file, before the stuff found in Document --> Settings --> LaTeX preamble. Hence, the result is that the complete preamble will havecausing the option clash error. If a package is loaded twice, the options passed to it a second time must be a subset of the options passed the first time, otherwise an error is thrown.
Note also that you shouldn't add the
pdftex
option to the package, as it's better to letgraphicx
figure out which driver to use.