# Separating the preamble to another file

What is the best practice for separating the preamble to a dedicated file?

I've seen two variants:

1. A package: preamble.sty and \usepackage{preamble}
2. A .tex file: preamble.tex and \input{preamble}

Which one is to be preferred?

• To be honest, the one that you like best :-) Either way is ok and good practice, though i prefer to write my own packages (with options and stuff). Having said that, if you want to implement any options, write a package :-) – Johannes_B Sep 2 '14 at 20:06
• I think the package version is logically more consistent, although in the absence of options the definition of \usepackage is more or less \input{#1.sty} so it doesn't make any difference in practice. – David Carlisle Sep 2 '14 at 20:12
• Definitely the separate .sty file option: In a style file that's loaded with a \usepackage statement, the @ ("at") character is immediately of category "letter", which makes all those \makeatletter and \makeatother statements unnecessary. – Mico Sep 2 '14 at 20:21

Preamble commands that add functionality to the document (e.g., defining macros) belong in a package (.sty file).
Preamble commands that define the look of the document (paper geometry, page headers, font selections), belong in a custom document class (.cls file). You can use high-level LaTeX commands to derive a custom class from a standard-issue class, and pass options to it.