On Feb 7, 2007, at 12:00 PM, Jean-Marc Lasgouttes wrote:
"Kevin" == Kevin Paunovic <[EMAIL PROTECTED]> writes:
Kevin> The problem now is that LyX automatically adds things like:
Kevin> \usepackage[T1]{fontenc} \usepackage[latin1]{inputenc}
Kevin> \usepackage{graphicx} \usepackage{babel}
Kevin> so, as you might expect, this leads to crashes at compilation.
Kevin> How to get rid of all those things LyX adds?
I am not sure I understand. Do you really need to keep the things that
are included in the preamble? Why?
I would prefer, in my case, to have an option to tell LyX to stop
putting things in the preamble except for the documentclass.
LyX is smart enough to add required packages (ex. graphicx when a
graphic is included) but unfortunatly, it can't see if a package was
(or will be) already loaded by the user.
In my case, I have a mystyle.sty file that contains:
%% mystyle.sty
\RequirePackage[pdftex]{graphicx}
\RequirePackage[cmyk,fixpdftex,pdftex]{xcolor}
%%
Now, if you include a graphic with LyX, you will get something like:
%%
\documentclass{...}
\usepackage{graphicx}
\usepackage{mystyle}
...
%%
and this crashes. You'll get:
%%%%
! LaTeX Error: Option clash for package graphicx.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.40 \RequirePackage
[cmyk,fixpdftex,pdftex]{xcolor}
?
! Emergency stop.
...
l.40 \RequirePackage
[cmyk,fixpdftex,pdftex]{xcolor}
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.
%%%%
Latex compiler suggests to include the driver name option to the
documentclass options. But this isn't possible for me because the
graphicx package is called inside a conditional (ifpdf to name it) to
load dvips if pdflatex is not used or pdftex if pdflatex is used.
Plus, the fixpdftex option is for pdfoutput only.
The best solution is to stop calling usepackage{graphicx} 2 times. I
can't avoid the second time, so I'm looking for a way to remove the
first occurency, that is, the one LyX automatically adds.
Kevin> PS: Please note that I find this feature (automatically adding
Kevin> common packages) very great.
Actually, LyX adds the packages that are required by the document
contents.
JMarc
Yep, I appreciate this feature, really. It will be perfect if one can
have a checkbox that enable or disable this feature, and if the
package names are written in a config file (and not hard-coded in the
executable). For example, LyX uses "graphicx". You know that there is
also a package called "graphics". What if one prefer using this one?
And what if a new package called "gfx" is released on CTAN and
improve greatly the old graphicx? This only is a suggestion, but
giving a customization method here would be great.
Kevin