I use LyX as a structured content editor. I mean, I need people write
the documentation of software manuals in a structured language and,
as they fear xml, I proposed LyX. So I wrote a .sty that contains
everything we need to generate manuals and documentation. This
includes commands Latex like:
...
\RequirePackage[latin1]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern}
\RequirePackage[frenchb,english]{babel}
\ifpdf
\RequirePackage[pdftex]{graphicx}
\RequirePackage[cmyk,fixpdftex,pdftex]{xcolor}
\else
\RequirePackage[dvips]{graphicx}
\RequirePackage[cmyk,dvips]{xcolor}
\fi
...
The problem now is that LyX automatically adds things like:
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage{babel}
so, as you might expect, this leads to crashes at compilation.
How to get rid of all those things LyX adds?
PS: Please note that I find this feature (automatically adding common
packages) very great. I know I use LyX a strange way and I shouldn't
include everything in a .sty file, but you know, people I work with
are far more strange than this ;)