4

Is it possible to insert a LaTeX file into another file without the same preamble?

3
  • Welcome to TeX.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. Commented Dec 6, 2012 at 9:50
  • 1
    Sure this is possible, but I think you should provide an example of the files you want to include. It is not clear to me exactly what you are trying to accomplish. Commented Dec 6, 2012 at 9:51
  • See the TeX FAQ multi-doc question for some approaches. Commented Dec 6, 2012 at 9:58

1 Answer 1

2

Not sure if I get your question right, but I guess you want to include one full LateX-document into another. For this you could try the includex-package. This package is not included in the standard TeX Live-distribution as it is in an unstable-branch of CTAN. In MikTeX it's included in package frankenstein. With this package you can do something like this:

% this is file input.tex
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\begin{document}
Dies ist der Text von input.
\end{document}

Now you use this file included in the main document (this is not working with \include- or \input-command!). It's important to load all packages used in the included files in the main file, as the preamble of the included files is ignored while processing main!

% this is file main.tex
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{includex}
\begin{document}
Dieser Text ist in main.
\includedocskip{input.tex}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .