GeneralUse Document as both Master and Slave

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Erik_Svendsen
Posts: 5
Joined: Thu Sep 08, 2011 9:20 am

Use Document as both Master and Slave

Post by Erik_Svendsen »

I have a document which needs to be a document on it's own and also an input document. For example:

Journalmaster:

Code: Select all

\documentclass[11pt,a4paper]{article}
\input{preamble.tex}
\begin{document}
\input{KravMaster.tex}
KravMaster:

Code: Select all

\documentclass[11pt,a4paper]{article}
\input{preamble.tex}
\begin{document}
\input{Krav1.tex}
My problem is that my both my Journalmaster and my Kravmaster both have \documentclass{...}, \input{preamble} and \begin{document}.

Is it possible to allow JournalMaster.tex to \input KravMaster.tex, eventhough Kravmaster has \documentclass, \input{preamble} etc.?

Recommended reading 2024:

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

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

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Re: Use Document as both Master and Slave

Post by kaiserkarl13 »

No, you can't---you could get around the \documentclass header by redefining that macro (e.g., \renewcommand{\documentclass}[1]{}}), but any packages you included in the slave document won't be loaded by the original document. You would also run into trouble with \bibliography and \begin{document} and \end{document}. Probably some others as well.

However, you already have Krav1.tex as a separate file---why not simply include it in both places?
Post Reply