Hello,
I am trying to include other tex documents in a larger tex document (either with \include or \input). My problem is the the sub documents all have preambles (so that I can compile them), but having these prevents the larger main document from compiling correctly. Do I have to comment out the preambles before I include them into the main document or is there some other workaround.
Thanks in advance.
General ⇒ Including other tex documents
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
Including other tex documents
Hi,
you cannot include those tex files together with their preambles. You have to comment them out. But if their settings are different compared to the preamble of the main document they may look differently at the end.
You could also consider to compile each tex file separately and include their pdf output using \includepdf of the pdfpages package.
Stefan
you cannot include those tex files together with their preambles. You have to comment them out. But if their settings are different compared to the preamble of the main document they may look differently at the end.
You could also consider to compile each tex file separately and include their pdf output using \includepdf of the pdfpages package.
Stefan
LaTeX.org admin
Re: Including other tex documents
If you need the ability to compile the parts independently of each other, you can work with the \includeonly command. This omits all parts except the ones explicitly specified.
Including other tex documents
You may also try the combine document class.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Including other tex documents
Another possible solution could be the subfiles package. But there are some modifications necessary to get things work.
Best regards and welcome to the board
Thorsten¹
Best regards and welcome to the board
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10