4

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

Visitor
  • 41

1 Answers1

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}