# How to disable package used by external document?

Doxygen uses its own `doxygen.sty` style file, but I'd like to keep the style of my document where I want to put the Doxygen's output. So I'd prefer to somehow to turn of its settings. For example, using `let` command I can keep old defenitions of commands that are being redefined by `renewcommand`. But what about unloading package (i.e. `sectsty`) or somehow disable its commands like `allsectionsfont`?

EDIT: I am trying to avoid any modification of `doxygen.sty` because it is autogenerated, so will be overwritten next time I change my sources and therefore will need to update the docs generated by Doxygen.

EDIT 2: The `-w` option of `doxygen` does what it exactly stated to: writes header, footer, and style to the files specified on the command line. What all these names correspon to is... well, consider the following structure of the final document (i.e. `refman.tex`) the Doxygen tool produces:

2. body;
3. footer;
4. Plus, styles that are `usepackage`d in the header.

What I struggle for is the body part of the document as header / footer I could provide myself, after all. I want to keep the textual structure of the document, i.e. chapters and `input`ted files generated for each of the source files, `class`, `struct`, etc.

Also, there still remains the problem of redefenition of several commands (such as `paragraph`, `subparagraph`) inside the Doxygen's style file. I want to disable them to keep the style of my main document consistent.

-
Is there any reason for not making a backup and modifying the contents of that `.sty` file? I never used Doxygen but shouldn't be a problem. –  percusse Jan 19 '12 at 10:00
@percusse See the EDIT section of my question. –  Dmitrii Volosnykh Jan 19 '12 at 10:07
I found this option in the documentation for a particular preamble. It seems that it writes its own preamble if you don't provide any. Also this looks relevant for selecting the style file. –  percusse Jan 19 '12 at 10:16
@percusse Thanks for you responses. See the EDIT 2 section, please. –  Dmitrii Volosnykh Jan 19 '12 at 10:58

If it's `doxygen.sty` that loads `sectsty`, for instance, it's sufficient to write in the document preamble

``````\makeatletter
\@namedef{ver@sectsty.sty}{}
\newcommand{\allsectionsfont}[1]{}
\makeatother
``````

before `\usepackage{doxygen}`. In this way LaTeX will think that `sectsty` has already been loaded when it finds the corresponding request when processing `doxygen.sty`. When `\allsectionsfont{\sffamily}`, say, is found in `doxygen.sty` LaTeX will have available only the definition above and so the command will have no effect.

-
If `doxygen` then uses any `secsty` commands, then these will be undefined… –  Seamus Jan 19 '12 at 12:12
@Seamus It's quite difficult to tell more about the problem without some example. But one can augment the code in my answer to make the relevant commands into no-ops. –  egreg Jan 19 '12 at 12:15

This attends to Seamus' comment, hopefully.

``````\usepackage{afterpackage}
\makeatletter
% \@namedef{ver@sectsty.sty}{}
\AfterPackage{sectsty}{\let\allsectionsfont\@gobble}
% Do the same for all the commands you wish to disable, but you have to know
% the arguments the commands expect.
\makeatother
``````
-