Add 2012 to FSF copyright years for Emacs files
[bpt/emacs.git] / doc / lispref / two-volume-cross-refs.txt
CommitLineData
acaf905b 1Copyright (C) 2001-2012 Free Software Foundation, Inc.
95df8112 2See end for copying conditions.
a05074b9 3
9f8bbf0f
EZ
4Two Volume Cross References
5===========================
6
c85c5553
KB
712 June 2007 (karl)
8
9For lispref 2.9 (for Emacs 22, June 2007), I created a very ugly
10Makefile, in the file two-volume.make, to encapsulate all the steps
11below, without manual intervention. In theory, simply running "make -f
12two-volume.make" should create a vol1.pdf and vol2.pdf with all the
13niceties worked out.
14
15One issue not explicitly discussed below is getting page numbers right.
16It's not enough to go through the whole process. You have to go through
17the whole process twice -- otherwise, some index entries and/or toc
18entries will be off by one. See two-volume.make for a few more comments.
19
20For future editions, it should suffice to update the usual things in
21vol[12].texi (as well as elisp.texi). That was my hope, anyway.
22
23
2418 March 1992 (bob)
9f8bbf0f
EZ
25
26This enables you to create manuals in *two* volumes, with tables of
27contents, cross references, and indices in each volume referring to
28*both* volumes.
29
30The procedure is tedious. However, the resulting two volumes are
31conveniently organized. Each has an index of the whole two volumes.
32Each volume starts with page 1. (I don't like multi-volume works
33where each volume starts with a higher page number since I find it
34harder to go to the right place in the volume.)
35
36References to the same volume are just the page number; references to
ee7683eb 37the other volume are a volume number (in Roman numerals) preceding
9f8bbf0f
EZ
38the page number.
39
40For example, in Volume I:
41
42 list length ......... 90
43 list motion ......II:117
44
45and in Volume II:
46
47 list length ....... I:90
48 list motion .........117
49
50All other references and the table of contents work the same way. I
177c0ea7 51find this *very* helpful.
9f8bbf0f
EZ
52
53
54In brief: you run tex on a .texi file with
55
56 a. redefined @contents and @summarycontents inputting elisp-toc-2vol.toc file
57 b. redone .aux file
58 c. redone .fns file
59
60\f
61Here are the steps in detail:
62
c976c1d4
EZ
63% tex vol1.texi
64% texindex vol1.??
65% tex vol1.texi
9f8bbf0f 66
c976c1d4
EZ
67% tex vol2.texi
68% texindex vol2.??
69% tex vol2.texi
9f8bbf0f
EZ
70
71### Create .aux files with volume numbers for other volume.
72
c976c1d4
EZ
73% cp vol1.aux elisp1-aux
74% cp vol2.aux elisp2-aux
9f8bbf0f 75
c85c5553
KB
76% cp vol1.aux elisp1-aux-vol-added
77% cp vol2.aux elisp2-aux-vol-added
9f8bbf0f
EZ
78
79on elisp1-aux-vol-number-added
c85c5553
KB
80(volume-aux-markup 1) see defun for volume-aux-markup below.
81to create elisp1-aux-vol-added
9f8bbf0f
EZ
82
83on elisp2-aux-vol-number-added
84(volume-aux-markup 2)
c85c5553 85to create elisp2-aux-vol-added
9f8bbf0f 86
c85c5553
KB
87insert elisp2-aux-vol-added into vol1.aux (append)
88insert elisp1-aux-vol-added into vol2.aux (prepend)
9f8bbf0f 89
c7015153 90(so you don't have to do it again)
c85c5553
KB
91% cp vol1.aux elisp1-aux-ready
92% cp vol2.aux elisp2-aux-ready
9f8bbf0f
EZ
93
94
95### Create .fn files with volume numbers for other volume.
96
c976c1d4
EZ
97% cp vol1.fn elisp1-fn
98% cp vol2.fn elisp2-fn
9f8bbf0f 99
c976c1d4
EZ
100% cp vol1.fn elisp1-fn-vol-number-added
101% cp vol2.fn elisp2-fn-vol-number-added
9f8bbf0f
EZ
102
103on elisp1-fn-vol-number-added
104(volume-index-markup "I")
105to create elisp1-fn-vol-number-added
106
107on elisp2-fn-vol-number-added
108(volume-index-markup "II")
109to create elisp2-fn-vol-number-added
110
c976c1d4
EZ
111insert elisp2-fn-vol-number-added into vol1.fn: do following `cat'
112insert elisp1-fn-vol-number-added into vol2.fn: do following `cat'
9f8bbf0f 113
c976c1d4
EZ
114% cat elisp2-fn-vol-number-added >> vol1.fn
115% cat elisp1-fn-vol-number-added >> vol2.fn
9f8bbf0f
EZ
116
117Be sure to handle special case entries by hand.
118Be sure that .fn file has no blank lines.
119
c976c1d4
EZ
120% texindex vol1.fn
121% texindex vol2.fn
9f8bbf0f 122
c7015153 123(so you don't have to do it again)
c976c1d4
EZ
124% cp vol1.fns elisp1-fns-2vol-ready
125% cp vol2.fns elisp2-fns-2vol-ready
9f8bbf0f
EZ
126
127### Create merged .toc file with volume number headings.
128
c976c1d4 129append vol2.toc to vol1.toc with following `cat'
9f8bbf0f 130
c976c1d4 131% cat vol1.toc vol2.toc > elisp-toc-2vol.toc
9f8bbf0f
EZ
132
133and edit in Volume titles
134
135\unnumbchapentry {Volume 1}{}
136\unnumbchapentry {}{}
137
138\unnumbchapentry {Index}{295}
139\unnumbchapentry {}{}
140\unnumbchapentry {Volume 2}{}
141\unnumbchapentry {}{}
142
143If you want to put in volume numbers for TOC, then do this:
144Create volume specific .toc files with volume numbers in them.
145
146% cp elisp-toc-2vol.toc elisp1-toc.toc
147% cp elisp-toc-2vol.toc elisp2-toc.toc
148
177c0ea7 149Use keyboard macro to put I: in first half of elisp1-toc.toc and
9f8bbf0f
EZ
150II: in first half of elisp2-toc.toc
151
152Copy the tocs to something you can remember more easily
153
177c0ea7
JB
154% cp elisp2-toc.toc elisp1-toc-ready.toc
155% cp elisp1-toc.toc elisp2-toc-ready.toc
9f8bbf0f 156
177c0ea7
JB
157Then, edit vol1.texi to input elisp1-toc-ready.toc
158and vol2.texi to input elisp2-toc-ready.toc
9f8bbf0f
EZ
159
160
161### Now format the two volumes:
162
c976c1d4
EZ
163% cp elisp1-aux-2vol-ready vol1.aux
164% cp elisp2-aux-2vol-ready vol2.aux
9f8bbf0f 165
c976c1d4
EZ
166% tex vol1.texi
167% tex vol2.texi
9f8bbf0f
EZ
168
169
170\f
171For every additional run:
172
173### recopy aux files so the correct ones are read:
c976c1d4
EZ
174% cp elisp1-aux-2vol-ready vol1.aux
175% cp elisp2-aux-2vol-ready vol2.aux
9f8bbf0f
EZ
176
177Do not run texindex. Then proper sorted index will stay.
c976c1d4 178 else do: % cp elisp2-fns-2vol-ready vol2.fns
9f8bbf0f
EZ
179
180Do not change the .texi files; they will call the elisp-toc-2vol.toc file.
181
c976c1d4
EZ
182% tex vol1.texi
183% tex vol2.texi
9f8bbf0f 184
9f8bbf0f
EZ
185================================================================
186\f
187
188(defun volume-aux-markup (arg)
189 "Append `vol. NUMBER' to page number.
190Apply to aux file that you save.
191Then insert marked file into other volume's .aux file."
192 (interactive "sType volume number, 1 or 2: " )
193 (goto-char (point-min))
194 (while (search-forward "-pg" nil t)
195 (end-of-line 1)
196 (delete-backward-char 1 nil)
197 (insert ", vol.'tie" arg "}")))
198
199(defun volume-index-markup (arg)
200 "Prepend `NUMBER:' to page number. Use Roman Numeral.
177c0ea7 201Apply only to unsorted index file,
9f8bbf0f
EZ
202Then insert marked file into other volume's unsorted index file.
203Then run texindex on that file and save."
204 (interactive
205 "sType volume number, roman number I or II: " )
206 (goto-char (point-min))
207 (while (search-forward "\\entry" nil t)
208 (search-forward "}{" (save-excursion (end-of-line) (point)) nil)
209 (insert arg ":")))
210
211
212================================================================
213\f
214
215The steps:
216
2171. Run TeX, texindex and TeX on file1.
2182. Run TeX, texindex and TeX on file2.
219
177c0ea7 2203. Copy both .aux files into specially named files
9f8bbf0f 221
177c0ea7 2224. In the case of the elisp ref manual,
9f8bbf0f 223
177c0ea7 224 copy the *unsorted* function index files into specially named files
9f8bbf0f
EZ
225 (no other index used in elisp ref manual)
226
227
2285. For aux files:
229
230 Run a function on the specially named .aux files to label each
231 entry according to volume. Save these files.
232
177c0ea7 233 i.e., convert
9f8bbf0f
EZ
234 'xrdef {Special-pg}{7} to 'xrdef {Special-pg}{7, vol.'tie1}
235
2365a.Insert each specially named .aux file into the regular .aux file of
237 the other volume.
238
2396. For index files:
240
241 Run a function on the specially named unsorted index files to label
242 each entry according to volume. Save these files.
243
2446b.Insert each specially named marked unsorted index file into the
245 regular unsorted file of the other volume. Run texindex on this
246
2477. Insert the other volumes .toc file into the .toc, edit, and rename to
248 elisp-toc-2vol.toc
249
2507a. insert special @contents and @summarycontents defs into .texi files.
251
2528. Run TeX on each .texi file.
253
254================
255
256
257\f
258Here is the discursive commentary:
259
260I've been running some small test files, called test1.texi and
261test2.texi. As far as I can see, if we run tex on the two test files,
262tex creates a .aux for each that includes the names of all the nodes
263in that file. The node names are used for cross references.
264
265If you insert the .aux file for the second test file, test2.aux, into
266the .aux file for the first test file, test1.aux, then when you next
267run TeX on the first test file, test1.texi, the second volume cross
268references are inserted.
269
270You can edit the text of the cross reference in test2.aux to include
271the volume number.
272
273For example, you can take the following two lines from test1.texi and
274insert them into test2.texi:
275
276 'xrdef {Special-pg}{7}
277 'xrdef {Special-snt}{Section'tie1.6}
278
279You can re-edit this to show that the page is in volume 1:
280
281 'xrdef {Special-pg}{7, vol.'tie1}
282 'xrdef {Special-snt}{Section'tie1.6}
283
284(The 'tie is a TeX special command to keep the number tied on one
285line to the previous word. I don't know if it works after a period in
286the "vol." but figure it is worth trying. {The ' is the @ of .aux files.}
287Apparently 'tie is like the tilde in plain tex; in texinfo.tex, the
288definition for 'tie is the following:
289
290 \def\tie{\penalty 10000\ } % Save plain tex definition of ~.
291
292)
293
294After running tex on the test2.texi file with the augmented test2.aux
295file, you can see the following in the resulting DVI file:
296
297 See Section 1.6 [Special], page 7, vol. 1
298
299Note that TeX rewrites the .aux file each time TeX is run, so after
300running Tex using an .aux file augmented with the .aux file from the
301other volume, the new .aux file will *lack* the other volumes cross
302references. Save your augmented .aux file in some other name for
303another run!
a05074b9
GM
304
305
306COPYING CONDITIONS
307
352c8b4a 308This file is free software: you can redistribute it and/or modify
a05074b9 309it under the terms of the GNU General Public License as published by
352c8b4a
GM
310the Free Software Foundation, either version 3 of the License, or
311(at your option) any later version.
a05074b9
GM
312
313This file is distributed in the hope that it will be useful,
314but WITHOUT ANY WARRANTY; without even the implied warranty of
315MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
316GNU General Public License for more details.
317
318You should have received a copy of the GNU General Public License
352c8b4a 319along with this file. If not, see <http://www.gnu.org/licenses/>.