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.

For a some simple cases it seems to me that there would be no important difference between

  1. putting some code in a file preamble.tex and having \input{preamble.tex} in the main .tex file
  2. putting it in a file preamble.sty (with appropriate modifications such as a \ProvidesPackage)

What are the pros and cons of each?

share|improve this question
2  
The biggest “contra” for this approach is that one tends to accumulate scores of packages that probably are not needed in a document. –  egreg Oct 16 '13 at 16:18
1  
That's true, but wouldn't it apply to both 1. and 2.? –  Tom Oct 16 '13 at 16:20
    
1  
I'd say that any differences between the two approaches must surely range between trivial and insignificant. E.g., having to remember to use \makeatletter and \makeatother to surround instructions that contain the character @ in the method based on \input preamble is one such difference that hopefully nobody will consider to be major. Far more important would have to be the decisions as to real stuff that should be in the file preamble.tex/preamble.sty. –  Mico Oct 16 '13 at 18:08
1  
@texenthusiast The answer you suggest is related, and helpful, but not a duplicate because I'm not comparing the package approach to having the code in the main file. –  Tom Oct 16 '13 at 18:11
add comment

1 Answer

up vote 8 down vote accepted

The differences are:

  1. You cannot pass package options in usepackage[<options>]{preamble} when using input{preamble} as \input has no optional arguments.

  2. For cases in which you need @ as a character in your macros, for example, you don't need \makeatletter and \makeatother when implementing package. But you really need \makeatletter and \makeatother when implementing with \input.

  3. Still searching...

share|improve this answer
6  
Still searching... :) –  texenthusiast Oct 16 '13 at 17:51
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.