Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
4  
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
1  
Then please add a minimal working example (MWE) that illustrates your problem, otherwise we cannot help you. –  Guido Oct 6 '13 at 8:29
5  
\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
    
@DavidCarlisle This answers my question. Please write an answer and I will accept it. My question was not what is my error (which is certainly purely accidental and therefore I did not include a MWE). I want to know a general method which works in all such cases. Thus, if a conflict with '@' is excluded there must be a conflict with the check against \ProvidesPackage, right? So what does this check do? –  Sophia Antipolis Oct 6 '13 at 12:38
show 1 more comment

1 Answer 1

up vote 13 down vote accepted

\usepackage just arranges that @ is a letter, checks the package name against any \ProvidesPackage in the included file and then does \input.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.