Is it possible to create a LaTeX preamble "header"?

Is it possible to create a header in LaTeX containing my usual preamble, functioning similar to a header in C? Specifically, can I write a text document (or something similar) with the preamble that I usually use, and type something in my documents' preambles that effectively pastes this document there? In particular, so that I can change this document, and have all of my TeX documents' preambles effectively updated? (I keep making small changes in one document, and updating all the others is getting rather troublesome. ) Thanks!

24.5k 3 3 gold badges 87 87 silver badges 141 141 bronze badges asked Aug 26, 2012 at 7:21 485 1 1 gold badge 4 4 silver badges 5 5 bronze badges Commented Aug 26, 2012 at 7:40

2 Answers 2

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

answered Aug 26, 2012 at 7:51 3,321 2 2 gold badges 21 21 silver badges 23 23 bronze badges

This is indeed exactly what I am asking, though I'm having trouble seeing where exactly to put the preamble file. I'm not sure how to use that command you gave. Thank you for the answer.

Commented Aug 26, 2012 at 8:01

@Curtis: The kpsewhich tool is a command line tool to search for TeX related stuff on your machine. It works in TeX Live, I think Miktex has a similar tool. The syntax may vary between different operating systems and TeX distributions, especially the escaping of the $. Google knows the valid commands and syntax for your OS and TeX distribution, but the principle holds.