2

Is it possible to create a template where you can import your preamble as well? How? So you have your main document which looks like:

\include{preamble}
\include{A}
\include{B}
\include{C}

And are there a reason why I not should do it? Thanks for help!

3
  • 1
    As far as I know, \include issues a newpage/clearpage etc, so this is some kind of 'typesetting' to be done, if you try to \include{preamble}, so I would guess this is not possible. You should be able to use \input{preamble} however
    – user31729
    Nov 5, 2014 at 18:36
  • Where do you want to place your \begin{document}...\end{document} pair in the 'template?
    – user31729
    Nov 5, 2014 at 18:41
  • 1
    I think what you want is \input{filename}. It merely puts the contents if the file filename to the position of input. Nov 5, 2014 at 18:51

1 Answer 1

4

Not \include but you can use \input so if you want

\input{preamble}
\include{A}
\include{B}
\include{C}
\input{postamble}

where preamble.tex is

\documentclass{article}
\usepackage{tikz}
\usepackage{array}
\begin{document}

and postamble.tex is

\end{document}

you can do that.

However I wouldn't: it obscures the form of your document.

If you want to share a lot of preamble macros in different documents I think it is better to use the form

\documentclass{article}
\usepackage{local-setup}
\begin{document}
\include{A}
\include{B}
\include{C}
\end{document}

where local-setup.sty is (in this case}

\usepackage{tikz}
\usepackage{array}

You must log in to answer this question.

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