9

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?

  • 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.? – twsh 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. – twsh Oct 16 '13 at 18:11
9

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...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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