Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
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. –  Claudio Fiandrino Dec 6 '12 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. –  Peter Grill Dec 6 '12 at 9:51
    
See the TeX FAQ multi-doc question for some approaches. –  Andrew Swann Dec 6 '12 at 9:58
add comment

1 Answer

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.