summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-multidoc.html
blob: efe889bf4f9edd3e4968533120e94a0849d454ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<head>
<title>UK TeX FAQ -- question label multidoc</title>
</head><body>
<h3>A &#8216;report&#8217; from lots of &#8216;article&#8217;s</h3>
<p/>This is a requirement, for example, if one is preparing the
proceedings of a conference whose papers were submitted in LaTeX.
<p/>The nearest things to canned solutions are Peter Wilson&#8217;s
<i>combine</i> and Federico Garcia&#8217;s <i>subfiles</i> classes, but
many approaches have been proposed.  Each of of the offerings has its
own advantages; in particular, several distinctly light-weight
solutions (for example, <i>includex</i> and <i>docmute</i>) are
available, well-suited to less formal documents.
<p/><i>Combine</i> defines the means to &#8216;<code>\</code><code>import</code>&#8217; entire documents,
and provides means of specifying significant features of the layout of
the document, as well as a global table of contents, and so on.  The
complete set of facilities is pretty complex.  An auxiliary package,
<i>combinet</i>, allows use of the <code>\</code><code>title</code>s and <code>\</code><code>author</code>s
(etc.) of the <code>\</code><code>import</code>ed documents to appear in the global table
of contents.  The basic structure of a combined document would be:
<blockquote>
<pre>
\documentclass[...]{combine}
...
\begin{document}
...
&#60;introductory materiel&#62;
...
\begin{papers}
% title and author of first article,
% to go the the main ToC
\coltoctitle{...}
\coltocauthor{...}
\label{art1}
\import{art1}
...
\end{papers}
...
&#60;acknowledgements, etc.&#62;
...
\end{document}
</pre>
</blockquote><p>
<p/>The <i>subfiles</i> class is used in the component files of a multi-file
project, and the corresponding <i>subfiles</i> package is used in the
master file; so the structure of the master file looks like:
<blockquote>
<pre>
\documentclass{&#60;whatever&#62;}
...
\usepackage{subfiles}
...
\begin{document}
...
\subfile{subfile_name}
...
\end{document}
</pre>
</blockquote><p>
while a subfile has the structure:
<blockquote>
<pre>
\documentclass[mainfile_name]{subfiles}
\begin{document}
...
\end{document}
</pre>
</blockquote><p>
Arrangements may be made so that the component files will
be typeset using different page format, etc., parameters than those
used when they are typeset as a part of the main file.
<p/>A more &#8216;raw&#8217; toolkit is offered by Matt Swift&#8217;s <i>includex</i> and
<i>newclude</i> packages, both part of the <i>frankenstein</i>
bundle.  Note that Matt believes <i>includex</i> is obsolete
(though it continues to work for this author); furthermore, its
replacement, <i>newclude</i> remains &#8220;in development&#8221;, as it has
been since 1999.
<p/>Both <i>includex</i> and <i>newclude</i> enable you to
&#8216;<code>\</code><code>includedoc</code>&#8217; complete articles (in the way that you
&#8216;<code>\</code><code>include</code>&#8217; chapter files in an ordinary report).  The preamble
(everything up to <code>\</code><code>begin{document}</code>), and everything after
<code>\</code><code>end{document}</code>, is ignored by both packages.  Thus the
packages don&#8217;t &#8220;do the whole job&#8221; for you, though: you need to
analyse the package use of the individual papers, and ensure that a
consistent set is loaded in the preamble of the main report.  (Both
packages require <i>moredefs</i>, which is also part of the
bundle.)
<p/>A neat (and simple) toolkit is offered by the
<i>docmute</i> package; once the package is loaded, anything
between <code>\</code><code>documentclass[...]{...}</code> and
<code>\</code><code>begin{document}</code> in an <code>\</code><code>input</code>&#8217;ed or <code>\</code><code>include</code>&#8217;d
document is ignored, and then the input is processed up to
<code>\</code><code>end{document}</code> in the input file.  The package does nothing
about <code>\</code><code>usepackage</code> (or anything else) in the preamble of the
included document; it&#8217;s up to the user to ensure that any packages
needed are loaded, and any other necessary configuration is done, in
the parent document.
<p/>The <i>standalone</i> package develops on the ideas of
<i>docmute</i>; it was designed to meet the needs of users who are
developing images from one of the more extreme new graphics packages
(notably <i>pgf/tikz</i>) where the compile time of the graphics is
such that separate compilation is very desirable.
<i>Standalone</i> provides a means of developing the graphics in a
convenient way, detached from the development of the document as a
whole; its value for use in multiple documents is clear.
<p/>The user includes the <i>standalone</i> package in the main
document, and each subfile uses the <i>standalone</i> class.
(<i>Standalone</i> uses <i>article</i> for the &#8220;real&#8221; work in
stand-alone mode, but it may be asked to use another).
<p/>The real difference from the <i>docmute</i> package is
flexibility.  In particular, you can ask that the preambles of the
included documents be gathered up, so that you can construct a good
preamble for the master document.
<p/>A final &#8220;compile-together&#8221; approach comes from the <i>subdocs</i>
package.  The driver file contains a <code>\</code><code>subdocuments</code> command:
<blockquote>
<code>\</code><code>subdocuments[</code><em>options</em><code>]{</code><em>file1, file2, ...</em><code>}</code>
</blockquote><p>
(the optional arguments provide layout options, such as control over
whether <code>\</code><code>clearpage</code> or <code>\</code><code>cleardoublepage</code> are used between the
files).  Each of the sub-files will execute
<blockquote>
  <code>\</code><code>usepackage[</code><em>master</em><code>]{</code><em>subdocs</em><code>}</code>
</blockquote><p>
to declare the name, <code><em>master</em></code>, of the calling file;
each of the subfiles reads all the <code>.aux</code> files, so that
tables of contents may be produced.
<p/>A completely different approach is to use the <i>pdfpages</i>
package, and to include articles submitted in PDF format into a
a PDF document produced by PDFLaTeX.  The package
defines an <code>\</code><code>includepdf</code> command, which takes arguments similar to
those of the <code>\</code><code>includegraphics</code> command.  With keywords in the
optional argument of the command, you can specify which pages you want
to be included from the file named, and various details of the layout
of the included pages.
<dl>
<dt><tt><i>combine.cls</i></tt><dd><a href="http://mirror.ctan.org/macros/latex/contrib/combine.zip">macros/latex/contrib/combine</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/combine/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/combine.html">catalogue entry</a>
<dt><tt><i>combinet.sty</i></tt><dd><a href="http://mirror.ctan.org/macros/latex/contrib/combine.zip">macros/latex/contrib/combine</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/combine/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/combine.html">catalogue entry</a>
<dt><tt><i>docmute.sty</i></tt><dd><a href="http://mirror.ctan.org/macros/latex/contrib/docmute.zip">macros/latex/contrib/docmute</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/docmute/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/docmute.html">catalogue entry</a>
<dt><tt><i>includex.sty</i></tt><dd>Distributed in the &#8220;unsupported&#8221; part of
  <a href="http://mirror.ctan.org/macros/latex/contrib/frankenstein.zip">macros/latex/contrib/frankenstein</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/frankenstein/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/includex.html">catalogue entry</a>
<dt><tt><i>moredefs.sty</i></tt><dd>Distributed as part of <a href="http://mirror.ctan.org/macros/latex/contrib/frankenstein.zip">macros/latex/contrib/frankenstein</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/frankenstein/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/moredefs.html">catalogue entry</a>
<dt><tt><i>newclude.sty</i></tt><dd>Distributed as part of <a href="http://mirror.ctan.org/macros/latex/contrib/frankenstein.zip">macros/latex/contrib/frankenstein</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/frankenstein/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/newclude.html">catalogue entry</a>
<dt><tt><i>pdfpages.sty</i></tt><dd><a href="http://mirror.ctan.org/macros/latex/contrib/pdfpages.zip">macros/latex/contrib/pdfpages</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/pdfpages/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/pdfpages.html">catalogue entry</a>
<dt><tt><i>standalone.cls, standalone.sty</i></tt><dd><a href="http://mirror.ctan.org/macros/latex/contrib/standalone.zip">macros/latex/contrib/standalone</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/standalone/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/standalone.html">catalogue entry</a>
<dt><tt><i>subdocs.sty</i></tt><dd>Distributed as part of <a href="http://mirror.ctan.org/macros/latex/contrib/bezos.zip">macros/latex/contrib/bezos</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/bezos/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/subdocs.html">catalogue entry</a>
<dt><tt><i>subfiles.cls, etc.</i></tt><dd><a href="http://mirror.ctan.org/macros/latex/contrib/subfiles.zip">macros/latex/contrib/subfiles</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/subfiles/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/subfiles.html">catalogue entry</a>
</dl>
<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=multidoc">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=multidoc</a>
</body>