# How does \usepackage work?

I have a style file which includes another `.sty` file with `\usepackage`. Everything works fine. Since this is a small file written by myself I decided to insert it verbatim at the same place were I use `\usepackage` in the surrounding file. But this results in errors. This gives raise to the general question in the title. More specific:

What do I have to do to make such an inclusion work?

-
In general we need a MWE to know what are the problems. A possibility in your case is that in your `.sty` file you have commands defined with `@` in their names. You can try to surround the content of the `.sty` file with `\makeatletter` (before it) and `\makeatother` after it. –  Guido Oct 6 '13 at 7:17
No, there are no such commands. The first error message is: Package titlesec Error: Entered in horizontal mode. –  Sophia Antipolis Oct 6 '13 at 7:42
`\usepackage` just arranges that `@` is a letter, checks the package name against any `\ProvidesPackage` in the included file and then does `\input`. You need to put the exact error message (and an example document) into your question but the error you described in a comment is not due to the things you describe in the question so there is an error in code you have not described. –  David Carlisle Oct 6 '13 at 9:28
`\usepackage` just arranges that `@` is a letter, checks the package name against any `\ProvidesPackage` in the included file and then does `\input`.