GeneralHeader

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Header

Post by jhapk »

Hi,

I have a huge document and I am using a number of additional packages. Is there a way that I can put all my "\usepackage" commands in a separate file altogether rather than in the main tex file.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Header

Post by Stefan Kottwitz »

Hi,

that's no problem, use \input.
For instance create a file header.tex and load the packages there, in the preamble of your main document write

Code: Select all

\input{header}
Stefan
LaTeX.org admin
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Re: Header

Post by jhapk »

Hi Stefan,

thanks. That solved it. Just wondering, I tried to do the same thing, but instead of \input{}, I used \include{} and it gave me an error. Why is that?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Header

Post by Stefan Kottwitz »

\include may not appear in the preamble. It uses \clearpage before including, tha'ts not meaningful in the preamble.
\include is especially useful to swap out chapters, so it's a good idea to use it in a document body. \input is appropriate for small pieces of code or text.

Stefan
LaTeX.org admin
Post Reply