TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
That's true, but wouldn't it apply to both 1. and 2.? – Tom Oct 16 '13 at 16:20
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
@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
up vote 9 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
Still searching... :) – texenthusiast Oct 16 '13 at 17:51

Your Answer


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.