Debian Codegraph @

reports/book-latex.ll

raw
1 /*
2 ** @progname book-latex.ll
3 ** @author Nicklaus
4 ** @version 3.1
5 ** @category
6 ** @output LaTeX
7 ** @description
8 **
9 ** Generates really spiffy register reports for formatting with LaTex. Reports
10 ** read like a book. Includes source citation, footnotes, etc. Register
11 ** reports are either descendant or ancestor/ahnentafel style.
12
13 ** $Id: book-latex.ll,v 1.14 2005/11/19 05:30:30 memmerto Exp $
14 **
15 ** SourceForge Versions:
16 **
17 ** $Log: book-latex.ll,v $
18 ** Revision 1.14 2005/11/19 05:30:30 memmerto
19 ** - Add missing </PARA> tags, as per SF Patch 551968.
20 ** - Add "usepackage{isolatin1}" to register-tex.ll, as per SF Patch # 402021.
21 ** - Add comments about how to change between A4/Letter paper.
22 ** - Add -v (version) option; clean up -h/-? (usage) options, as per SF Feature Request # 1310390.
23 ** - Add "temp" and "random" hints to more file operations.
24 **
25 ** Revision 1.13 2005/10/26 04:40:45 dr_doom
26 ** make user property usage more consistent
27 **
28 ** Revision 1.12 2005/06/18 00:29:39 dr_doom
29 ** Update formatted docs, minor cleanup in merge families
30 **
31 ** Revision 1.11 2004/09/02 23:11:04 rsimms
32 ** Enhanced book-latex.ll to filter text to render harmless those
33 ** characters meaningful to the LaTeX system. Also added an option
34 ** to suppress e-mail addresses of source authors when they're specified
35 ** as EMAI subnodes of AUTH nodes. Also indented all of the code with
36 ** spaces (instead of tabs/spaces mix) to make the code easier to follow.
37 **
38 ** Revision 1.10 2004/07/19 05:54:54 dr_doom
39 ** Merge Vincent Broman Changes to reports
40 **
41 ** Revision 1.9 2003/01/19 02:50:23 dr_doom
42 **
43 ** Revision 1.8 2001/10/03 02:58:55 dabright
44 ** Restored some previous additions to this report.
45 ** The update from Dennis Nicklaus on 12 Aug 2001
46 ** had deleted them and he asked me to re-add them. So:
47 ** Add CREM (cremated) tag processing;
48 ** modified OCCU tag processing so that it can recognize date ranges
49 ** (and so avoid saying "xx is a yy and a zz and a ..."); modified
50 ** OCCU tag processing to recognize a subordinate AGNC tag indicating
51 ** employer; modified onDate to recognize date ranges (FROM dd mmm
52 ** yyyy TO dd mmm yyyy) - this still has some rough edges.
53 **
54 ** Revision 1.7 2001/08/12 20:53:59 nozell
55 ** Update by Dennis Nicklaus to his book-latex.ll
56 **
57 ** Revision 1.5 2000/11/28 21:39:45 nozell
58 ** Add keyword tags to all reports
59 ** Extend the report script menu to display script output format
60 **
61 ** Revision 1.4 2000/11/11 07:52:06 pere
62 ** Use ISO 8859/1 charset in LaTeX. Add meta-information in header.
63 **
64 ** Revision 1.3 2000/11/11 07:46:47 pere
65 ** Include index even when there is no bibliography.
66 **
67 ** Revision 1.2 2000/11/11 04:07:37 dabright
68 **
69 ** reports/book-latex.ll: Added processing for BAPM tag, corrected
70 ** error in referencing "spouse" rather than "s" in longvitals,
71 ** added processing for the TYPE tag (modifier for EVENT), corrected
72 ** setDayNumber so that it only uses text phrases (e.g., "on the same
73 ** day") when both previous date and current date are fully
74 ** specified, preserve line breaks represented by blank CONT/CONC
75 ** tags, ensure "cn" variable in sourceIt is initialized before
76 ** referenced, and miscellaneous typographical corrections.
77 **
78 **
79 ** Revision 1.1 2000/11/10 dabright
80 ** Initial revision - copy of Version 2.5 from Dennis Nicklaus
81 **
82 ** Pre-SourceForge history:
83 **
84 ## Dennis Nicklaus (dnicklaus at yahoo.com)
85 ** Version 2.5 Feb. 2000
86 **
87 ** Requires LifeLines version 2.3.3 or later
88 ** Requires tree.tex (for formatting) (tex macros for tree drawing).
89 ** (found in TUGboat, vol. 6 (1985) and online in various places,
90 ** including with the desc-tex lifelines report)
91 **
92 ** based on work by David Olsen ([email protected]) which in turn was
93 ** based on work originally done by Tom Wetmore ([email protected]).
94 ** also work by Kurt Baudendistel ([email protected]).
95 ** A few others, such as Ed Sternin ([email protected]) made other suggestions.
96 ** and corrections.
97 **
98 ** This report prints, in register/book format, information about all
99 ** descendants of a person (or persons) and all of their spouses.
100 ** It tries to understand as many different
101 ** GEDCOM tags as possible. All source information (SOUR lines) is in the
102 ** bibliography and footnotes.
103 **
104 ** An alternate usage (new in version 2) lets you print out sort of a
105 ** combination ahnentafel and register report going through the ancestors of
106 ** the persons chosen.
107 **
108 ** The output is in LaTeX format. Therefore, the name of the output file
109 ** should end in ".tex". To print (assuming the name of the output file is
110 ** "out.tex"):
111 ** latex out < ignore lots of warnings about underfull \hboxes >
112 ** makeindex out < not all systems have makeindex available
113 ** if yours is one, just remove the \input{file.ind} line
114 ** from the LaTeX output and skip the 'makeindex'>
115 ** latex out < repeat latex-ing to get cross-references resolved>
116 ** latex out < needed to get the index into the TOC>
117 ** < you may need to repeat more if Latex
118 ** says so, e.g. if page refs change. >
119 ** dvips -o out < without the -o, dvips will likely print to your
120 ** < default printer instead of creating a .ps file.
121 ** lpr out.ps
122 ** < the last three commands here may be replaced by >
123 ** pdflatex out -- if you have 'pdflatex' and a PDF is
124 ** the desired final product >
125 **
126 ** I admit that this is lot of post-processing, but the results are worth it.
127 **
128 ** NOTE ON PAPER SIZES:
129 ** Paper sizes (A4 or letter) can be specified within the LaTeX output,
130 ** but this requires editing by folks who don't like the default.
131 **
132 ** Since dvips (a neccessary processing step) can take a paper-size
133 ** argument on the command line, it's much simpler to let the user
134 ** specify the desired page size when running dvips (outlined above)
135 ** instead of editing the report/LaTeX output.
136 **
137 ** Example:
138 ** dvips -t letter out [ for US Letter-sized paper, 8.5x11" ]
139 ** dvips -t a4 out [ for ISO/European A4-sized paper, 8.3x11.7" ]
140 **
141 ** A special note about indexing. If you have names with double quotes in
142 ** them, e.g. Forrest "Foggy" Morrison, not the nice Latex quotes style:
143 ** Forrest ``Foggy'' Morrison, then the " marks will screw up the index.
144
145 If you'd like to credit me & this program in your
146 introduction if it's something you're really going to publish
147 that'd be nice (but not required).
148 Something like this could be used:
149 "This document was prepared using LifeLines v." version() " genealogical database program\n"
150 "by Thomas T.~Wetmore~IV, {\\tt [email protected]}. The script {\\tt book-latex}\n"
151 "by Dennis Nicklaus {\\tt dnicklaus at yahoo.com} was used to generate the \\LaTeX\\ code.\n"
152
153 */
154 /* WHAT DENNIS NICKLAUS DID:
155 I expanded this program greatly, mostly based on a "book" report
156 done by Kurt Baudendistel ([email protected]).
157 I combined what I liked best about register-tex and the book report.
158
159 numbering:
160 Register-tex had modified register numbering, where book
161 had no numbering, and just always referred to people by
162 page number, so I took the mod. reg. numbering.
163 sources/bibliography:
164 book had really nice SOUR support, so I took that
165 and modified it a little bit, so that it supports
166 a more std. gedcom usage of the SOUR definitions
167 (according to my reading of the std).
168 nothing needed in database:
169 book required that you have various things like CHAP
170 and PART additions to your lifelines gedcom database
171 in order to find who to include in the book.
172 I didn't include that
173 multiple-person selection:
174 On the other hand, maybe you want to include the
175 descendants of more than one person. I included the
176 ability (which was sort of there in book) of specifying
177 multiple people. For Instance, you might specify your
178 maternal grandfather and your paternal grandfather to
179 get all your first cousins on both sides into the same
180 book. This report asks you to keep selecting as many
181 people as you want. It does the complete descendancy
182 for each person selected. Each person so selected
183 starts a new chapter in the book. I make up a title
184 of the book based on the surnames of indi's chosen.
185 When you don't want to select any more people, just
186 hit return at the "select indi" prompt.
187 english sentences:
188 The book report was very good at automatically making
189 real sentences instead of just fragments. I used that.
190 I try to make compound sentences using "and" whenever
191 possible, and this makes for a lot of rules in the
192 code to try to handle a lot of cases. I probably missed a
193 few where the English will still come out poorly.
194 placename smarts:
195 Also from book is the ability to recognize a place which
196 is used multiple times. For instance, the first time
197 it sees Keswick,Keokuk Co.,Iowa, it'll print the whole
198 thing. But then every subsequent time, it'll just print
199 Keswick. Makes things VERY readable, but it can leave
200 some ambiguous things, like if you have two Keswick's,
201 it might be hard to figure out which is meant.
202 Likewise, I picked up ADDR support from book.
203 if you have:
204 2 PLAC thattown
205 3 ADDR thisplace
206 It'll say "at thisplace in thattown". Simply having
207 2 PLAC results in "in thattown".
208 One thing I did change from book was making sure
209 it always says "in thattown" after saying "at thisplace".
210 Book was happy just saying "at thisplace" and assuming
211 you know what it meant.
212 But if you have several of
213 2 PLAC Town,County,State
214 3 ADDR his home
215 Then just saying "at his home" doesn't do much, so I made
216 sure it always says at least "at his home in Town".
217 (the first time, it'd say, "at his home in Town,County, State".)
218 (also useful if you have lots of different St. Mary's, e.g.)
219 I also made it watch for words like "near, north,..."
220 for the "town" part of the place, so that it doesn't say
221 something icky like "in near Mytown".
222 many events:
223 register-tex supported a lot more GEDCOM fields, so
224 I tried to include all of them.
225 But I personally don't use all of them, so some may look ugly.
226 charts: I added a feature that makes it draw 3 gen desc. tree charts
227 for any indi who heads up a chapter. I took code
228 from desc-tex to do this. (and modified it slightly
229 because it didn't work for some cases).
230 So you need the tree.tex macros, which this will
231 try to include.
232 Note: I modified the tree.tex macro a little bit
233 to scrunch things up because I have some ancestors
234 with huge families, and all their 10 kids had big families,
235 so I had to scrunch the spacing to fit 3 gen. onto one page.
236
237 I dropped most of the pedigree chart capabilities in book,
238 but I did add one thing to look for the something like:
239 1 NOTE BOOKPEDIGREE
240 on each indi. If a note like that is found for an indi,
241 that indi's pedigree (8 gen, I think) will be printed
242 as a latex figure in the book. I find this useful,
243 for instance, when I do a book of all the desc. of
244 all the grandparents of my grandmother. I have
245 a BOOKPEDIGREE note on my grandmother so you can see
246 how all these lines fit together.
247
248 If you have
249 1 NOTE BOOKDESCENDENT
250 on an individual, it'll draw a 3-gen desc. chart for that person.
251
252
253 excursions: These are for when you are following one family
254 down, say SMITH, and one of the SMITHs marries a JONES.
255 If you want to include the JONES ancestry in this book,
256 but don't really want to follow every JONES descendant,
257 then if you put a note on the JONES person:
258 1 NOTE BOOKEXCURSION
259 That causes this report to wait until the end of the
260 chapter, then make a subsection which goes to the
261 farthest male JONES ancestor, and document
262 the direct line between that JONES ancestor and the
263 JONES who married the SMITH. It doesn't follow
264 every JONES line down, but includes info about each
265 child of each direct JONES ancestor.
266
267 intro
268 I include the possibility that you might want to put
269 your own introduction before most of the book.
270 You can input your own intro file if you want.
271 It should contain all the Latex directives you want
272 also, such as \chapter{Introduction}.
273
274 grandchild divisions
275 Starting with the 4th generation down from each chapter head,
276 I group together sets of grandchildren with over and
277 under braces. (It doesn't make any sense to do it for
278 generations 1-3 because they'd all be in the same group.)
279 The idea is that if patriarch has kids A,B,C...
280 Then by generation 4, you'll get a grouping of A's grandkids
281 followed by B's grandkids, followed by C's grandkids.
282 Lots of intermarrying might occasionally confuse the
283 code which does this.
284
285 Chapter splits
286 If you put a
287 1 NOTE BOOKCHAPSPLIT
288 on the person who is a chapter head,
289 then each of his children will head up their own chapters with
290 the children of that head as Generation 1 in their respective chapters.
291 You should be careful not to have a BOOKCHAPSPLIT on anyone who
292 is not the head of a line, or it'll probably come out ugly.
293
294 Okay, now that you know how to produce a report, here are the formatting
295 conventions you must follow to get a good one. All records shown here are
296 optional, and all other records are okay -- they'll just be ignored by
297 the book report:
298
299 1 NAME - Multiple name records allowed. First is ``true name.''
300 - Later ones, with given but no surname, are ``nicknames''
301 or familiars.
302 - Later ones, with surname but no given, are aliases or
303 alternate spellings.
304 - Later ones, with both surname and given, are aliases.
305 - Post-titles, such as MD, should be included in this name.
306 2 SOUR ... - Source for name.
307 1 TITL ... - Pre-titles, such as Reverend. (but I don't call people
308 by their titl much. I mean after all, a person
309 isn't Captain John yet when they are born.
310 So I currently ignore this.)
311 1 SEX ...
312 1 SOUR ... - Source for parentage if no BIRT or CHR is given. This
313 produces better output than BIRT-SOUR records with no
314 DATE or PLAC given.
315 I also use this when I have a general source
316 which tells me everything about the person and
317 I don't want to mess things up by citing it
318 separately 8 times for birth, death, marr,...
319 1 evnt ... - BIRT, CHR, DEAT, BURI, CREM, MARR, DIV, DIVF, or ANUL,...
320 2 DATE ... - Date should be of format
321 [ABT|BEF|AFT|BET] [day] [JAN|...|DEC] [year] [-year for BET]
322 2 PLAC ... - Comma separated list of localities appropriate for the
323 expression ``in ...''.
324 3 ADDR ... - Location appropriate for the expression ``at ... in ...''.
325 3 CEME ... - Location appropriate for the expression ``at ... in ...''.
326 2 AGE ... - Age appropriate for the expression ``at age ...''.
327 2 CAUS ... - Cause of death appropriate for the expression
328 ``died of ...''.
329 2 SOUR ... - Source for event.
330 2 NOTE ... - Text to be inserted in book following technical details
331 of the event. (I use this instead of TEXT)
332 3 SOUR ... - Source for text.
333 1 OCCU ... - Description (title) of an occupation (job).
334 2 AGNC ... - Employer (produces "worked [or became] a <OCCU> with <AGNC>").
335 1 TEXT ... - Text to be inserted in book about the person.
336 I toyed with putting this before the death info,
337 but decided I like having all the vital stuff first,
338 then the more interesting text stuff.
339 2 SOUR ... - Source for text.
340 1 NCHI ... - Number of children (family records only).
341
342 n CONT ... - Appropriate for TEXT and SOUR.
343
344 You have the option of selecting either 1 TEXT, 1 NOTE or (not and)
345 only those 1 NOTE records which start with an ! (exclamation)
346 to include as the main body of text for each individual.
347
348 From the GEDCOM std, TEXT "contains information from the source document."
349 One might argue that I'm misusing it here. But it depends on what
350 kinds of things you use 1 TEXT for. It might be nicely readable and
351 technically appropriate if, for example, you copy a bio. of someone from
352 an old book and want it included in your printout. Also, in sort of
353 a self-referential way, you're including text from the book you
354 publish with this. :-)
355
356 I personally don't print out the "1 NOTE" records because I personally
357 (and feel it is common that most people) have a lot of garbage in their
358 notes, either general reminders to themselves, or PAF-style source notes
359 (e.g. 1 NOTE BIRTH-DEATH: whatever source)
360 However, with version 2.2, I give the option to print out either
361 all 1 TEXT, all 1 NOTE, or all 1 NOTE !-tagged notes. (where if the
362 1st char of the note is !, then the 1 NOTE gets included).
363
364 Something that I consider a typical 2 NOTE usage might be:
365 1 BURI
366 2 DATE when
367 2 PLAC somewhere
368 2 NOTE (with her parents)
369 But you do have to be a little aware of what this report is going
370 to generate if you want to make it a grammatically correct sentence
371
372
373
374 SOURCE records are complicated, but they produce great output.
375
376 To document a fact with a simple footnote, use
377
378 n SOUR ...
379 +1 CONT ...
380
381 This can get more complicated (all records optional):
382 (actually, I'm not sure what all is supported for footnotes
383 any more, I mostly use bibliography entries.)
384
385 n SOUR ...
386 +1 CONT ...
387 +1 PAGE ...
388 +1 VOLU ...
389 +1 NOTE ...
390 +2 CONT ...
391 +1 SOUR @id@
392
393 The +1 SOUR @id@ produces a citation to an entry in the bibliography,
394 not a footnote, that is attached to the text of the footnote. To get
395 a citation in the text itself, use
396
397 n SOUR
398 +1 SOUR @id@
399
400 or the more simple
401
402 n SOUR @id@
403
404 To create a bibliographic entry that can be referenced as a citation,
405 include a cross-reference definition. This can be included at the point
406 where a citation is wanted. However, since you will like re-use the
407 same citation many times and you'll want to be consist, define the
408 cross-reference definition separately.
409
410 A cross-reference definition takes this form (start at level 0)
411
412 n @id@ SOUR - no text allowed here
413 +1 AUTH ... - author of source
414 +2 EMAI ... - e-mail address of author (useful for fellow genealogists)
415 there is now an option to block e-mail addresses from
416 showing in the output (in their place is a mention that
417 one is on file)
418 +2 ADDR ... - postal address of author
419 +1 TITL ... - title of article or book
420 +1 PUBL - publishing info record
421 note that all these +2 things have to be under it for a bib. entry.
422 (rules are diff. for footnotes).
423 This is the way I read the 5.3 GEDCOM std.
424 +2 NAME ... - name of publication,e.g. journal
425 +2 PUBR ... - publisher name
426 +2 ADDR ... - address
427 +2 PHON ... - phone number
428 +2 DATE ... - date of pub.
429 +2 VOLU ... - volume or list or range
430 +2 NUM ... - number or list or range
431
432 +1 FILM ... - LDS film number
433 +1 FICH ... - LDS fiche number
434 +1 PAGE ... - page or list or range
435 +1 REPO ... - library name
436 +1 NOTE ... - free form text
437 +2 CONT ...
438 +1 SOUR @id@ - cite another source from bibliographic entry
439 +1 TEXT ... - free form text to print
440 +2 CONT ...
441
442 Note that the id can be most text that begins with an alphanumeric
443 character -- check your gedcom spec! Using a descriptive name of
444 the source that it represents, such as kurts-death-record or 0996198
445 (for film numbers) is a good idea.
446 (but Lifelines eats the nice names when it reads them in)
447
448 SEMI-BROKEN STUFF
449
450 A few problems you might notice:
451 I'm not really happy with the desc. trees in several other cases,
452 such as multiple spouses, and had to fix desctex a little bit
453 to make it work better. It still isn't perfect, I don't think.
454
455 The sentence structure may come out badly in some odd cases I haven't
456 encountered/tested yet. It's been a real pain to get it as
457 far as it is, and I'm still not happy with it. (It gets complicated
458 because I try to make compound sentences and use pronouns so
459 it isn't so choppy.)
460
461 The "test for common grandparents" thing was just the simplest
462 way of doing it I could think of. Not perfect, but works 99%.
463
464 I really want to put some smarts in so placename ambiguity is
465 less of a problem. For instance to distinguish the town of
466 Washington, Iowa from the state of Washington.
467
468 My LaTex is sort of rusty, and some things aren't really properly
469 done, possibly. (Like the spacing on the overbraces designed to
470 fill one column.) Also, it's line-filling is pretty weird sometimes,
471 such as just putting one or two words in the first line of a
472 person's description. I don't understand why it does that.
473
474 FOR VERSION 2:
475 I also now support a book which goes through an individual's
476 ancestors in ascending order. Numbering is ahnentafel style.
477 A new chapter for each generation.
478
479 FOR VERSION 2.2
480 (Several of these were suggested by Ed Sternin ([email protected])
481
482 a. Fixed problem where in the descendant trees if a spouse's
483 last name isn't known. It now puts in escaped underscores.
484 (Also fixed printfirstname [now printablefirstname] to print
485 underscores when no given name is known.)
486
487 b. Added the BOOKCHAPSPLIT option
488 If you put a
489 1 NOTE BOOKCHAPSPLIT on the person who is a chapter head,
490 then each of his children will head up their own chapters with
491 the children of that head as Generation 1 in their respective chapters.
492 I added this because I have a family where the father had 3 sons.
493 I want to include the info on the father, but I also want each
494 of the three sons to have their own chapter. So I put a
495 BOOKCHAPSPLIT note on the father, and it all comes out automatically.
496 You should be careful not to have a BOOKCHAPSPLIT on anyone who
497 is not the head of a line, or it'll probably come out ugly.
498 (It causes subsequently members of the generation of the noted
499 person to have separate chapters, as well as the children of
500 the noted person.)
501
502 c. I give the option to print out either all 1 TEXT, all 1 NOTE, or all
503 1 NOTE !-tagged notes (where if the 1st char of the note is !, then the
504 1 NOTE gets included).
505
506 d. Fixed mistake with running headers in ancestor format books so the
507 running header is now "<name> Ancestors", not "Descendents".
508
509 e. Added option (query turned off by default to match old way since it is
510 confusing to a beginner) to reset the placenametable at each generation.
511 If this option is selected, then the effect is that any placename
512 will have the fully specified (long) name printed out once in each
513 generation. I find this useful sometimes, just to remind people
514 where you're talking about since it might have been a long time
515 since the place was introduced.
516
517 f. if there is a 1 Event, 2 DATE or 2 PLAC record where there is
518 no value on the 2 DATE or 2 PLAC (but the record is present),
519 it'll no fill in an underscore where the date/place would be, e.g.,
520 Joe was born in ____ in ____ .
521 Previously if the 2 DATE or 2 PLAC were present and empty, it
522 would have said "born in in ." which isn't so nice.
523
524 g. Changed from supporting 3 SITE records to 3 ADDR records because
525 SITE isn't supposed to be part of std. GEDCOM anymore, ADDR is.
526 I hope this is as easy of a global replace for you as
527 it was for me. (of a gedcom file in a text editor).
528
529 h. Fixed A back-reference number (explaining that children were shown
530 earlier) in ancestor mode.
531
532 i. Fixed problem in ancestor mode that would print out the long text for
533 some individuals more than once.
534
535 New For Version 2.3
536 Not much is new:
537 Don't do excursions in ancestor mode
538 Added a couple LaTex macros that I use for pictures.
539
540 New For Version 2.4
541 Some contributions by Dave Steiner ([email protected])
542 Some very minor typesetting fixups to make some spacing more
543 consistent. Some spaces added in certain parts, spaces taken
544 out of other places.
545 Says a couple "have no children" instead of "had no children" if
546 it looks like the couple are still married and living.
547 The bibliography filename will now be <outfile>-bib.tex
548 instead of <database>-bib.tex.
549
550 Supports CONC as well as CONT continuation lines in most places.
551
552 I've made a couple other similarly minor cosmetic changes,
553 one of which forces a new paragraph during excursions in an oddball case.
554
555 Made a change in ancestor mode so that if cousins marry, it won't
556 print the information about the common ancestors twice.
557
558 Also an ancestor mode change so that ref. numbers for a person's
559 parents appear in the text in the longvitals() description.
560
561 New For Version 2.5.
562 Fixed a mistake in check_print_divinfo which made it not work at all.
563
564 New For Version 3.0
565 Several miscellaneous fixes.
566 Now part of lifelines sourceforge distribution. See sourceforge history.
567 Uses documentclass instead of documentstyle
568 Added ability to print a limited number of generations in
569 descendant-style books. At the terminal generation, if a person
570 is not dead, it will only print the birth year, not full date.
571 Fixed the titlepage generation.
572 Some fixes to support latest version of lifelines (or maybe its
573 just differences for lifelines under solaris):
574 Intersect() can't be used inside an if() call.
575 It has to call intersect separately and use the result in a set()
576 The childnum argument of children() is now only valid
577 within the scope of the children() loop.
578 */
579
580 /* Stuff I haven't implemented:
581 [email protected] (Jeffrey D. Adler)
582 One suggestion came from "Denis B. Roegel" <[email protected]>
583 regarding the over/under braces.
584 He suggested using something like:
585 \begin{minipage}{\columnwidth}
586 $\overbrace{\hspace*{3in}}$
587 \vspace{3ex}
588 \begin{center}{\large\bf 24\ Henry REGLE}\end{center}
589 \end{minipage}
590 \nobreak
591 Henry {\sc REGLE}\index{REGLE, Henry|bfit}, ...
592 and For \underbrace, try to put a \nobreak before:
593 \nobreak
594 $\underbrace{\hspace*{3in}}$
595
596 I haven't tried this out to see if I like it better.
597 But I did include some of the \nobreaks before the underbrace
598 and after the big center-ed person's name.
599 */
600
601 global(maxgenprint) /* number of generations to print full info for.*/
602 global(atmax_generation) /* used so we don't print full birthdates of living
603 individuals at the MAX-th generation */
604 global(ancestormode)
605 global(notes_text_mode)
606 global(eventPlaceTable)
607 global(atAddrValue)
608 global(eventNameTable)
609 global(in)
610 global(out)
611 global(idex)
612 global(stab)
613 global(powValue)
614 global(namereturn)
615 global(excurlist)
616 global(sourceList)
617 global(bibList)
618 global(bibTable)
619 global(figureCiteList)
620 global(figureNodeList)
621 global(gotValue)
622 global(gottenNode)
623 global(gottenValue)
624 global(dayNumber)
625 global(previousDayNumber)
626 global(daysToMonthList)
627 global(not_married_flag)
628 global(dumpplacetable_each_gen)
629 global(hadsplitnote)
630 global(force_desc_chart)
631 global(pedigreeFigureLabel)
632 global(global_dead)/* used at the MAX-th generation so we know if indi is dead*/
633 global(tex_xlat) /* table used to escape characters meaningful to TeX */
634 global(opt_xlat)
635 global(opt_email) /* flag indicating whether source author's
636 e-mail should be shown */
637
638 proc main() {
639 list(headlist)
640 table(stab) /* Table of numbers for each individual */
641 list(bibList)
642 list(excurlist)
643 table(bibTable)
644 list(figureCiteList)
645 list(figureNodeList)
646
647 list (sourceList)
648
649 set(opt_xlat, 1)
650 table(tex_xlat)
651 insert(tex_xlat, "$", "\\$")
652 insert(tex_xlat, "&", "\\&")
653 insert(tex_xlat, "%", "\\%")
654 insert(tex_xlat, "#", "\\#")
655 insert(tex_xlat, "_", "\\_")
656 insert(tex_xlat, "{", "\\{")
657 insert(tex_xlat, "}", "\\}")
658 insert(tex_xlat, "~", "\\verb|~|")
659 insert(tex_xlat, "^", "\\verb|^|")
660 insert(tex_xlat, "\\", "\\verb|\\|")
661 insert(tex_xlat, "<", "$<$") /* out of math mode, < and > produce */
662 insert(tex_xlat, ">", "$>$") /* upsidedown ! and ? marks */
663
664 list(daysToMonthList)
665 setel(daysToMonthList, 1, 0)
666 setel(daysToMonthList, 2, 31)
667 setel(daysToMonthList, 3, 59)
668 setel(daysToMonthList, 4, 90)
669 setel(daysToMonthList, 5, 120)
670 setel(daysToMonthList, 6, 151)
671 setel(daysToMonthList, 7, 181)
672 setel(daysToMonthList, 8, 212)
673 setel(daysToMonthList, 9, 243)
674 setel(daysToMonthList, 10, 273)
675 setel(daysToMonthList, 11, 304)
676 setel(daysToMonthList, 12, 334)
677 set(force_desc_chart, 0)
678
679 getindimsg(indi, "Enter the first person for the report")
680 if(not(indi)) {
681 return(0) /* assume the user wants to quit */
682 }
683 set(familycount, 0)
684 while(indi) {
685 set(familycount, add(familycount, 1))
686 enqueue(headlist, indi)
687 set(indi, 0)
688 getindimsg(indi, "Enter another root person or none to proceed")
689 }
690
691 if(1) {
692 getintmsg(ancestormode, "Enter 0 for descendant, 1 for ancestor report")
693 } else {
694 set(ancestormode, 0)
695 }
696
697 set(maxgenprint, 999)
698 if(eq(0, ancestormode)) {
699 if(1) {
700 getintmsg(maxgenprint, "Max generations for descendancy books")
701 } else {
702 set(maxgenprint, 999)
703 }
704 }
705
706 if(1) {
707 getintmsg(notes_text_mode,
708 "Book Text:1='1 TEXT'; 2= all '1 NOTE'; 3= !-tag '1 NOTE's")
709 } else {
710 set(notes_text_mode, 1)
711 }
712
713 if(0) { /* change this to "if (1)" to turn this query on. */
714 getintmsg(dumpplacetable_each_gen,
715 "Enter 1 to reset place name table each generation, 0 to not")
716 } else {
717 set(dumpplacetable_each_gen, 0)
718 }
719
720 if(1) {
721 getintmsg(opt_email,
722 "Enter 1 to show source authors' e-mail addresses, 0 to not")
723 } else {
724 set(opt_email, 0)
725 }
726
727 /* Print preamble. Feel free to change this to suit your tastes. */
728 "\\documentclass[twocolumn,twoside,titlepage]{book}\n" /* LaTeX 2e */
729 /*"\\documentstyle[twocolumn,makeidx]{book}\n"*/
730 "\\pagestyle{myheadings}\n\n"
731 "% Enable ISO 8859/1 charset" nl()
732 "\\usepackage{isolatin1}" nl()
733 "% Shrink the margins to use more of the page.\n"
734 "% This is taken from fullpage.sty, which is on some systems.\n"
735 "\\topmargin 0pt\n"
736 "\\advance \\topmargin by -\\headheight\n"
737 "\\advance \\topmargin by -\\headsep\n"
738 "\\textheight 8.9in\n"
739 "\\oddsidemargin 0pt\n"
740 "\\evensidemargin \\oddsidemargin\n"
741 "\\textwidth 6.5in\n\n"
742 "\\newcounter{childnumber}\n\n"
743 "% The \\noname command is needed because TeX doesnt like underscores.\n"
744 "\\newcommand{\\noname}{\\underline{\\ \\ \\ \\ \\ }}\n\n"
745 "\\newcommand{\\nodate}{\\underline{\\ \\ \\ \\ }}\n\n"
746 "% Environment for printing the list of children.\n"
747 "\\newenvironment{childrenlist}"
748 "{\\begin{small}\\begin{list}{\\sc\\roman{childnumber}.}"
749 "{\\usecounter{childnumber}\\setlength{\\leftmargin}{0.5in}"
750 "\\setlength{\\labelsep}{0.07in}\\setlength{\\labelwidth}{0.43in}}}"
751 "{\\end{list}\\end{small}}\n\n"
752 "% The following commands are used to create the index.\n"
753 "\\newcommand{\\bold}[1]{{\\bf #1}}\n"
754 "\\newcommand{\\bfit}[1]{{\\bf\\it #1}}\n"
755 "%%\\newcommand{\\see}[2]{{\\it see #1}} %not needed with makeidx.sty\n\n"
756 "% Command to use at the beginning of each new generation.\n"
757 if(ancestormode) {
758 "\\newcommand{\\generation}[2]"
759 "{\\newpage\\begin{center}{\\huge\\bf Generation #1}\\end{center}"
760 "\\vspace{3ex}\\setcounter{footnote}{0}"
761 "\\markright{#2 Ancestors" "\\hfill Generation #1\\hfill\\ }"
762 "}\n\n"
763 } else {
764 "\\newcommand{\\generation}[2]"
765 "{\\newpage\\begin{center}{\\huge\\bf Generation #1}\\end{center}"
766 "\\vspace{3ex}\\setcounter{footnote}{0}"
767 "\\markright{#2 Descendants" "\\hfill Generation #1\\hfill\\ }"
768 "}\n\n"
769 }
770 "\\newcommand{\\image}[4]"
771 "{\\begin{figure}\n\\centerline{\\psfig{figure=#1,height=#4}}\n"
772 "\\label{#3}\n"
773 "\\caption{#2}\n\\end{figure}}\n"
774 "\\newcommand{\\imwide}[4]"
775 "{\\begin{figure*}\n\\centerline{\\psfig{figure=#1,height=#4}}\n"
776 "\\label{#3}\n"
777 "\\caption{#2}\n\\end{figure*}}\n"
778
779 "\\makeindex\n\n"
780 "\n\\input{tree}\n" /* needed for making descendant trees */
781 "\\begin{document}\n\n"
782
783 /*******************************************/
784 /* Make the title */
785 /*******************************************/
786 "\\title{ The "
787 forlist(headlist,head,localcount) {
788 if(gt(localcount,1)) {
789 if(gt(familycount,2)) { /* don't say "a, and b." */
790 ", "
791 }
792 if(eq(localcount,familycount)) { " and " }
793 }
794 strxlat(tex_xlat, surname(head))
795 }
796 if(eq(1,familycount)) {
797 " Family}\n"
798 } else {
799 " Families}\n"
800 }
801
802 getstrmsg(author, "Enter the author(s) of this document:")
803 "\\author{" strxlat(tex_xlat, author) "}\n"
804 "\\date{\\today}\n"
805 "\\maketitle\n"
806
807 "\\clearpage\n"
808 "\\onecolumn\n"
809 "\\pagestyle{empty}\n"
810 "\\mbox{ }\n"
811 "\\vfill\n"
812 "\\begin{center}\n"
813 "Copyright \\copyright \\ \\today \\ " strxlat(tex_xlat, author) "\\\\"
814 getstrmsg(copyplace, "Enter the place for the copyright notice:")
815 strxlat(tex_xlat, copyplace) "\n"
816
817 "\\end{center}\n"
818 "\\clearpage\n"
819 "\\pagestyle{myheadings}\n"
820 "\\twocolumn\n"
821
822 "\\setcounter{page}{1}\n"
823 "\\tableofcontents"
824
825 getstrmsg(intro, "File that contains introduction (if any):")
826 if(ne(strcmp(intro, ""), 0)) {
827 "\\input{" intro "}\n"
828 }
829
830
831
832 table(eventNameTable)
833 table(eventPlaceTable)
834 table(eventNameTable)
835 insert(eventNameTable, "BIRT", "was born")
836 insert(eventNameTable, "ADOP", "was adopted")
837 insert(eventNameTable, "BAPM", "was baptized")
838 insert(eventNameTable, "CHR", "was baptized")
839 insert(eventNameTable, "DEAT", "died")
840 insert(eventNameTable, "BURI", "was buried")
841 insert(eventNameTable, "CREM", "was cremated")
842 /* GRAD left blank since it is done as a separate case */
843 insert(eventNameTable, "GRAD", "")
844 insert(eventNameTable, "NATU", "was naturalized")
845 insert(eventNameTable, "CHRA", "was christened (as an adult)")
846 insert(eventNameTable, "CENS", "was listed in the census")
847 insert(eventNameTable, "ORDN", "was ordained")
848 insert(eventNameTable, "RELI", "")
849 insert(eventNameTable, "RESI", "lived")
850 insert(eventNameTable, "CONL", "was confirmed")
851 insert(eventNameTable, "CONF", "was confirmed")
852 insert(eventNameTable, "BLES", "was blessed")
853 insert(eventNameTable, "BASM", "was bat mitzvah-ed")
854 insert(eventNameTable, "BARM", "was bar mitzvah-ed")
855 /* these two Will related things come out kind of icky because
856 I just always use plain pronouns like he, she, not
857 possessive ones, so I have to say "he wrote a will"
858 instead of "his will was dated"
859 */
860 insert(eventNameTable, "PROB", "had a will probated")
861 insert(eventNameTable, "WILL", "wrote a will")
862 insert(eventNameTable, "RETI", "retired")
863
864
865 indiset(idex)
866
867
868 set(out, 1)
869 set(in, 1)
870
871 dayformat(2)
872 monthformat(6)
873 dateformat(1)
874 while(indi, dequeue(headlist)) {
875 if(ancestormode) {
876 call ancestor_chapterproc(indi)
877 } else {
878 call chapterproc(indi)
879 }
880 }
881
882 set(basename,
883 save(substring(outfile(), 1, sub(index(outfile(), ".", 1), 1))))
884
885 /* Output bibliography commands */
886 if(not(empty(bibList))) {
887 "\n\n\\onecolumn"
888 "\n\\cleardoublepage"
889 "\n\\label{Bibliography}"
890 "\n\\addcontentsline{toc}{chapter}{Bibliography}"
891 "\n\\begin{thebibliography}{9.99}"
892 "\n\\input{" basename "-bib.tex}"
893 "\n\\end{thebibliography}"
894 }
895 "\n\n\\cleardoublepage"
896 "\n\\label{Index}"
897 "\n\\addcontentsline{toc}{chapter}{Index}"
898 "\n\\input{" basename ".ind}"
899
900 "\n\n\\end{document}\n"
901
902 /* Output bibliography file */
903 print("\n\nCreating support files ...")
904 if( not(empty(bibList)) ) {
905 newfile(concat(basename, "-bib.tex"), 0)
906 print("writing to : ")
907 print("\n")
908 print(concat(basename, "-bib.tex"))
909 print("\n")
910 while(b, dequeue(bibList)) { b }
911 }
912 }
913
914 proc chapterproc(topguy) {
915 list(ilist) /* List of individuals */
916 list(glist) /* List of generation for each individual */
917 set(last_grandparents,0)
918 indiset(grandparentset)
919 indiset(hisset)
920 indiset(last_grandparentset)
921 set(chapterTitle,
922 save(concat("The ",
923 concat(fullname(topguy, 0, 1, 99), "\ Family"))))
924
925 "\n\\chapter{" chapterTitle "}" "\n"
926
927 enqueue(ilist, topguy)
928 enqueue(glist, 1)
929 set(curgen, 0)
930 set(printed_brace,0)
931 set(just_printed_brace,0)
932
933 /* we have to do this add1 once for the topguy of each chapter
934 We used to start out with "in" initialized to 2, but that made
935 the numberings bad when there were multiple chapters, so now
936 we init to 1 and do this +1 here
937 */
938 set(in, add(in, 1))
939
940 set(hadsplitnote,0)
941 set(this_level_hadsplitnote,0)
942
943 while(indi, dequeue(ilist)) {
944 /* This is where we implement the "Chapter Split". The idea is,
945 that if you put a BOOKCHAPSPLIT note on the head of a line, then
946 each of his children will head up their own chapters with
947 the children of that line as Generation 1 in their respective chapters.
948 */
949 if(eq(1,this_level_hadsplitnote)) {
950 call chapterproc(indi)
951 } else {
952 set(thisgen, dequeue(glist))
953 if(ne(curgen, thisgen)) {
954 /* If we are starting a new generation, close off brace
955 from previous gen. if necessary
956 */
957 if(printed_brace) {
958 "\n\\nobreak"
959 "\n" "$\\underbrace{\\hspace*{3in}}$" "\n\n"
960 set(printed_brace,0)
961 }
962
963 if(dumpplacetable_each_gen) {
964 table(eventPlaceTable)
965 }
966 print("Generation ") print(d(thisgen)) print("\n")
967 "\n\n\\generation{" d(thisgen) "}" "{"
968 strxlat(tex_xlat, surname(topguy)) "}" "\n"
969 "\n\\addcontentsline{toc}{section}{Generation " d(thisgen) "}\n"
970 set(curgen, thisgen)
971 set(last_grandparents,0)
972 indiset(last_grandparentset)
973 set(printed_brace,0)
974 if(eq(curgen,maxgenprint)) {
975 set(atmax_generation,1)
976 } else {
977 set(atmax_generation,0)
978 }
979 }
980 /* decide if we have the same grandparents or not */
981 /* I try to group people together with over/under braces
982 for people descended from the same grandparent in this descendancy */
983 /* rather than remember who belongs to what line, I just look
984 at all their grandparents and if they overlap with the grandparents
985 of the previous person, then I assume I'm on the same line.
986 This isn't always true, but it is a start, at least.
987 */
988 if(gt(curgen,3)) {
989 if(eq(0,last_grandparents)) {
990 "\n" "$\\overbrace{\\hspace*{3in}}$" "\n"
991 set(printed_brace,1)
992 set(just_printed_brace,1)
993 indiset(hisset)
994 addtoset(hisset,indi,1)
995 set(grandparentset,parentset(parentset(hisset)))
996 set(last_grandparentset,grandparentset)
997 set(last_grandparents,1)
998 } else {
999 indiset(hisset)
1000 addtoset(hisset,indi,1)
1001 set(grandparentset,parentset(parentset(hisset)))
1002 set(doit,1)
1003 indiset(extraSet)
1004 set(extraSet,intersect(grandparentset,last_grandparentset))
1005 forindiset(extraSet, joe, a, b) {
1006 set(doit,0)
1007 }
1008 if(doit) {
1009 if(printed_brace) {
1010 "\n\\nobreak"
1011 "\n" "$\\underbrace{\\hspace*{3in}}$" "\n\n"
1012 }
1013 "\n" "$\\overbrace{\\hspace*{3in}}$" "\n\n"
1014 set(printed_brace,1)
1015 set(just_printed_brace,1)
1016 /* also reset the place table after each set of grandchildren.
1017 This makes it repeat the whole location name the next time
1018 it sees any location. Otherwise, it can get too far from the
1019 introduction of the place for my liking.
1020 */
1021 if(dumpplacetable_each_gen) {
1022 table(eventPlaceTable)
1023 }
1024 }
1025 set(last_grandparentset,grandparentset)
1026 set(last_grandparents,1)
1027 }
1028 }
1029
1030 print(d(out)) print(" ") print(name(indi)) print("\n")
1031
1032 /* only do the vspace between people if there was no overbrace printed.
1033 Otherwise there is too much white space and it looks icky.
1034 */
1035 if(eq(0,just_printed_brace)) {
1036 "\n\\vspace{3ex}\\ \\\\"
1037 }
1038 set(just_printed_brace,0)
1039
1040 "\\begin{center}{\\large\\bf " d(out) "\\ "
1041 strxlat(tex_xlat, name(indi)) "}\\end{center}\n"
1042 "\\nobreak\n"
1043 insert(stab, save(key(indi)), out)
1044
1045 call longvitals(indi, 1, 2)
1046 if(hadsplitnote) {
1047 set(this_level_hadsplitnote,1)
1048 }
1049
1050 addtoset(idex, indi, 0)
1051 set(out, add(out, 1))
1052 /* check whether the children we are about to print are at the
1053 Max generation
1054 */
1055 set(save_atmax_generation,atmax_generation)
1056 if(eq(add(curgen,1),maxgenprint)) {
1057 set(atmax_generation,1)
1058 }
1059
1060 families(indi, fam, spouse, nfam) {
1061 "\n\n"
1062 if(eq(0, nchildren(fam))) {
1063 call texname(inode(indi), 0) "\\ and "
1064 if(spouse) {
1065 call texname(inode(spouse), 0)
1066 } else {
1067 "\\noname"
1068 }
1069 call havehadchildren(indi, spouse)
1070 } elsif(and(spouse, lookup(stab, key(spouse)))) {
1071 "Children of " call texname(inode(indi), 0) "\\ and "
1072 call texname(inode(spouse), 0) "\\ are shown under "
1073 call texname(inode(spouse), 0)
1074 "(" d(lookup(stab, key(spouse))) ").\n"
1075 } else {
1076 "Children of " call texname(inode(indi), 0) "\\ and "
1077 if(spouse) {
1078 call texname(inode(spouse), 0)
1079 } else {
1080 "\\noname"
1081 }
1082 ":\n\\begin{childrenlist}\n"
1083 children(fam, child, nchl) {
1084 set(haschild, 0)
1085 families(child, cfam, cspou, ncf) {
1086 if(ne(0, nchildren(cfam))) {
1087 set(haschild, 1)
1088 }
1089 }
1090 if(and(haschild,lt(curgen,maxgenprint))) {
1091 if(not(lookup(stab, key(child)))) {
1092 enqueue(ilist, child)
1093 enqueue(glist, add(1, curgen))
1094 "\n\\item[{\\bf " d(in) "}\\ \\hfill"
1095 "\\addtocounter{childnumber}{1}"
1096 "{\\sc\\roman{childnumber}}.]"
1097 set(in, add(in, 1))
1098 call shortvitals(child)
1099 } else {
1100 "\n\\item[{\\bf " d(lookup(stab, key(child))) "}\\ \\hfill"
1101 "\\addtocounter{childnumber}{1}"
1102 "{\\sc\\roman{childnumber}}.]"
1103 call shortvitals(child)
1104 " Details of " pn(child, 3) " family were shown earlier."
1105 }
1106 } else {
1107 if(haschild) {
1108 set(force_desc_chart, 1)
1109 }
1110 "\n\\item "
1111 call longvitals(child, 0, 1)
1112 set(force_desc_chart,0)
1113 addtoset(idex, child, 0)
1114 }
1115 }
1116 "\\end{childrenlist}\n"
1117 }
1118 }
1119 set(atmax_generation, save_atmax_generation)
1120
1121 if(eq(indi,topguy)) {
1122 set(descFigureLabel, save(concat(key(indi), "-figure-desc")))
1123 "\nA brief chart of the descendants of this line is contained in "
1124 "Figure~\\ref{" descFigureLabel "}."
1125 "\n\\begin{figure*}\n"
1126 "\\centering\n"
1127 call desc_chart_main3(indi)
1128 "\n\\caption{Descendents of " fullname(indi,0,1,99) "({\\bf "
1129 d(lookup(stab, key(indi))) "})}" nl()
1130 "\\label{" descFigureLabel "}"
1131 "\\end{figure*}\n"
1132 }
1133 }
1134 }
1135
1136 /* Close off the last braces if necessary */
1137 if(printed_brace) {
1138 "\n\\nobreak"
1139 "\n" "$\\underbrace{\\hspace*{3in}}$" "\n\n"
1140 }
1141 set(printed_brace,0)
1142
1143
1144 while(indi, dequeue(excurlist)) {
1145 call excursion(indi)
1146 }
1147 }
1148
1149
1150 /* Run this routine if you want an ahnentafel style report for the
1151 individuals named
1152 */
1153 proc ancestor_chapterproc(topguy) {
1154 list(ilist) /* List of individuals */
1155 list(glist) /* List of generation for each individual */
1156 list(alist)
1157 set(chapterTitle,
1158 save(concat(fullname(topguy, 0, 1, 99), "\ Ancestors")))
1159 "\n\\chapter{" chapterTitle "}" "\n"
1160
1161 enqueue(ilist, topguy)
1162 enqueue(alist,1)
1163 enqueue(glist, 1)
1164 set(curgen, 0)
1165 insert(stab, save(key(topguy)), 1)
1166
1167 while(indi, dequeue(ilist)) {
1168 set(ahnen, dequeue(alist))
1169 set(thisgen, dequeue(glist))
1170 if(ne(curgen, thisgen)) {
1171 print("Generation ") print(d(thisgen)) print("\n")
1172 "\n\n\\generation{" d(thisgen) "}" "{"
1173 strxlat(tex_xlat, surname(topguy)) "}" "\n"
1174 "\n\\addcontentsline{toc}{section}{Generation " d(thisgen) "}\n"
1175 set(curgen, thisgen)
1176 /* reset the place table at each generation if asked to. */
1177 if(dumpplacetable_each_gen) {
1178 table(eventPlaceTable)
1179 }
1180 }
1181 print(d(ahnen)) print(" ") print(name(indi)) print("\n")
1182
1183 "\n\\vspace{3ex}\\ \\\\"
1184
1185 "\\begin{center}{\\large\\bf " d(ahnen) "\\ "
1186 strxlat(tex_xlat, name(indi)) "}\\end{center}\n"
1187
1188 /****************************************************************/
1189 /* first, enqueue his parents onto the lists so their numbers
1190 will be printed out in the description of "indi" */
1191 /* also includes a check to see if indi's parents are already
1192 there such as will happen when cousins marry.
1193 */
1194 set(print_dad_note,0)
1195 set(print_mom_note,0)
1196
1197 if(par,father(indi)) {
1198 if(not(lookup(stab,key(par)))) {
1199 enqueue(ilist, par)
1200 enqueue(alist, mul(2,ahnen))
1201 enqueue(glist, add(curgen, 1))
1202 insert(stab, save(key(par)), mul(2,ahnen))
1203 } else {
1204 set(print_dad_note,key(par))
1205 }
1206 }
1207 if(par, mother(indi)) {
1208 if(not(lookup(stab,key(par)))) {
1209 enqueue(ilist, par)
1210 enqueue(alist, add(1,mul(2,ahnen)))
1211 enqueue(glist, add(curgen, 1))
1212 insert(stab, save(key(par)), add(1,mul(2,ahnen)))
1213 } else {
1214 set(print_mom_note,key(par))
1215 }
1216 }
1217
1218 /****************************************************************/
1219 /* now to print out info about this person */
1220
1221 call longvitals(indi, 1, 2)
1222
1223 addtoset(idex, indi, 0)
1224 families(indi, fam, spouse, nfam) {
1225 "\n\n"
1226 if(eq(0, nchildren(fam))) {
1227 call texname(inode(indi), 0) "\\ and "
1228 if(spouse) {
1229 call texname(inode(spouse), 0)
1230 } else {
1231 "\\noname"
1232 }
1233 call havehadchildren(indi, spouse)
1234 } elsif( and(female(indi), spouse, lookup(stab, key(spouse))) ) {
1235 /* note that the form of that if is different here than in
1236 descendant reports. It is different because we explicitly
1237 form the queue by adding the father before the mother.
1238 Thus, for the parent-set, the children will be printed
1239 under the father. We don't check to see if the father's
1240 spouse had them previously printed because that would
1241 only happen if a different (non-ancestor) wife also
1242 happened to be an ancestor from a different branch, which
1243 could happen, but has to be pretty rare. (E.g. your
1244 dad's dad marries your mom's mom for the 2nd marriage for both
1245 of them, something like that. Ick.)
1246 */
1247 "Children of " call texname(inode(indi), 0) "\\ and "
1248 call texname(inode(spouse), 0) "\\ are shown under "
1249 call texname(inode(spouse), 0)
1250 "(" d(lookup(stab, key(spouse))) ").\n"
1251 } else {
1252 "Children of " call texname(inode(indi), 0) "\\ and "
1253 if(spouse) {
1254 call texname(inode(spouse), 0)
1255 } else {
1256 "\\noname"
1257 }
1258 ":\n\\begin{childrenlist}\n"
1259 children(fam, child, nchl) {
1260 set(haschild, 0)
1261 families(child, cfam, cspou, ncf) {
1262 if(ne(0, nchildren(cfam))) {
1263 set(haschild, 1)
1264 }
1265 }
1266 "\n\\item "
1267 if(not(lookup(stab, key(child)))) {
1268 call longvitals(child, 0, 1)
1269 addtoset(idex, child, 0)
1270 } else {
1271 call shortvitals(child)
1272 " Details of " pn(child,3) " family were shown earlier "
1273 "({\\bf "
1274 d(lookup(stab, key(child))) "})" "."
1275 }
1276 }
1277 "\\end{childrenlist}\n"
1278 }
1279 } /* END families loop */
1280
1281 /* if his parents are not numbered as expected, tell 'em so. */
1282 if(ne(0,print_dad_note)) {
1283 "\n Note that " pn(indi,3) " father "
1284 "({\\bf "
1285 d(lookup(stab, print_dad_note)) "})"
1286 " is not found in the usual "
1287 "ahnentafel-style numbering place due to intermarriages.\n"
1288 }
1289 if(ne(0,print_mom_note)) {
1290 "Note that " pn(indi,3) " mother "
1291 "({\\bf "
1292 d(lookup(stab, print_mom_note)) "})"
1293 " is not found in the usual "
1294 "ahnentafel-style numbering place due to intermarriages.\n"
1295 "\n"
1296 }
1297
1298 if(eq(indi,topguy)) {
1299 call pedigreeFigure(indi)
1300 if(strcmp(pedigreeFigureLabel, "")) {
1301 pn(indi, 2)
1302 " pedigree is illustrated in Figure \\protect\\ref{"
1303 pedigreeFigureLabel "}."
1304 }
1305 }
1306 }
1307 }
1308
1309 /* shortvitals(indi): Displays the short form of the vital statistics (birth
1310 and death only) of an individual.
1311 */
1312 proc shortvitals(indi) {
1313 call resetdayplace()
1314 call texname(inode(indi), 1)
1315 set(b, birth(indi))
1316 set(d, death(indi))
1317
1318 set(local_dead,global_dead) /* save for restore */
1319 set(global_dead,d)
1320
1321 if(and(b, long(b))) {
1322 call process_event(b)
1323 if(and(d, long(d))) {
1324 " and " pn(indi,1)
1325 call process_event(d)
1326 }
1327 } else { /* know death info, not birth*/
1328 if(and(d, long(d))) {
1329 call process_event(d)
1330 }
1331 }
1332 "."
1333 set(global_dead,local_dead) /* restore */
1334 }
1335
1336
1337 /* longvitals(i, name_parents, name_type)
1338 Prints out the complete vital statistics of the individual (i). If
1339 name_parents is not 0, then the names of the parents of the individual will
1340 be printed. The parameter name_type is passed to texname. The GEDCOM tags
1341 are divided into ones that would likely occur before getting married and
1342 ones that would likely occur after getting married. Within the two sets
1343 they are printed in the order in which they appear in the database. I
1344 haven't yet figured out a convenient way of indicating the sex.
1345 */
1346 proc longvitals(i, name_parents, name_type) {
1347 call resetdayplace()
1348
1349 set(local_dead,global_dead) /* save for restore */
1350 set(global_dead,death(i))
1351
1352 call texname(inode(i), name_type) call print_sources(inode(i))
1353 call getValue(inode(i),"NAME")
1354 if(gotValue) {
1355 call print_sources(gottenNode)
1356 }
1357
1358 /* remember the value so it doesn't affect spousevitals */
1359 set(save_force_chart,force_desc_chart)
1360 set(force_desc_chart,0)
1361
1362 set(dad, father(i))
1363 set(mom, mother(i))
1364 if(and(name_parents, or(dad, mom))) {
1365 ", "
1366 if(male(i)) { "the son of " }
1367 elsif(female(i)) { "the daughter of " }
1368 else { "the child of " }
1369 if(dad) {
1370 call texname(inode(dad), 0)
1371 if(lookup(stab, key(dad))) {
1372 "({\\bf "
1373 d(lookup(stab, key(dad)))
1374 "})"
1375 }
1376 }
1377 if(and(dad, mom)) {
1378 "\nand "
1379 }
1380 if(mom) {
1381 call texname(inode(mom), 0)
1382 if(lookup(stab, key(mom))) {
1383 "({\\bf "
1384 d(lookup(stab, key(mom)))
1385 "})"
1386 }
1387 }
1388 ",\n"
1389 }
1390
1391 set(name_found, 0)
1392 set(needname,0)
1393 set(canUseAnd,1)
1394 set(printedOne,1) /* at the start, we have just printed his fullname*/
1395 set(pronoun," ")
1396 set(anythingprinted,0)
1397 set(putPeriod,0)
1398 /* there is a mistake in this for right now, if we don't have any
1399 pre-marriage info, it'll be ugly for the death.
1400 */
1401 fornodes(inode(i), n) {
1402 if(not(printedOne)) {
1403 if(needname) {
1404 set(pronoun, printablefirstname(i))
1405 set(needname,0)
1406 set(canUseAnd,1)
1407 set(printedOne,1)
1408 set(putPeriod,0)
1409 set(pronoun," ")
1410 } else {
1411 if(canUseAnd) {
1412 set(pronoun," and ")
1413 set(canUseAnd,0)
1414 set(printedOne,1)
1415 set(putPeriod,1)
1416 } else { /* set up for "He" this time, "and" next time. */
1417 /* put the period in for the first time */
1418 if(not(anythingprinted)) {
1419 set(putPeriod,1)
1420 } else {
1421 set(putPeriod,0)
1422 }
1423 set(pronoun,pn(i,0))
1424 set(canUseAnd,1)
1425 set(printedOne,1)
1426 }
1427 }
1428 set(anythingprinted,1)
1429 }/* end if not printedone */
1430
1431 if(
1432 or(eq(strcmp(tag(n), "ADOP"), 0),
1433 eq(strcmp(tag(n), "BAPL"), 0),
1434 eq(strcmp(tag(n), "BAPM"), 0),
1435 eq(strcmp(tag(n), "BARM"), 0),
1436 eq(strcmp(tag(n), "BASM"), 0),
1437 eq(strcmp(tag(n), "BIRT"), 0),
1438 eq(strcmp(tag(n), "BLES"), 0),
1439 eq(strcmp(tag(n), "CONF"), 0),
1440 eq(strcmp(tag(n), "CONL"), 0),
1441 eq(strcmp(tag(n), "ORDN"), 0),
1442 eq(strcmp(tag(n), "CHR" ), 0)
1443 )) {
1444 pronoun set(printedOne,0)
1445 call process_event(n)
1446 if(putPeriod) {". "}
1447 }
1448 if(eq(strcmp(tag(n), "GRAD"), 0)) {
1449 pronoun set(printedOne,0)
1450 " graduated from "
1451 call valuec(n)
1452 call process_event(n)
1453 if(putPeriod) {". "}
1454 }
1455
1456 if(eq(strcmp(tag(n), "CAST"), 0)) {
1457 pronoun set(printedOne,0)
1458 " was a member of Caste: " call valuec(n)
1459 call process_event(n)
1460 if(putPeriod) {". "}
1461 }
1462 if(eq(strcmp(tag(n), "NAME"), 0)) {
1463 if(eq(name_found, 0)) {
1464 set(name_found, 1)
1465 } else {
1466 pronoun set(printedOne,0)
1467 " was also known as " call texname(n, 3)
1468 call print_notes(n, " ")
1469 call print_sources(n)
1470 if(putPeriod) {". "}
1471 "\n"
1472 }
1473 }
1474 if(eq(strcmp(tag(n), "NAMR"), 0)) {
1475 pronoun set(printedOne,0)
1476 " had the religious name of: " call valuec(n)
1477 call process_event(n)
1478 if(putPeriod) {". "}
1479 }
1480 if(eq(strcmp(tag(n), "RELI"), 0)) {
1481 pronoun set(printedOne,0)
1482 " was a " call valuec(n)
1483 call process_event(n)
1484 if(putPeriod) {". "}
1485 }
1486 /*
1487 if(eq(strcmp(tag(n), "TITL"), 0)) {
1488 pronoun set(printedOne,0)
1489 " held the title of " value(n)
1490 call print_sources(n)
1491 if(putPeriod) {". "} "\n"
1492 }
1493 */
1494 } /* END fornodes(inode(i), n) */
1495
1496 if(and(putPeriod,anythingprinted)) { ". " }
1497 set(inhibit_text_charts,0)
1498 if(eq(1, nfamilies(i))) {
1499 families(i, f, s, n) {
1500 if(s) {
1501 if(anythingprinted) { pn(i,0) }
1502 set(anythingprinted,1)
1503 call illegit_check(f)
1504 if(not_married_flag) {
1505 " had a child with"
1506 } else {
1507 " married"
1508 }
1509 /* it is OK to assume they had children if the
1510 Not married flag is raised. Cuz if they
1511 weren't married and didn't have kids, there
1512 isn't much point in the family existing
1513 (as far as this program is concerned).
1514 */
1515 call print_sources(fnode(f))
1516 call spousevitals(s, f)
1517 }
1518 } /* END families(i, f, s, n) */
1519
1520 } else { /* individual 'i' had more than one family */
1521 families(i, f, s, n) {
1522 if(anythingprinted) {
1523 /* print "he" (or "she") for first marriage, and his
1524 first name for all later marriages
1525 */
1526 if(gt(n,1)) {
1527 printablefirstname(i)
1528 } else {
1529 pn(i,0)
1530 }
1531 }
1532 set(anythingprinted, 1)
1533 if(s) {
1534 call illegit_check(f)
1535 if(not_married_flag) {
1536 " had child(ren) with "
1537 } else {
1538 " married "
1539 }
1540 ord(n) "," call print_sources(fnode(f))
1541 call spousevitals(s, f)
1542 /* make sure we don't print this (i) persons
1543 text and charts a second time. The theory here
1544 being that if the spouse is in the stab,
1545 then this person (i) has already had their
1546 notes/charts done as part of their spouse.
1547 We don't want to print a 2nd time
1548 */
1549 if(not(ancestormode)) {
1550 if(lookup(stab, key(s))) {
1551 set(inhibit_text_charts,1)
1552 }
1553 }
1554 } else {
1555 " " ord(n) " had a child with an unknown spouse. "
1556 }
1557 } /* END families(i, f, s, n) */
1558 }
1559 " "
1560 /*
1561 if(anythingprinted) {
1562 call getText(inode(i),0)
1563 }
1564 */
1565 /* otherwise hold off on getText until after the death info & all */
1566 /* I changed my mind. I like getText at the end. */
1567 set(needname,1)
1568 set(canUseAnd,0)
1569 set(putPeriod,0)
1570 if(anythingprinted) {
1571 set(printedOne,0) /* haven't printed a name here after the spouse info */
1572 /* this works because pronoun is still a blank */
1573 } else {
1574 set(printedOne,1) /* we still have his name from way at the start */
1575 set(putPeriod,1) /* JUST ADDED THIS LINE 5/24/96. Don't know if works */
1576 /* test it on Galbraith kids where know only death.*/
1577 }
1578
1579 fornodes(inode(i), n) { /* process DEATH related gedcom nodes */
1580 if(not(printedOne)) {
1581 if(needname) {
1582 set(pronoun, printablefirstname(i))
1583 set(needname,0)
1584 set(canUseAnd,1)
1585 set(printedOne,1)
1586 set(putPeriod,0)
1587 } else {
1588 if(canUseAnd) {
1589 set(pronoun," and ")
1590 set(canUseAnd,0)
1591 set(printedOne,1)
1592 set(putPeriod,1)
1593 } else {
1594 set(pronoun,pn(i,0))
1595 set(canUseAnd,1)
1596 set(printedOne,1)
1597 set(putPeriod,0)
1598 }
1599 }
1600 }
1601 if(
1602 or(
1603 eq(strcmp(tag(n), "BURI"), 0),
1604 eq(strcmp(tag(n), "CREM"), 0),
1605 eq(strcmp(tag(n), "CENS"), 0),
1606 eq(strcmp(tag(n), "CHRA"), 0),
1607 eq(strcmp(tag(n), "DEAT"), 0),
1608 eq(strcmp(tag(n), "NATU"), 0),
1609 eq(strcmp(tag(n), "RETI"), 0),
1610 eq(strcmp(tag(n), "RESI"), 0),
1611 eq(strcmp(tag(n), "PROB"), 0),
1612 eq(strcmp(tag(n), "WILL"), 0)
1613 )) {
1614 pronoun set(printedOne,0)
1615 call process_event(n)
1616 if(putPeriod) {". "}
1617 }
1618
1619 /* One part of the GEDCOM standard says the tag should be DSCR,
1620 another part says DESR.
1621 */
1622 if(eq(strcmp(tag(n), "DESR"), 0)) {
1623 pronoun set(printedOne,0)
1624 "Description: " call valuec(n)
1625 call print_sources(n)
1626 if(putPeriod) {". "}
1627 }
1628 if(eq(strcmp(tag(n), "EVEN"), 0)) {
1629 pronoun set(printedOne,0)
1630 value(n)
1631 call process_event(n)
1632 if(putPeriod) {". "}
1633 }
1634 if(eq(strcmp(tag(n), "OCCU"), 0)) {
1635 pronoun set(printedOne,0)
1636 /* should also check for a RETIred node
1637 and always say WAS if it exists
1638 */
1639 /* DAB - replace with do_occu; delete this when do_occu accepted
1640 call getValue(inode(i),"RETI")
1641 if(gotValue) {
1642 " was"
1643 } else {
1644 call iswas(i)
1645 }
1646 " "
1647 call aAn(value(n)) " "
1648 call valuec(n)
1649 call process_event(n)
1650 */
1651 call do_occu(n, i)
1652 if(putPeriod) {". "}
1653 }
1654 if(eq(strcmp(tag(n), "PROP"), 0)) {
1655 pronoun set(printedOne,0)
1656 "had possessions: " call valuec(n) "."
1657 call print_sources(n)
1658 if(putPeriod) {". "}
1659 }
1660 }
1661 if(putPeriod) {". "}
1662 /* restore forcing of desc. charts */
1663 set(force_desc_chart,save_force_chart)
1664 if(not(inhibit_text_charts)) {
1665 call getText(inode(i),0)
1666 call process_book_notes(i)
1667 }
1668 set(global_dead,local_dead) /* restore */
1669 }
1670
1671
1672 /* isRange(d) - Indicate if a date node is a range
1673 *
1674 * d - DATE node(could be NIL)
1675 *
1676 * Returns: 1 if <d> is of the form "[BET] date1-date2"; 0 otherwise
1677 *
1678 */
1679 func isRange(d) {
1680 set(r, 0)
1681 if(d) {
1682 if(i, index(d, "-", 1)) {
1683 set(r, 1)
1684 } elsif(i, index(d, "FROM", 1)) {
1685 set(r, 1)
1686 }
1687 }
1688 return(r)
1689 }
1690
1691
1692 /* do_occu(n, i) - Process an OCCU node
1693 *
1694 * n - OCCU node
1695 * i - INDI containing <n>
1696 *
1697 * An OCCU node will produce text saying "<name> is/was a <occu> with <agnc> ...."
1698 * It is assumed that the <name> was printed before this routine was called.
1699 * If the person is (likely) deceased, if the OCCU node has a subordinate RETI node,
1700 * or if the DATE tag subordinate to the OCCU node is a range, then "was" is used in
1701 * the sentence; otherwise, "is" is used. The "with <agnc>" clause is added if a
1702 * AGNC node is subordinate to the OCCU node; it is taken to be the name of the
1703 * employer.
1704 *
1705 */
1706
1707 proc do_occu(n, i) {
1708 /* Check for date range or RETI node and use "was" if either present. */
1709 set(d, date(n))
1710 call getValue(inode(i), "RETI")
1711 if(or(gotValue, isRange(d))) {
1712 " was"
1713 } else {
1714 call iswas(i)
1715 }
1716 " "
1717 call aAn(value(n)) " "
1718 call valuec(n)
1719 call getValue(n, "AGNC")
1720 if(gotValue) {
1721 " with " gottenValue
1722 }
1723 call process_event(n)
1724 /*
1725 if(putPeriod) {". "}
1726 */
1727 }
1728
1729
1730 /* spousevitals(spouse, fam)
1731 Prints out information about a marriage (fam) and about a spouse in the
1732 marriage (spouse).
1733 */
1734
1735 proc spousevitals(spouse, fam) {
1736 call texname(inode(spouse), 3)
1737 if(spouse) {
1738 call print_sources(inode(spouse))
1739 call getValue(inode(spouse),"NAME")
1740 if(gotValue) {
1741 call print_sources(gottenNode)
1742 }
1743 }
1744
1745 if(e, marriage(fam)) {
1746 call process_event(e)
1747 }
1748 ". "
1749 call check_print_divinfo(fam)
1750
1751 if(spouse) {
1752 set(bir, birth(spouse))
1753 set(chr, baptism(spouse))
1754 set(dea, death(spouse))
1755 set(bur, burial(spouse))
1756 set(dad, father(spouse))
1757 set(mom, mother(spouse))
1758
1759 set(local_dead,global_dead) /* save for restore */
1760 set(global_dead,dea)
1761
1762
1763 if(or(bir, chr, dea, bur, mom, dad)) {
1764 printablefirstname(spouse)
1765 if(or(mom, dad)) {
1766 ", "
1767 if(male(spouse)) {
1768 "the son of "
1769 } elsif(female(spouse)) {
1770 "the daughter of "
1771 } else {
1772 "the child of "
1773 }
1774 if(dad) {
1775 call texname(inode(dad), 3)
1776 if(lookup(stab, key(dad))) {
1777 "({\\bf "
1778 d(lookup(stab, key(dad)))
1779 "})"
1780 }
1781 }
1782 if(and(mom, dad)) {
1783 " and "
1784 }
1785 if(mom) {
1786 call texname(inode(mom), 3)
1787 if(lookup(stab, key(mom))) {
1788 "({\\bf " d(lookup(stab, key(mom))) "})"
1789 }
1790 ", "
1791 }
1792 }
1793
1794 if(or(or(or(bir, chr), dea), bur)) {
1795 if(bir) {
1796 call vitalEvent(bir,1)
1797 call print_sources(bir)
1798 if(chr) {
1799 " and"
1800 call vitalEvent(chr,0)
1801 call print_sources(chr)
1802 ". "
1803 }
1804 if(dea) {
1805 if(chr) {
1806 pn(spouse,0)
1807 } else {
1808 " and"
1809 }
1810 call vitalEvent(dea,1)
1811 call print_sources(dea)
1812 ". "
1813 } else {
1814 if(not(chr)) {
1815 ". "
1816 }
1817 } /* born, but nothing more */
1818 }
1819 if(and(chr, not(bir))) {
1820 call vitalEvent(chr,1)
1821 call print_sources(chr)
1822 ". "
1823 }
1824 if(and(dea,not(bir))) { /* if bir, then dea is already handled */
1825 if(chr) { /* then need to print pronoun, otherwise don't
1826 since we still have the name standing there,
1827 not finishing a sentence
1828 */
1829 pn(spouse,0)
1830 }
1831 call vitalEvent(dea,1)
1832 call print_sources(dea)
1833 ". "
1834 }
1835 if(bur) {
1836 if(or(or(bir,dea),chr)) {
1837 pn(spouse,0)
1838 }
1839 call vitalEvent(bur,0)
1840 call print_sources(bur)
1841 ".\n"
1842 }
1843 }
1844 }
1845 if(gt(nfamilies(spouse), 1)) {
1846 set(beforefam,1)
1847 families(spouse, newfam, newspouse, n) {
1848 if(ne(newfam, fam)) {
1849 printablefirstname(spouse)
1850 if(beforefam) {
1851 " had "
1852 if(gt(n, 1)) {
1853 "also "
1854 }
1855 "previously married "
1856 } else {
1857 " later remarried "
1858 }
1859 if(newspouse) {
1860 call texname(inode(newspouse), 3)
1861 }
1862 set(e,marriage(newfam))
1863 if(e) { call process_event(e) }
1864 if(gt(nchildren(newfam), 0)) {
1865 ", and had "
1866 d(nchildren(newfam))
1867 if(gt(nchildren(newfam), 1)) {
1868 " children "
1869 } else {
1870 " child"
1871 }
1872 " by that marriage: "
1873 children(newfam, stepchild, numerical) {
1874 if(gt(numerical,1)) {
1875 ", "
1876 }
1877 printablefirstname(stepchild)
1878 }
1879 }
1880 ". "
1881 } else { /* newfam = fam */
1882 set(beforefam,0) /* we see the current family */
1883 }
1884 } /* END families(spouse, newfam, newspouse, n) */
1885 } /* END if(gt(nfamilies(spouse), 1)) */
1886
1887 if(not(lookup(stab, key(spouse)))) { /* don't print a 2nd time */
1888 call getValue(inode(spouse),"OCCU")
1889 if(gotValue) {
1890 set(savenode,gottenNode)
1891 printablefirstname(spouse)
1892 /* should also check for a RETIred node and always say WAS if it exists */
1893 /* DAB - replace with do_occu; delete this when do_occu is accepted
1894 call getValue(inode(spouse),"RETI")
1895 if(gotValue) {
1896 " was"
1897 } else {
1898 call iswas(spouse)
1899 }
1900 " "
1901 call aAn(value(savenode)) " "
1902 call valuec(savenode)
1903 call process_event(savenode)
1904 ". "
1905 */
1906 call do_occu(savenode, spouse) ". "
1907 }
1908 call getText(inode(spouse),0)
1909 call process_book_notes(spouse)
1910 }
1911 set(global_dead,local_dead) /* restore */
1912 } else {
1913 "\\noname" ".\n"
1914 } /* END if(spouse) block */
1915 }
1916
1917
1918 /* texname(i, type)
1919 Prints an individual's name in LaTeX format, with the surname in small caps.
1920 For example, "David Kenneth /Olsen/ Jr." would be printed as
1921 "David Kenneth {\sc Olsen} Jr.". The type argument determines how the name
1922 will appear in the index.
1923 type = 0: no index
1924 type = 1: page number appears in bold
1925 type = 2: page number appears in bold-italics
1926 type = 3: page number appears in normal text
1927 The parameter i can be either an INDI node (NOT an individual) or a
1928 NAME node.
1929 */
1930 proc texname(i, type) {
1931 list(name_list)
1932 set(sname, "")
1933 extractnames(i, name_list, num_names, surname_no)
1934 forlist(name_list, nm, num) {
1935 if(eq(num, surname_no)) {
1936 if(eq(strcmp(nm, ""), 0)) {
1937 " \\noname"
1938 set(sname, "\\noname")
1939 } else {
1940 if(eq(strcmp(nm, "____"), 0)) {
1941 set(sname, "\\noname")
1942 } else {
1943 " {\\sc "
1944 strxlat(tex_xlat, save(nm))
1945 "}"
1946 set(sname, nm)
1947 }
1948 }
1949 } else {
1950 " " strxlat(tex_xlat, nm)
1951 }
1952 }
1953 if(gt(type, 0)) {
1954 "\\index{"
1955 strxlat(tex_xlat, sname)
1956 if(gt(num_names, 1)) {
1957 ","
1958 }
1959 forlist(name_list, nm, num) {
1960 if(ne(num, surname_no)) {
1961 " "
1962 strxlat(tex_xlat, nm)
1963 }
1964 }
1965 if(eq(type, 1)) {
1966 "|bold"
1967 } elsif(eq(type, 2)) {
1968 "|bfit"
1969 }
1970 "}"
1971 }
1972 }
1973
1974
1975 /* process_event(event_node, event_name)
1976 Prints information about a particular event (event_node, which is a GEDCOM
1977 node). event_name is verb form of the text describing the event (such as
1978 "Born", "Died", etc.).
1979 */
1980 proc process_event(event_node) {
1981 call vitalEvent(event_node,0)
1982 call print_sources(event_node)
1983 call print_notes(event_node, " ")
1984 }
1985
1986
1987 proc inPlace(event) {
1988 if(place(event)) {
1989 if(eq(strcmp(place(event),""),0)) {
1990 " in \\noname"
1991 } else {
1992 call atAddr(event)
1993 if(not(strcmp(atAddrValue,""))) {
1994 set(fullSpecCompare,1)
1995 } else {
1996 set(fullSpecCompare,2)
1997 } /* there was an ADDR. We want to
1998 say at X in Y
1999 */
2000 list(placeList)
2001 list(placeTextList)
2002 list(placeTagList)
2003 extractplaces(event, placeList, nPlaces)
2004 requeue(placeList, atAddrValue)
2005 while(placeText, dequeue(placeList)) {
2006 enqueue(placeTextList, placeText)
2007 set(placeTag, placeText)
2008 forlist(placeList, place, placeN) {
2009 set(placeTag, save(concat(placeTag, concat("-", place))))
2010 }
2011 enqueue(placeTagList, placeTag)
2012 }
2013
2014 set(there, getel(placeTagList, 1))
2015 if(not(strcmp(there, lookup(eventPlaceTable, "@there@")))) {
2016 "\nthere"
2017 } else {
2018 insert(eventPlaceTable, "@there@", there)
2019 set(fullySpecified, 0)
2020 forlist(placeTextList, place, placeN) {
2021 set(placeTag, dequeue(placeTagList))
2022 if(not(eq(fullySpecified,fullSpecCompare))) {
2023 if(eq(placeN, 2)) {
2024 /* if the name of the place doesn't start with "near", say "in" */
2025 if(and(
2026 strcmp(substring(place,1,4), "near"),
2027 strcmp(substring(place,1,2), "in"),
2028 strcmp(substring(place,1,5), "south"),
2029 strcmp(substring(place,1,5), "north"),
2030 strcmp(substring(place,1,4), "west"),
2031 strcmp(substring(place,1,4), "from"),
2032 strcmp(substring(place,1,4), "east"))) {
2033 /* note that case matters a lot in that comparison */
2034 /* a town might be named North English, but one should
2035 always have written, "north of English" if
2036 you just want to say it is outside of town
2037 */
2038 "\nin "
2039 } else {
2040 if(not(strcmp(substring(place,1,4), "from"))) {
2041 " and was\n"
2042 /* Actually, that isn't quite what I want because if
2043 it has someone b. PLAC from there but no date, it'll wind
2044 up outputting "He was born and was from there".
2045 But oh well.
2046 */
2047 } else {
2048 "\n" /* put nothing there if it says "near" */
2049 }
2050 }
2051 } elsif(gt(placeN, 2)) {
2052 ", "
2053 }
2054 place
2055 if(strlen(place)) {
2056 if(not(lookup(eventPlaceTable, placeTag))) {
2057 insert(eventPlaceTable, placeTag, 1)
2058 /* this next fiddling with fullSpecCompare is because
2059 the FIRST time we see an "at ADDR in a,b,c"
2060 since ADDR-a-b-c isn't in the table, it would
2061 try to print "at ADDR in a,b". We just want it to
2062 print "at ADDR in a" if a,b,c was previously defined.
2063 */
2064 set(fullSpecCompare,1)
2065 } else {
2066 set(fullySpecified, add(fullySpecified,1))
2067 }
2068 if(gt(index(place,"Twp",1),0)) {
2069 /* then it is just the name
2070 of a township, which I don't think is much
2071 use without the county name, so I'm always
2072 going to force it to print the county name
2073 if it gives a township
2074 */
2075 set(fullSpecCompare,add(1,fullSpecCompare))
2076 }
2077 }
2078 }/* end if not fullySpecified */
2079 }
2080 }
2081 }/* matches the else for place being non-null */
2082 }
2083 }
2084
2085 /* Possible customization I have chosen not to implement:
2086 Suggested by: "John F. Chandler" <[email protected]>
2087 if(gt(nPlaces,1)) { set(inWord,"at") }
2088 else { set(inWord,"in") }
2089 if(not(strcmp(tag(event),"IMMI"))) { set(inWord,"to") }
2090 if(not(strcmp(tag(event),"GRAD"))) {
2091 if(eq(nPlaces,1)) { set(inWord,"from") }
2092 else { set(inWord,"-") }
2093 }
2094 inWord " "
2095 instead of the original "in ". This assumes that the institution is
2096 recorded in the PLAC
2097 I (DN) Think there is a little more to it than that because of the way
2098 I currently use atAddr, but I'm sure you can figure all that out.
2099 I currently assume that the institution name is the value of the
2100 1 GRAD line, e.g. 1 GRAD Univ. of Iowa and I handle it as a special case.
2101 */
2102
2103
2104 proc atAddr(root) {
2105 set(atAddrValue, "")
2106 if(root) {
2107 fornodes(root, node) {
2108 if(not(strcmp(tag(node), "PLAC"))) {
2109 fornodes(node, subnode) {
2110 if(and(not(strcmp(atAddrValue, "")),
2111 or(not(strcmp(tag(subnode), "ADDR")),
2112 not(strcmp(tag(subnode), "CEME"))))) {
2113 if(val, value(subnode)) {
2114 set(atAddrValue, save(concat("\nat ", val)))
2115 }
2116 }
2117 }
2118 }
2119 }
2120 }
2121 }
2122
2123
2124 proc check_print_divinfo(fam) {
2125 call getValue(fnode(fam), "DIV")
2126 if(gotValue) {
2127 " They divorced"
2128 call process_event(gottenNode)
2129 ". "
2130 }
2131 }
2132
2133
2134 /* print_notes(root, sep): Prints all the notes (NOTE nodes) associated with
2135 the GEDCOM line root, separated by the given separator.
2136 */
2137 proc print_notes(root, sep) {
2138 fornotes(root, note) {
2139 sep
2140 strxlat(tex_xlat, note)
2141 /* " "*/
2142 }
2143 }
2144
2145
2146 proc process_book_notes(indi) {
2147 set(hadpednote,0)
2148 set(haddescnote,0)
2149 set(doexcursion,0)
2150
2151 fornotes(inode(indi), note) {
2152 set(i, index(note, "BOOKPEDIGREE", 1))
2153 if(gt(i, 0)) {
2154 set(hadpednote, 1)
2155 }
2156 set(i, index(note, "BOOKDESCENDENT", 1))
2157 if(gt(i, 0)) {
2158 set(haddescnote, 1)
2159 }
2160 set(i, index(note, "BOOKEXCURSION", 1))
2161 if(gt(i, 0)) {
2162 set(doexcursion, 1)
2163 }
2164 set(i, index(note, "BOOKCHAPSPLIT", 1))
2165 if(gt(i, 0)) {
2166 set(hadsplitnote, 1)
2167 }
2168 }
2169 if(eq(hadpednote,1)) {
2170 call pedigreeFigure(indi)
2171 if(strcmp(pedigreeFigureLabel, "")) {
2172 pn(indi, 2)
2173 " pedigree is illustrated in Figure \\protect\\ref{"
2174 pedigreeFigureLabel "}."
2175 }
2176 }
2177 if(force_desc_chart) {
2178 set(haddescnote,1)
2179 }
2180 if(eq(haddescnote,1)) {
2181 set(descFigureLabel, save(concat(key(indi), "-figure-desc")))
2182 "\nA brief chart of the descendants of "
2183 call texname(inode(indi), 3)
2184 " is contained in "
2185 "Figure~\\ref{" descFigureLabel "}."
2186 "\n\\begin{figure*}\n"
2187 "\\centering\n"
2188 call desc_chart_main3(indi)
2189 "\n\\caption{Descendents of " strxlat(tex_xlat, fullname(indi,0,1,99)) "({\\bf "
2190 d(lookup(stab, key(indi))) "})}" nl()
2191 "\\label{" descFigureLabel "}"
2192 "\\end{figure*}\n"
2193 }
2194 if(eq(0, ancestormode)) {
2195 if(eq(doexcursion, 1)) {
2196 pn(indi, 2) " ancestors will be discussed in depth on page~\\pageref{"
2197 key(indi) "-excur-ref}"
2198 " in this chapter.\n\n"
2199 enqueue(excurlist, indi)
2200 }
2201 }
2202 }
2203
2204 proc pedigreeFigure(i) {
2205 indiset(iSet)
2206 addtoset(iSet, i, 1)
2207 set(max, 0)
2208 indiset(extraSet)
2209 set(extraSet,ancestorset(iSet))
2210 forindiset(extraSet, indi, val, num) {
2211 if(gt(val, max)) {
2212 set(max, val)
2213 }
2214 }
2215 if(gt(max, 1)) {
2216 set(pedigreeFigureLabel, save(concat(key(i), "-figure-pedigree")))
2217 if(gt(max, 5)) {
2218 set(max, 5)
2219 }
2220 call figPed(max, i)
2221 } else {
2222 set(pedigreeFigureLabel, "")
2223 }
2224 }
2225
2226 proc figPed(n, indi) {
2227 "\n\\begin{figure*}"
2228 "\n\\centering"
2229 "\n\\small"
2230 "\n\\setlength{\\unitlength}{"
2231 if(eq(n, 5)) { ".8" } else { ".9" }
2232 "\n\\baselineskip}"
2233
2234 call pow(2, n)
2235 "\n\\begin{picture}("
2236 d(add(mul(6, n), 12))
2237 ","
2238 d(sub(mul(powValue, 2), 1))
2239 ")(0,.5)"
2240
2241 call ped6(indi, 0, powValue, powValue)
2242
2243 "\n\\end{picture}"
2244 "\n\\caption{Pedigree of " call scname(indi) "}"
2245 "\n\\label{" pedigreeFigureLabel "}"
2246 "\n\\end{figure*}"
2247 }
2248
2249 proc ped6(indi, x, y, z) {
2250 "\n\\put(" d(mul(x, 6)) "," d(y) "){\\makebox(0,0)[l]{"
2251 call scname(indi)
2252 "}}"
2253 if(x) {
2254 "\n\\put(" d(sub(mul(x, 6), 3)) "," d(y) "){\\line(1,0){" d(3) "}}"
2255 "\n\\put(" d(sub(mul(x, 6), 3)) "," d(y) "){\\line(0,"
2256 if(female(indi)) { "1" } else { "-1" }
2257 "){" d(sub(z, 1)) ".4}}"
2258 }
2259 if(z2, div(z, 2)) {
2260 if(f, father(indi)) { call ped6(f, add(x, 1), add(y, z2), z2) }
2261 if(m, mother(indi)) { call ped6(m, add(x, 1), sub(y, z2), z2) }
2262 }
2263 }
2264
2265 proc scname(indi) {
2266 strxlat(tex_xlat, fullname(indi, 0, 1, 99))
2267 if(lookup(stab, key(indi))) {
2268 "({\\bf "
2269 d( lookup(stab, key(indi)))
2270 "})"
2271 }
2272 }
2273
2274 proc pow(x, i) {
2275 set(powValue, 1)
2276 call powIt(x, i)
2277 }
2278
2279 proc powIt(x, i) {
2280 if(i) {
2281 set(powValue, mul(powValue, x))
2282 call powIt(x, sub(i, 1))
2283 }
2284 }
2285
2286
2287 /* print_sources(root)
2288 Prints all sources (SOUR lines) associated with the given GEDCOM line. The
2289 sources are formatted as LaTeX footnotes. This routine prints each SOUR line
2290 as a separate footnote, which is not correct. This should be corrected so
2291 that all sources are combined into a single footnote.
2292 */
2293 proc print_sources(root) {
2294 enqueue(sourceList,root)
2295 call sourceIt(sourceList)
2296 }
2297
2298
2299 /* valuec(n): Prints the value of a GEDCOM node and the values of any CONT
2300 lines associated with it.
2301 */
2302 proc valuec(n) {
2303 value(n)
2304 fornodes(n, n1) {
2305 if(eq(strcmp(tag(n1), "CONT"), 0)) {
2306 "\n" value(n1)
2307 } elsif(eq(strcmp(tag(n1), "CONC"), 0)) {
2308 value(n1)
2309 }
2310 }
2311 }
2312
2313
2314 proc resetdayplace() {
2315 call setDayNumber(0)
2316 insert(eventPlaceTable, "@there@", "")
2317 }
2318
2319 proc vitalEvent(event, reset) {
2320 if(reset) {
2321 call setDayNumber(0)
2322 insert(eventPlaceTable, "@there@", "")
2323 }
2324 if(event) {
2325 if(eventName, lookup(eventNameTable, tag(event))) {
2326 " " eventName
2327 if(
2328 or(
2329 not(strcmp(tag(event), "ADOP")),
2330 not(strcmp(tag(event), "CHR")),
2331 not(strcmp(tag(event), "CREM")),
2332 not(strcmp(tag(event), "BURI"))
2333 )) {
2334 set(previousDayNumber, dayNumber)
2335 } else {
2336 set(previousDayNumber, 0)
2337 }
2338 }
2339 if(not(eventName)) {
2340 call getValue(event, "TYPE")
2341 if(gotValue) {
2342 " " strxlat(tex_xlat, gottenValue)
2343 }
2344 }
2345 if(not(strcmp(tag(event), "DEAT"))) {
2346 call ofCause(event)
2347 }
2348 call onDate(event)
2349 call atAge(event)
2350 call inPlace(event)
2351 }
2352 }
2353
2354
2355 proc setDayNumber(event) {
2356 set(dayNumber, 0)
2357 if(date(event)) {
2358 extractdate(event, day, month, year)
2359 /* DAB - Have to check day month and year, otherwise two events for which
2360 only the year is known
2361 are said to have occurred on "the same day"
2362 */
2363 if(and(and(year, month), day)) {
2364 set(yearNumber,
2365 add(mul(year, 365), div(year, 4),
2366 neg(div(year, 100)), div(year, 400)))
2367 set(monthNumber, getel(daysToMonthList, month))
2368 set(leapYear, and(eq(mod(year, 4), 0),
2369 not(and(eq(mod(year, 100), 0), ne(mod(year, 400), 0)))))
2370 if(and(leapYear, le(month, 2))) {
2371 decr(monthNumber)
2372 }
2373 set(dayNumber, add(yearNumber, monthNumber, day))
2374 }
2375 }
2376 }
2377
2378
2379 /* This was the old way, replaced by the above by Jim Eggert */
2380 /*
2381 proc setDayNumber(event) {
2382 set(dayNumber, 0)
2383 if(date(event)) {
2384 extractdate(event, day, month, year)
2385 if(year) {
2386 set(yearNumber, sub(add(mul(year, 365), div(year, 4)), div(year, 400)))
2387 set(monthNumber, getel(daysToMonthList, month))
2388 set(leapYear, and(eq(mod(year, 4), 0),
2389 not(and(eq(mod(year, 100), 0), ne(mod(year, 400), 0)))))
2390 if(and(leapYear, gt(month, 2))) {
2391 incr(monthNumber)
2392 }
2393 set(dayNumber, add(yearNumber, monthNumber, day))
2394 }
2395 }
2396 }
2397 */
2398
2399
2400 proc atAge(event) {
2401 call getValueCont(event, "AGE")
2402 if(gotValue) {
2403 if(not(strcmp(gottenValue, "young"))) {
2404 "\nyoung"
2405 } elsif(not(strcmp(gottenValue, "0"))) {
2406 "\nas an infant"
2407 } elsif(not(strcmp(gottenValue, "infancy"))) {
2408 "\nas an infant"
2409 } else {
2410 "\nat age "
2411 strxlat(tex_xlat, gottenValue)
2412 }
2413 }
2414 }
2415
2416
2417 proc ofCause(event) {
2418 call getValueCont(event, "CAUS")
2419 if(gotValue) {
2420 "\nof "
2421 strxlat(tex_xlat, gottenValue)
2422 }
2423 }
2424
2425
2426 proc onDate(event) {
2427 if(atmax_generation) {
2428 if(global_dead) {
2429 set(year_only,0)
2430 } else {
2431 set(year_only,1)
2432 }
2433 } else {
2434 set(year_only,0)
2435 }
2436 call setDayNumber(event)
2437 if(d, date(event)) {
2438 if(strcmp(d, "Not married")) {
2439 if(eq(strcmp(d, ""),0)) { "\nin \\nodate\\ " }
2440 elsif(eq(index(d, "AFT", 1), 1)) { "\nsome time after " }
2441 elsif(eq(index(d, "Aft", 1), 1)) { "\nsome time after " }
2442 elsif(eq(index(d, "BEF", 1), 1)) { "\nsome time before " }
2443 elsif(eq(index(d, "Bef", 1), 1)) { "\nsome time before " }
2444 elsif(eq(index(d, "ABT", 1), 1)) { "\ncirca " }
2445 elsif(eq(index(d, "Abt", 1), 1)) { "\ncirca " }
2446 elsif(eq(index(d, "FROM", 1), 1)) {
2447 set(t, index(d, "TO", 1))
2448 /*
2449 DAB - experimental (and not working)
2450 set(fromDateEvent, createnode("EVEN", ""))
2451 set(fromDateNode, createnode("DATE", substring(d, add(1, strlen("FROM")), sub(t, 1)) ))
2452 addnode(fromDateNode, fromDateEvent, 0)
2453 set(toDateEvent, createnode("EVEN", ""))
2454 set(toDateNode, createnode("DATE", substring(d, add(t, strlen("TO")), strlen(d)) ))
2455 addnode(toDateNode, toDateEvent, 0)
2456 DEBUG:
2457 "\n from date nodes: "
2458 traverse(fromDateEvent, xx, yy) {
2459 d(yy) ": " tag(xx) " " value(xx)
2460 }
2461 "\n to date nodes: "
2462 traverse(toDateEvent, xx, yy) {
2463 d(yy) ": " tag(xx) " " value(xx)
2464 }
2465
2466 "\nfrom " stddate(fromDateEvent)
2467 " to " stddate(toDateEvent)
2468 deletenode(toDateNode)
2469 deletenode(toDateEvent)
2470 deletenode(fromDateNode)
2471 deletenode(fromDateEvent)
2472 DAB - end of experimental
2473 */
2474
2475 /* DAB - This way work, but doesn't necessarily produce dates in the same
2476 format as stddate
2477 */
2478 "\nfrom " substring(d, add(1, strlen("FROM")), sub(t, 1))
2479 " to " substring(d, add(t, strlen("TO")), strlen(d))
2480 set(event, 0)
2481 } elsif(i, index(d, "-", 1)) {
2482 "\nbetween " substring(d, 1, sub(i, 1))
2483 " and " substring(d, add(i, 1), strlen(d))
2484 set(event, 0)
2485 } elsif(and(dayNumber, eq(dayNumber, previousDayNumber))) {
2486 "\non the same day"
2487 set(event, 0)
2488 } elsif(and(dayNumber, eq(dayNumber, add(previousDayNumber, 1)))) {
2489 "\non the next day"
2490 set(event, 0)
2491 } elsif(and(dayNumber, eq(dayNumber, add(previousDayNumber, 2)))) {
2492 "\ntwo days later"
2493 set(event, 0)
2494 } elsif(and(dayNumber, eq(dayNumber, add(previousDayNumber, 7)))) {
2495 "\none week later"
2496 set(event, 0)
2497 } else {
2498 if(year_only) { "\nin "
2499 } else {
2500 extractdate(event, d, m, y)
2501 if(d) { "\non " } else { "\nin " }
2502 }
2503 }
2504 if(event) {
2505 if(and(dayNumber, eq(dayNumber, previousDayNumber))) {
2506 "that day"
2507 } else {
2508 if(year_only) {
2509 year(event)
2510 } else {
2511 stddate(event)
2512 }
2513 }
2514 }
2515 }
2516 }
2517 }
2518
2519 proc getValue(root, t) {
2520 set(gotValue, 0)
2521 if(root) {
2522 fornodes(root, node) {
2523 if(and(not(gotValue), not(strcmp(tag(node), t)))) {
2524 set(gotValue, 1)
2525 set(gottenNode, node)
2526 set(gottenValue, save(value(node)))
2527 }
2528 }
2529 }
2530 }
2531
2532
2533 proc getValueCont(root, t) {
2534 set(gotValue, 0)
2535 if(root) {
2536 fornodes(root, node) {
2537 if(and(not(gotValue), not(strcmp(tag(node), t)))) {
2538 set(gotValue, 1)
2539 set(gottenNode, node)
2540 set(gottenValue, save(value(node)))
2541 fornodes(node, subnode) {
2542 if(not(strcmp("CONT", tag(subnode)))) {
2543 /* If you want empty CONT tags to not leave a blank line, uncomment the following "if".
2544 * However, a blank line can be very useful (or even necessary) for some TeX formatting.
2545 */
2546 /*if(strlen(value(subnode))) {*/
2547 set(gottenValue,
2548 save(concat(gottenValue, "\n", value(subnode))))
2549 /*}*/
2550 } elsif(not(strcmp("CONC", tag(subnode)))) {
2551 /* Same comment as above, this time for CONC tags */
2552 /*if(strlen(value(subnode))) {*/
2553 set(gottenValue,
2554 save(concat(gottenValue, value(subnode))))
2555 /*}*/
2556 }
2557 }
2558 }
2559 }
2560 }
2561 }
2562
2563
2564 proc getValueCommaCont(root, t) {
2565 set(gotValue, 0)
2566 if(root) {
2567 fornodes(root, node) {
2568 if(and(not(gotValue), not(strcmp(tag(node), t)))) {
2569 set(gotValue, 1)
2570 set(gottenNode, node)
2571 set(gottenValue, save(value(node)))
2572 fornodes(node, subnode) {
2573 if(not(strcmp("CONT", tag(subnode)))) {
2574 if(strlen(value(subnode))) {
2575 set(gottenValue,
2576 save(concat(gottenValue, ",\n", value(subnode))))
2577 }
2578 } elsif(not(strcmp("CONC", tag(subnode)))) {
2579 if(strlen(value(subnode))) {
2580 set(gottenValue,
2581 save(concat(gottenValue, value(subnode))))
2582 }
2583 }
2584 }
2585 }
2586 }
2587 }
2588 }
2589
2590
2591 proc aAn(s) {
2592 set(s, save(trim(lower(s), 1)))
2593 if(not(strcmp(s, "a"))) { "an" }
2594 elsif(not(strcmp(s, "e"))) { "an" }
2595 elsif(not(strcmp(s, "i"))) { "an" }
2596 elsif(not(strcmp(s, "o"))) { "an" }
2597 elsif(not(strcmp(s, "u"))) { "an" }
2598 elsif(not(strcmp(s, "x"))) { "an" }
2599 else { "a" }
2600 }
2601
2602
2603 func printablefirstname(i) {
2604 set(firstname, givens(i))
2605 if(eq(strcmp(firstname, ""), 0)) {
2606 set(namereturn, save("\\noname"))
2607 } else {
2608 set(where, index(firstname, " ", 1))
2609 /* don't print out middle names */
2610 if(gt(where, 0)) {
2611 set(namereturn, save(substring(firstname, 1, sub(where, 1))))
2612 } else {
2613 set(namereturn, save(firstname))
2614 } /* if no middle names */
2615 set(namereturn, strxlat(tex_xlat, namereturn))
2616 }
2617 return(namereturn)
2618 }
2619
2620 proc iswas(indi) {
2621 call setDayNumber(birth(indi))
2622 if(or(death(indi), or(not(dayNumber), lt(dayNumber, 693971)))) {
2623 "\nwas"
2624 } else {
2625 "\nis"
2626 }
2627 }
2628
2629
2630 /* Check to see if this family might still have children at some point:
2631 If one spouse is dead, too old, or they are divorced; then they won't.
2632 */
2633 proc havehadchildren(indi, spouse) {
2634 call setDayNumber(birth(indi))
2635 set(indiDayNumber, dayNumber)
2636 call setDayNumber(birth(spouse))
2637 set(divp, 0)
2638 spouses(indi, s, f, n) {
2639 if(eq(s, spouse)) {
2640 call getValue(fnode(f), "DIV")
2641 set(divp, gotValue)
2642 break()
2643 }
2644 }
2645 if(
2646 or(
2647 death(indi),
2648 or(not(indiDayNumber), lt(indiDayNumber, 693971)), death(spouse),
2649 or(not(dayNumber), lt(dayNumber, 693971)),
2650 divp
2651 )) {
2652 "\\ had no children.\n"
2653 } else {
2654 "\\ have no children.\n"
2655 }
2656 }
2657
2658 /* illegit_check gives people a break. If we have no marriage record,
2659 the assumption still is that the couple were married and that
2660 is the word we stick in the text.
2661 Only if it specifically says they were not married, do we
2662 state that they weren't
2663 */
2664 proc illegit_check(fam) {
2665 set(not_married_flag, 0)
2666 if(e,marriage(fam)) {
2667 if(d, date(e)) {
2668 if(not(strcmp(d, "Not married"))) {
2669 set(not_married_flag, 1)
2670 }
2671 }
2672 }
2673 }
2674
2675
2676 proc sourceIt(sourceList) {
2677 list(cList)
2678 list(fList)
2679 set(cn, 0)
2680 while(root, dequeue(sourceList)) {
2681 fornodes(root, node) {
2682 if(not(strcmp( tag(node), "SOUR"))) {
2683 set(footnote, 1)
2684 set(val, value(node))
2685 if(val) {
2686 if(reference(val)) {
2687 call bibliographize(dereference(val))
2688 }
2689 }
2690 if(xref(node)) {
2691 call bibliographize(node)
2692 set(val, xref(node))
2693 }
2694 if(val) {
2695 set(a1, index(val, "@", 1))
2696 set(a2, index(val, "@", 2))
2697 if(and(eq(a1, 1), eq(a2, strlen(val)))) {
2698 set(c, save(substring(val, 2, sub(strlen(val), 1))))
2699 enqueue(cList, c)
2700 incr(cn)
2701 set(footnote, 0)
2702 }
2703 } else {
2704 set(subnodecount, 0)
2705 fornodes(node, subnode) {
2706 if(strcmp(tag(subnode), "SOUR")) {
2707 incr(subnodecount)
2708 }
2709 }
2710 if(eq(subnodecount, 0)) {
2711 fornodes(node, subnode) {
2712 set(val, value(subnode))
2713 /* With loadsources, this is needed here. It is technically
2714 illegal gedcom.
2715 */
2716 if(xref(subnode)) {
2717 call bibliographize(subnode)
2718 set(val, xref(subnode))
2719 }
2720 if(val) {
2721 set(a1, index(val, "@", 1))
2722 set(a2, index(val, "@", 2))
2723 if(and(eq(a1, 1), eq(a2, strlen(val)))) {
2724 set(c, save(substring(val, 2, sub(strlen(val), 1))))
2725 enqueue(cList, c)
2726 incr(cn)
2727 }
2728 }
2729 }
2730 set(footnote, 0)
2731 }
2732 }
2733 if(footnote) {
2734 enqueue(fList, node)
2735 }
2736 }
2737 }
2738 }
2739 while(cn) {
2740 forlist(cList, c, n) {
2741 if(and(ne(n, cn), not(strcmp(c, getel(cList, cn))))) {
2742 setel(cList, cn, "")
2743 }
2744 }
2745 decr(cn)
2746 }
2747 if(not(empty(fList))) {
2748 "\n\\footnote{"
2749 while(f, dequeue(fList)) {
2750 set(first, 1)
2751 call getValueCont(f, "TITL")
2752 if(gotValue) {
2753 if(not(first)) { ", " } else { set(first, 0) }
2754 "\n"
2755 strxlat(tex_xlat, gottenValue)
2756 }
2757 call getValueCont(f, "DATE")
2758 if(gotValue) {
2759 if(not(first)) { ", " } else { set(first, 0) }
2760 "\n"
2761 strxlat(tex_xlat, gottenValue)
2762 }
2763 call getValueCont(f, "PLAC")
2764 if(gotValue) {
2765 if(not(first)) { ", " } else { set(first, 0) }
2766 "\n"
2767 strxlat(tex_xlat, gottenValue)
2768 }
2769 call getValueCont(f, "VOLU")
2770 if(gotValue) {
2771 if(not(first)) { ", " } else { set(first, 0) }
2772 if(
2773 or(index(gottenValue, "-", 1),
2774 index(gottenValue, ",", 1),
2775 index(gottenValue, "and ", 1)
2776 )) {
2777 "\nVolumes "
2778 } else {
2779 "\nVolume "
2780 }
2781 strxlat(tex_xlat, gottenValue)
2782 }
2783 call getValueCont(f, "PAGE")
2784 if(gotValue) {
2785 if(not(first)) { ", " } else { set(first, 0) }
2786 if(
2787 or(index(gottenValue, "-", 1),
2788 index(gottenValue, ",", 1),
2789 index(gottenValue, "and ", 1)
2790 )) {
2791 "\nPages "
2792 } else {
2793 "\nPage "
2794 }
2795 strxlat(tex_xlat, gottenValue)
2796 }
2797 call getValueCont(f, "FILM")
2798 if(gotValue) {
2799 if(not(first)) { ", " } else { set(first, 0) }
2800 "on Latter Day Saints Microfilm Number "
2801 strxlat(tex_xlat, gottenValue)
2802 }
2803
2804 call getValueCont(f, "TEXT")
2805 if(gotValue) {
2806 set(first, 0)
2807 "\n"
2808 strxlat(tex_xlat, gottenValue)
2809 }
2810 if(not(first)) { "\\@." }
2811 call getValueCont(f, "NOTE")
2812 if(gotValue) {
2813 set(first, 0)
2814 "\n"
2815 strxlat(tex_xlat, gottenValue)
2816 }
2817 if(and(first, not(value(f)))) { "\n" }
2818 call values(f)
2819 }
2820 "}"
2821 }
2822 if(not(empty(cList))) {
2823 "\\cite{"
2824 while(c, dequeue(cList)) {
2825 if(strlen(c)) {
2826 if(cn) { "," }
2827 c
2828 incr(cn)
2829 }
2830 }
2831 "}"
2832 }
2833 }
2834
2835 proc bibliographize(root) {
2836 set(val, xref(root))
2837 set(c, save(substring(val, 2, sub(strlen(val), 1))))
2838
2839 if(not(lookup(bibTable, c))) {
2840 insert(bibTable, c, 1)
2841
2842 /*
2843 call getValueCont(root, "TEXT")
2844 if(figureFlag, gotValue) {
2845 enqueue(figureCiteList, c)
2846 enqueue(figureNodeList, gottenNode)
2847 }
2848 */
2849 set(cref, save(concat("\\protect\\ref{", c, "}")))
2850 set(pref, save(concat("\\protect\\pageref{", c, "}")))
2851
2852 set(b, "\\bibitem")
2853 if(figureFlag) {
2854 set(b, save(concat(b, "[", cref, "]")))
2855 }
2856 set(b, save(concat(b, "{", c, "} ")))
2857 call getValueCont(root, "TITL")
2858 if(gotValue) {
2859 set(b, save(concat(b, "{\\em ", strxlat(tex_xlat, gottenValue), "}, ")))
2860 }
2861 call getValueCont(root, "AUTH")
2862 if(gotValue) {
2863 set(b, save(concat(b, " ", strxlat(tex_xlat, gottenValue), ", ")))
2864 set(authnode, gottenNode)
2865 call getValueCont(authnode, "EMAI")
2866 if(gotValue) {
2867 if(opt_email) {
2868 set(b, save(concat(b, strxlat(tex_xlat, gottenValue), ", ")))
2869 } else {
2870 set(b, save(concat(b, "e-mail address on file, ")))
2871 }
2872 }
2873 }
2874 call getValueCont(root, "PUBL")
2875 if(gotValue) {
2876 set(pubnode,gottenNode)
2877 call getValueCont(pubnode, "NAME")
2878 if(gotValue) {
2879 set(b, save(
2880 concat(b, "in {\\em ", strxlat(tex_xlat, gottenValue), "}, ")))
2881 }
2882 call getValueCommaCont(pubnode, "ADDR")
2883 if(gotValue) {
2884 set(b, save(
2885 concat(b, strxlat(tex_xlat, gottenValue), ": ")))
2886 }
2887 call getValueCont(pubnode, "PUBR")
2888 if(gotValue) {
2889 set(b, save(
2890 concat(b, strxlat(tex_xlat, gottenValue), ", ")))
2891 }
2892 call getValueCont(pubnode, "PHON")
2893 if(gotValue) {
2894 set(b, save(concat(b, strxlat(tex_xlat, gottenValue), ", ")))
2895 }
2896 call getValueCont(pubnode, "DATE")
2897 if(gotValue) {
2898 set(b, save(
2899 concat(b, strxlat(tex_xlat, gottenValue), ", ")))
2900 }
2901 call getValueCont(pubnode, "VOLU")
2902 if(gotValue) {
2903 set(word, "Volume ")
2904 if(
2905 or(index(gottenValue, "-", 1),
2906 index(gottenValue, ",", 1),
2907 index(gottenValue, "and ", 1)
2908 )) {
2909 set(word, "Volumes ")
2910 }
2911 set(b, save(concat(b, word, strxlat(tex_xlat, gottenValue), ", ")))
2912 }
2913 call getValueCont(pubnode, "NUM")
2914 if(gotValue) {
2915 set(word, "Number ")
2916 if(
2917 or(index(gottenValue, "-", 1),
2918 index(gottenValue, ",", 1),
2919 index(gottenValue, "and ", 1)
2920 )) {
2921 set(word, "Numbers ")
2922 }
2923 set(b, save(concat(b, word, strxlat(tex_xlat, gottenValue), ", ")))
2924 }
2925 call getValueCont(root, "LCCN")
2926 if(gotValue) {
2927 set(b, save(
2928 concat(b, "Call Number ", strxlat(tex_xlat, gottenValue), ", ")))
2929 }
2930 }
2931 call getValueCont(root, "PAGE")
2932 if(gotValue) {
2933 set(word, "page ")
2934 if(
2935 or(index(gottenValue, "-", 1),
2936 index(gottenValue, ",", 1),
2937 index(gottenValue, "and ", 1)
2938 )) {
2939 set(word, "pages ")
2940 }
2941 set(b, save(concat(b, word, strxlat(tex_xlat, gottenValue), ", ")))
2942 }
2943 call getValueCont(root, "FILM")
2944 if(gotValue) {
2945 set(b, save(concat(b,
2946 "Filmed by the Church of Jesus Christ of Latter Day Saints, ",
2947 "Microfilm Number ",
2948 strxlat(tex_xlat, gottenValue), ", ")))
2949 }
2950 call getValueCont(root, "FICH")
2951 if(gotValue) {
2952 set(b, save(concat(b,
2953 "Filmed by the Church of Jesus Christ of Latter Day Saints, ",
2954 "Microfiche Number ",
2955 strxlat(tex_xlat, gottenValue), ", ")))
2956 }
2957 call getValueCont(root, "REPO")
2958 if(gotValue) {
2959 set(b, save(concat(b, "at ", strxlat(tex_xlat, gottenValue), ", ")))
2960 }
2961
2962 if(index(b, ", ", 1)) {
2963 set(b, save(concat(save(substring(b, 1, sub(strlen(b), 2))), ".")))
2964 }
2965
2966 call getValueCont(root, "NOTE")
2967 if(gotValue) { set(b, save(concat(b, " ", strxlat(tex_xlat, gottenValue)))) }
2968
2969 call getValueCont(root, "TEXT")
2970 if(gotValue) { set(b, save(concat(b, " ", strxlat(tex_xlat, gottenValue)))) }
2971
2972 call getValueCont(root, "HIDE")
2973 if(gotValue) { set(b, save(concat(b, " ", strxlat(tex_xlat, gottenValue)))) }
2974
2975 call getValueCont(root, "SOUR")
2976 if(gotValue) {
2977 set(bb, "?")
2978 if(gottenValue) {
2979 set(a1, index(gottenValue, "@", 1))
2980 set(a2, index(gottenValue, "@", 2))
2981 if(and(eq(a1, 1), eq(a2, strlen(gottenValue)))) {
2982 set(bb, save(substring(gottenValue, 2, sub(strlen(gottenValue), 1))))
2983 }
2984 }
2985 set(b, save(concat(b, "\\cite{", strxlat(tex_xlat, bb), "}")))
2986 }
2987
2988 if(figureFlag) {
2989 set(b, save(concat(b, " See figure on page~", pref, ".")))
2990 }
2991
2992 /* This while loop undoes the line breaking in a CONT/CONC.
2993 Since those line breaks can be
2994 significant, it is commented out.
2995 */
2996 /*
2997 while(i, index(b, "\n", 1)) {
2998 set(b, save(
2999 concat(
3000 substring(b, 1, sub(i, 1)),
3001 " ",
3002 substring(b, add(i, 1), strlen(b))
3003 ) ))
3004 }
3005 */
3006 enqueue(bibList, save(concat(b, "\n")))
3007 }
3008 }
3009
3010
3011 proc getText(root, paragraph) {
3012 set(pronounOkay, 1)
3013 if(root) {
3014 if(eq(1,notes_text_mode)) { /* only 1 TEXT records */
3015 fornodes(root, node) {
3016 if(not(strcmp("TEXT", tag(node)))) {
3017 set(pronounOkay, 0)
3018 if(paragraph) {
3019 "\n\n" set(paragraph, 0)
3020 }
3021 call values(node)
3022 "\n\n"
3023 }
3024 }
3025 } else {
3026 if(eq(2,notes_text_mode)) { /* all 1 NOTE records */
3027 fornotes(root, note) {
3028 if(paragraph) {
3029 "\n\n" set(paragraph, 0)
3030 }
3031 strxlat(tex_xlat, note)
3032 "\n\n"
3033 set(pronounOkay, 0)
3034 }
3035 } else { /* only !-tagged 1 NOTE records (1st char must be !) */
3036 fornotes(root, note) {
3037 set(i, index(note,"!",1))
3038 if(eq(1,i)) {
3039 set(pronounOkay, 0)
3040 if(paragraph) {
3041 "\n\n" set(paragraph, 0)
3042 }
3043 strxlat(tex_xlat, substring(note, 2, strlen(note)))
3044 "\n\n"
3045 }
3046 }
3047 }
3048 }
3049 }
3050 /* if we printed any notes, then reset things so we don't use
3051 "there" in place names right after the notes.
3052 */
3053 if(not(pronounOkay)) {
3054 insert(eventPlaceTable, "@there@", "")
3055 }
3056 }
3057
3058 proc values(root) {
3059 if(root) {
3060 if(strlen(value(root))) { "\n" strxlat(tex_xlat, value(root)) }
3061 fornodes(root, node) {
3062 if(not(strcmp("CONT", tag(node)))) {
3063 if(strlen(value(node))) {
3064 "\n" strxlat(tex_xlat, value(node))
3065 }
3066 } elsif(not(strcmp("CONC", tag(node)))) {
3067 if(strlen(value(node))) {
3068 strxlat(tex_xlat, value(node))
3069 }
3070 }
3071 }
3072 if(root) {
3073 enqueue(sourceList, root)
3074 }
3075 call sourceIt(sourceList)
3076 }
3077 }
3078
3079
3080 /********************************************************************/
3081 /* below here are routines for printing descendant charts */
3082 /*
3083 * These are adapted from desc-tex
3084 * By Eric Majani ([email protected])
3085 */
3086
3087 proc desc_chart_main3(indi) {
3088 "\\tree\n"
3089 call desc_chart_out(indi,3,1)
3090 "\\endtree\n"
3091 }
3092
3093
3094 proc descch_indi(indi) {
3095 "{\\bf " call desc_chart_name(indi) "}"
3096 if(or(birth(indi),death(indi))) {
3097 " "
3098 if(e, birth(indi)) {
3099 year(e)
3100 }
3101 "-"
3102 if(e, death(indi)) {
3103 year(e)
3104 }
3105 }
3106 nl()
3107 families(indi,fam,sp,num) {
3108 if(e,marriage(fam)) {
3109 " m. " short(e) nl()
3110 }
3111 }
3112 }
3113
3114
3115 proc desc_chart_name(i) {
3116 set(whole, givens(i))
3117 set(space,index(whole, " ", 1))
3118 if(gt(space, 0)) {
3119 strxlat(tex_xlat, substring(whole, 1, space))
3120 } else {
3121 strxlat(tex_xlat, whole) " "
3122 }
3123 if(eq(strcmp(surname(i), "____"), 0)) {
3124 " \\noname"
3125 } else {
3126 strxlat(tex_xlat, surname(i))
3127 }
3128 }
3129
3130
3131 proc descch_indinomar(indi) {
3132 "{\\bf " call desc_chart_name(indi) "}"
3133 if(or(birth(indi),death(indi))) {
3134 " "
3135 if(e, birth(indi)) {
3136 year(e)
3137 }
3138 "-"
3139 if(e, death(indi)) {
3140 year(e)
3141 }
3142 }
3143 nl()
3144 }
3145
3146
3147 proc descch_prcouple(indi,fam,num) {
3148 if(eq(num,1)) {
3149 "{\\bf "
3150 call desc_chart_name(indi)
3151 "}"
3152 if(e, birth(indi)) {
3153 " " year(e)"-"
3154 }
3155 if(e, death(indi)) {
3156 if(not(birth(indi))) {
3157 " -"
3158 }
3159 year(e)
3160 }
3161 }
3162 nl()
3163
3164 /* I can't remember why I put this IF in here. I guess I'll take it out
3165 and see what breaks!
3166 */
3167 /*
3168 if(eq(num,nfamilies(indi))) {
3169 */
3170 if(e,marriage(fam)) {
3171 " m. " year(e) " "
3172 } else {
3173 "m.\\ \\ \\ \\ \\ \\ "
3174 } /* space over without date */
3175 /*}*/
3176 }
3177
3178
3179 proc descch_printfam(indi,fam,sp) {
3180 "\\spouse{ " call desc_chart_name(sp) "}" nl()
3181 }
3182
3183
3184 proc desc_chart_out(indi,depth,level) {
3185 if(or(eq(0,nfamilies(indi)),eq(depth,level))) {
3186 call descch_indinomar(indi)
3187 }
3188 if(lt(level,depth)) {
3189 families(indi,fam,sp,num) {
3190 call descch_prcouple(indi,fam,num)
3191 call descch_printfam(indi,fam,sp)
3192 set(level,add(level,1))
3193 set(num2,0)
3194 if(le(level,depth)) {
3195 children(fam,child,num2) {
3196 "\\subtree " nl()
3197 call desc_chart_out(child,depth,level)
3198 "\\endsubtree " nl()
3199 }
3200 }
3201 set(num2,nchildren(fam))
3202 set(level,sub(level,1))
3203 set(temp1,ne(num,nfamilies(indi)))
3204 set(temp2,gt(num2,0))
3205 if(and(temp1,temp2))
3206 /*
3207 if(ne(num,nfamilies(indi)))
3208 */
3209 {
3210 if(eq(level,1)) {
3211 "\\endtree " nl()
3212 "\\tree " nl()
3213 } else {
3214 "\\endsubtree " nl()
3215 "\\subtree " nl()
3216 }
3217 }
3218 }
3219 }
3220 }
3221
3222 proc excursion(indi) {
3223 list(anclist)
3224 indiset(ancset)
3225
3226 "\n\\section{" strxlat(tex_xlat, surname(indi)) " Ancestors" "}" "\n"
3227 "\\label{" key(indi) "-excur-ref}" "\n"
3228
3229 /* get us to the patriarch of the line.*/
3230 set(thisguy,indi)
3231 addtoset(ancset,thisguy,0)
3232 while(father(thisguy)) {
3233 set(thisguy,father(thisguy))
3234 push(anclist,thisguy)
3235 addtoset(ancset,thisguy,0)
3236 }
3237 "The " strxlat(tex_xlat, surname(indi)) " line has been traced back to "
3238 call texname(inode(thisguy), 0) "."
3239
3240 while(indi,pop(anclist)) {
3241 print("Excursion: ") print(name(indi)) print("\n")
3242 call longvitals(indi,1,2)
3243 families(indi, fam, spouse, nfam) {
3244 "\n\n"
3245 if(eq(0, nchildren(fam))) {
3246 call texname(inode(indi), 0) "\\ and "
3247 if(spouse) {
3248 call texname(inode(spouse), 0)
3249 } else {
3250 "\\noname"
3251 }
3252 call havehadchildren(indi, spouse)
3253 } elsif(and(spouse, lookup(stab, key(spouse)))) {
3254 "Children of " call texname(inode(indi), 0) "\\ and "
3255 call texname(inode(spouse), 0) "\\ are shown under "
3256 call texname(inode(spouse), 0)
3257 "(" d(lookup(stab, key(spouse))) ").\n\n"
3258 } else {
3259 "Children of " call texname(inode(indi), 0) "\\ and "
3260 if(spouse) {
3261 call texname(inode(spouse), 0)
3262 } else {
3263 "\\noname"
3264 }
3265 ":\n\\begin{childrenlist}\n"
3266 children(fam, child, nchl) {
3267 "\n\\item "
3268 set(personIsAnc,0)
3269 forindiset(ancset,them,val,num) {
3270 if(eq(them, child)) {
3271 set(personIsAnc,1)
3272 }
3273 }
3274 if(personIsAnc) {
3275 "**" call shortvitals(child)
3276 } else {
3277 call longvitals(child, 0,2)
3278 }
3279 addtoset(idex, child, 0)
3280 }
3281 "\\end{childrenlist}\n"
3282 }
3283 }
3284 }
3285 "\n\n\n"
3286 }
3287
3288 /*
3289 ** function: strxlat
3290 **
3291 ** This idea was copied and/or adapted from Jim Eggert's modification
3292 ** to the ps-circ(le) program for LifeLines.
3293 ** A typical call would look like:
3294 ** set(str, strxlat(tex_xlat, name(person)))
3295 ** which would translate characters in person's name according to the
3296 ** table called tex_xlat -- which escapes the special characters being
3297 ** displayed as text via LaTeX. The output is assigned to str.
3298 ** The output of strxlat() can also be sent directly to output.
3299 **
3300 */
3301
3302 func strxlat(xlat, string) {
3303 if(opt_xlat) {
3304 set(fixstring, "")
3305 set(pos, 1)
3306 while(le(pos, strlen(string))) {
3307 set(char, substring(string, pos, pos))
3308 if(special, lookup(xlat, char)) {
3309 set(fixstring, concat(fixstring, special))
3310 } else {
3311 set(fixstring, concat(fixstring, char))
3312 }
3313 incr(pos)
3314 }
3315 } else {
3316 set(fixstring, string)
3317 }
3318 return(save(fixstring)) /* save() is used for compatibilty with older LL */
3319 }
3320