Is it possible to create a LaTeX preamble "header"?
That's a pretty basic mechanism in (La)TeX which you can also use to "separate out" other parts of your document.
Simply paste any number of lines into a new text file (say, file.tex
) and then input it by putting
\input{file}
in the place where the lines used to be (note you can leave out the .tex
extension).
\input
will act exactly like 'pasting' the file contents at the place it appears on.
If I understand your question correct, you want a file containing your preamble and you want to include it in every document. Then just put the parts of the preamble that are not document specific into a file and save that file somewhere in the LaTeX search path, e. g. $SOMETEXMFDIR/tex/latex/mypreamble/mypreamble.tex
. You can get a list of valid values for $SOMETEXMFDIR
by executing kpsewhich --expand-path='$TEXMFLOCAL'
(at least in TeX Live) if all users have to access the file. If you want to use it from your account only than kpsewhich --expand-path='$TEXMFHOME'
is the better choice.
You can then \input{mypreamble.tex}
in every document, see the answer from Stephan Lehmke.
For a more advanced technique see also the question How to make a standard preamble into a package.