I want to build a big PDF of multiple TeX files which will all have the same preamble. They'll have \newcommand and \renewcommand as well as \usepackage and \documentclass because each file should be standalone and compiled as a smaller PDF. But then, I want to take all of the files we have and put them in a main document. I've looked at the other questions:
- Include file with preamble to another tex file
- Make a .tex file that combines complete .tex documents in subdirectories
- Outsourcing TikZ code
- Manual for the
standalonepackage on CTAN
and the standalone package. I'm not sure I'll be able to do what I want with these.
Each child document needs to stand on it's own, with it's own preamble, and table of contents, etc. But they should be included in a master document with a global table of contents that ignores/copies all preambles.
Below is example code for one of the children files.
\documentclass[11pt]{article}
\usepackage{amsmath, amsfonts,amssymb,latexsym, multirow}
\usepackage{fullpage, graphicx, subfig, float, hyperref, enumerate}
\usepackage[parfill]{parskip}
\usepackage{pdflscape}%for large figures
\usepackage{cancel}
\linespread{1.3}
\hypersetup{backref,
pdfpagemode=FullScreen,
colorlinks=true}
\renewcommand{\dag}{^\dagger}
\renewcommand{\d}{\text{d}}
\newcommand{\D}{\text{D}}
\newcommand{\bra}{\langle}
\newcommand{\ket}{\rangle}
\newcommand{\comment}[1]{}
\newcommand{\p}{\partial}
\newcommand{\eq}[1]{\begin{align}#1\end{align}}
\begin{document}
\noindent \fbox{
\begin{minipage}{6.4in}
\medskip
\textbf{Book} \hfill \textbf{Author}
\begin{center}
{\Large Chapter #} \[3mm]
\end{center}
\today \hfill Subauthor
\medskip
\end{minipage}
}
\bigskip
\tableofcontents
\newpage
\section{}
\subsection{}
\end{document}
combinepackage may help. See http://tex.stackexchange.com/questions/119415/trying-to-create-simple-template-for-novice-users/119873#119873. You could also consider a master document withincludeandincludeonly. – Ethan Bolker Jun 19 '13 at 17:43\includeand\includeonlywill allow for a global preamble, but I can only compile a master document, not individual ones. – user1532974 Jun 19 '13 at 18:04combinepackage http://ctan.mackichan.com/macros/latex/contrib/combine/combine.pdf. It should be flexible enough to meet your needs. – Ethan Bolker Jun 19 '13 at 18:18