GeneralIncluding other tex documents

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
jwilley44
Posts: 1
Joined: Thu Feb 26, 2009 10:19 am

Including other tex documents

Post by jwilley44 »

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.

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

Including other tex documents

Post by Stefan Kottwitz »

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
LaTeX.org admin
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Re: Including other tex documents

Post by phi »

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.
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Including other tex documents

Post by Juanjo »

You may also try the combine document class.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Including other tex documents

Post by localghost »

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¹
Post Reply