I create lots of LaTeX documents and put all my declarations into a header.tex that I use with \input{header.tex} at the beginning. However, I am migrated that into a header.sty and just use \usepackage{header} now.

Either way, my document always contains the same last lines that include a bibliography. I would like to move that into my header.sty as well. Is there some way to add end-of-document content into the preamble somehow?

The code that I have in mind is:


The \bibliographyfile is defined in the preamble already.

  • \AtEndDocument{your code} should do, but this 'fixes' probably to the same bibliography? – user31729 May 8 '14 at 9:34
  • It is just the \printbibliography of biblatex, so that does not really fix too much. – Martin Ueding May 8 '14 at 9:49
  • I am quite interested in this approach but not that experienced with latex - can you explain how you converted header.tex into header.sty? Or what resources you used to find out how! – FionaSmith May 8 '14 at 9:57
  • I was browsing the Wikibook and found a section on modular documents. I thought it packages were more complex, but that paragraph was sufficient. – Martin Ueding May 8 '14 at 10:36
  • Fab, thanks. It does look very simple. Sorry I can't help, by the way! – FionaSmith May 8 '14 at 12:07

I suppose, the request was something in the following manner, loading everything automatically in the header.sty file.

Please change the \DefaultBibliographyStyle at will.

\usepackage{blindtext} % Not needed really

%%%% Content for `header.sty`


%%%%%%%%%%% End stop copying it to the 'header.sty' file.



\cite{Lam94} and \cite{GSM97} wrote fine books about \LaTeXe and other things.\par


  • I just tried it out, the \AtEndDocument does the trick. – Martin Ueding May 8 '14 at 18:20

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.