| 1 |
/* |
| 2 |
* @progname register-tex.ll |
| 3 |
* @version 2.1 of 2004-06-18 |
| 4 |
* @author Wetmore, David Olsen ([email protected]), Simms |
| 5 |
* @category |
| 6 |
* @output LaTeX |
| 7 |
* @description |
| 8 |
* |
| 9 |
* This report prints, in book format, information about all descendants of a |
| 10 |
* person and all of their spouses. It tries to understand as many different |
| 11 |
* GEDCOM tags as possible. All source iformation (SOUR lines) is in the |
| 12 |
* footnotes. |
| 13 |
* The output is in LaTeX format. |
| 14 |
* |
| 15 |
** |
| 16 |
** Version 2.1 18 Jun 2004 (Robert Simms) |
| 17 |
** Version 2 24 Feb 1993 |
| 18 |
** Version 1 Nov 1992 |
| 19 |
** |
| 20 |
** Requires LifeLines version 2.3.3 or later |
| 21 |
** |
| 22 |
** |
| 23 |
** Robert Simms ([email protected]) |
| 24 |
** Render characters meaningful to the LaTeX system as if they were ordinary characters. |
| 25 |
** |
| 26 |
** David Olsen ([email protected]) |
| 27 |
** based on work originally done by Tom Wetmore ([email protected]). |
| 28 |
** |
| 29 |
** This report prints, in book format, information about all descendants of a |
| 30 |
** person and all of their spouses. It tries to understand as many different |
| 31 |
** GEDCOM tags as possible. All source iformation (SOUR lines) is in the |
| 32 |
** footnotes. |
| 33 |
** |
| 34 |
** The output is in LaTeX format. Therefore, the name of the output file |
| 35 |
** should end in ".tex". To print (assuming the name of the output file is |
| 36 |
** "out.tex"): |
| 37 |
** latex out < ignore lots of warnings about underfull \hboxes > |
| 38 |
** dvips out |
| 39 |
** lpr out.ps |
| 40 |
** |
| 41 |
** Indexing commands are placed within the LaTeX output. To include an index |
| 42 |
** in the document do the following: |
| 43 |
** latex out |
| 44 |
** makeindex out < not all systems have makeindex available> |
| 45 |
** < edit out.tex, uncomment (remove leading '%') from |
| 46 |
** the line \input{out.ind} just before \end{document} > |
| 47 |
** latex out |
| 48 |
** dvips out |
| 49 |
** lpr out.ps |
| 50 |
** < the last three commands here may be replaced by > |
| 51 |
** pdflatex out -- if you have 'pdflatex' and a PDF is |
| 52 |
** the desired final product > |
| 53 |
** |
| 54 |
** I admit that this is lot of post-processing, but the results are worth it. |
| 55 |
** |
| 56 |
** NOTE ON PAPER SIZES: |
| 57 |
** Paper sizes (A4 or letter) can be specified within the LaTeX output, |
| 58 |
** but this requires editing by folks who don't like the default. |
| 59 |
** |
| 60 |
** Since dvips (a neccessary processing step) can take a paper-size |
| 61 |
** argument on the command line, it's much simpler to let the user |
| 62 |
** specify the desired page size when running dvips (outlined above) |
| 63 |
** instead of editing the report/LaTeX output. |
| 64 |
** |
| 65 |
** Example: |
| 66 |
** dvips -t letter out [ for US Letter-sized paper, 8.5x11" ] |
| 67 |
** dvips -t a4 out [ for ISO/European A4-sized paper, 8.3x11.7" ] |
| 68 |
** |
| 69 |
*/ |
| 70 |
|
| 71 |
global(opt_xlat) |
| 72 |
global(tex_xlat) |
| 73 |
|
| 74 |
proc main () |
| 75 |
{ |
| 76 |
getindi(indi) /* Get the individual to start with */ |
| 77 |
|
| 78 |
/* Print preamble. Feel free to change this to suit your tastes. */ |
| 79 |
"\\documentstyle[twocolumn]{article}\n" |
| 80 |
"\\usepackage{isolatin1}\n\n" |
| 81 |
"\\pagestyle{myheadings}\n\n" |
| 82 |
"% Shrink the margins to use more of the page.\n" |
| 83 |
"% This is taken from fullpage.sty, which is on some systems.\n" |
| 84 |
"\\topmargin 0pt\n" |
| 85 |
"\\advance \\topmargin by -\\headheight\n" |
| 86 |
"\\advance \\topmargin by -\\headsep\n" |
| 87 |
"\\textheight 8.9in\n" |
| 88 |
"\\oddsidemargin 0pt\n" |
| 89 |
"\\evensidemargin \\oddsidemargin\n" |
| 90 |
"\\textwidth 6.5in\n\n" |
| 91 |
"\\newcounter{childnumber}\n\n" |
| 92 |
"% The \\noname command is needed because TeX doesnt like underscores.\n" |
| 93 |
"\\newcommand{\\noname}{\\underline{\\ \\ \\ \\ \\ }}\n\n" |
| 94 |
"% Environment for printing the list of children.\n" |
| 95 |
"\\newenvironment{childrenlist}" |
| 96 |
"{\\begin{small}\\begin{list}{\\sc\\roman{childnumber}.}" |
| 97 |
"{\\usecounter{childnumber}\\setlength{\\leftmargin}{0.5in}" |
| 98 |
"\\setlength{\\labelsep}{0.07in}\\setlength{\\labelwidth}{0.43in}}}" |
| 99 |
"{\\end{list}\\end{small}}\n\n" |
| 100 |
"% The following commands are used to create the index.\n" |
| 101 |
"\\newcommand{\\bold}[1]{{\\bf #1}}\n" |
| 102 |
"\\newcommand{\\bfit}[1]{{\\bf\\it #1}}\n" |
| 103 |
"\\newcommand{\\see}[2]{{\\it see #1}}\n\n" |
| 104 |
"% Command to use at the beginning of each new generation.\n" |
| 105 |
"\\newcommand{\\generation}[1]" |
| 106 |
"{\\newpage\\begin{center}{\\huge\\bf Generation #1}\\end{center}" |
| 107 |
"\\vspace{3ex}\\setcounter{footnote}{0}" |
| 108 |
"\\markright{Descendants of " strxlat(tex_xlat, fullname(indi,0,1,40)) |
| 109 |
"\\hfill Generation #1\\hfill\\ }}\n\n" |
| 110 |
"\\makeindex\n\n" |
| 111 |
"\\begin{document}\n\n" |
| 112 |
"\\title{Descendants of " strxlat(tex_xlat, fullname(indi, 0, 1, 40)) "}\n" |
| 113 |
|
| 114 |
getstrmsg(author, "Enter the author(s) of this document:") |
| 115 |
"\\author{" strxlat(tex_xlat, author) "}\n" |
| 116 |
"\\date{\\today}\n" |
| 117 |
"\\maketitle\n" |
| 118 |
|
| 119 |
getstrmsg(intro, "File that contains introduction (if any):") |
| 120 |
if (ne(strcmp(intro, ""), 0)) { |
| 121 |
"\\input{" intro "}\n" |
| 122 |
} |
| 123 |
|
| 124 |
|
| 125 |
list(ilist) /* List of individuals */ |
| 126 |
list(glist) /* List of generation for each individual */ |
| 127 |
table(stab) /* Table of numbers for each individual */ |
| 128 |
indiset(idex) |
| 129 |
|
| 130 |
/* LaTeX interprets $, &, %, #, _, {, }, ~, ^, and \ as special characters. |
| 131 |
A table is loaded here with the alternatives to make those special |
| 132 |
characters appear in the final product. Any text from the database |
| 133 |
sent to the LaTeX file to appear as text should be passed through |
| 134 |
the function strxlat(). |
| 135 |
*/ |
| 136 |
set(opt_xlat, 1) |
| 137 |
table(tex_xlat) |
| 138 |
insert(tex_xlat, "$", "\\$") |
| 139 |
insert(tex_xlat, "&", "\\&") |
| 140 |
insert(tex_xlat, "%", "\\%") |
| 141 |
insert(tex_xlat, "#", "\\#") |
| 142 |
insert(tex_xlat, "_", "\\_") |
| 143 |
insert(tex_xlat, "{", "\\{") |
| 144 |
insert(tex_xlat, "}", "\\}") |
| 145 |
insert(tex_xlat, "~", "\\verb|~|") |
| 146 |
insert(tex_xlat, "^", "\\verb|^|") |
| 147 |
insert(tex_xlat, "\\", "\\verb|\\|") |
| 148 |
|
| 149 |
|
| 150 |
enqueue(ilist, indi) |
| 151 |
enqueue(glist, 1) |
| 152 |
set(curgen, 0) |
| 153 |
set(out, 1) |
| 154 |
set(in, 2) |
| 155 |
|
| 156 |
while (indi, dequeue(ilist)) { |
| 157 |
|
| 158 |
set(thisgen, dequeue(glist)) |
| 159 |
if (ne(curgen, thisgen)) { |
| 160 |
print("Generation ") print(d(thisgen)) print("\n") |
| 161 |
"\n\n\\generation{" d(thisgen) "}\n" |
| 162 |
set(curgen, thisgen) |
| 163 |
} |
| 164 |
|
| 165 |
print(d(out)) print(" ") print(name(indi)) print("\n") |
| 166 |
|
| 167 |
"\n\\vspace{3ex}\\ \\\\\\begin{center}{\\large\\bf " d(out) ".\\ " |
| 168 |
name(indi) "}\\end{center}\n" |
| 169 |
|
| 170 |
insert(stab, save(key(indi)), out) |
| 171 |
|
| 172 |
call longvitals(indi, 1, 2) |
| 173 |
|
| 174 |
addtoset(idex, indi, 0) |
| 175 |
set(out, add(out, 1)) |
| 176 |
|
| 177 |
families(indi, fam, spouse, nfam) { |
| 178 |
"\n\n" |
| 179 |
if (eq(0, nchildren(fam))) { |
| 180 |
call texname(inode(indi), 0) "\\ and " |
| 181 |
if (spouse) { |
| 182 |
call texname(inode(spouse), 0) |
| 183 |
} else { |
| 184 |
"\\noname" |
| 185 |
} |
| 186 |
"\\ had no children.\n" |
| 187 |
} elsif (and(spouse, lookup(stab, key(spouse)))) { |
| 188 |
"Children of " call texname(inode(indi), 0) "\\ and " |
| 189 |
call texname(inode(spouse), 0) "\\ are shown under " |
| 190 |
call texname(inode(spouse), 0) |
| 191 |
"\\ (" d(lookup(stab, key(spouse))) ").\n" |
| 192 |
} else { |
| 193 |
"Children of " call texname(inode(indi), 0) "\\ and " |
| 194 |
if (spouse) { |
| 195 |
call texname(inode(spouse), 0) |
| 196 |
} else { |
| 197 |
"\\noname" |
| 198 |
} |
| 199 |
":\n\\begin{childrenlist}\n" |
| 200 |
children(fam, child, nchl) { |
| 201 |
set(haschild, 0) |
| 202 |
families(child, cfam, cspou, ncf) { |
| 203 |
if (ne(0, nchildren(cfam))) { set(haschild, 1) } |
| 204 |
} |
| 205 |
if (haschild) { |
| 206 |
enqueue(ilist, child) |
| 207 |
enqueue(glist, add(1, curgen)) |
| 208 |
"\n\\item[{\\bf " d(in) "}\\ \\hfill" |
| 209 |
"\\addtocounter{childnumber}{1}" |
| 210 |
"{\\sc\\roman{childnumber}}.]" |
| 211 |
set (in, add (in, 1)) |
| 212 |
call shortvitals(child) |
| 213 |
} else { |
| 214 |
"\n\\item " |
| 215 |
call longvitals(child, 0, 1) |
| 216 |
addtoset(idex, child, 0) |
| 217 |
} |
| 218 |
} |
| 219 |
"\\end{childrenlist}\n" |
| 220 |
} |
| 221 |
} |
| 222 |
} |
| 223 |
|
| 224 |
set(basename, |
| 225 |
save(substring(outfile(), 1, sub(index(outfile(), ".tex", 1), 1)))) |
| 226 |
|
| 227 |
"\n% remove percent-sign at the beginning of the line\n" |
| 228 |
"% with the input command if you create the index file\n" |
| 229 |
"% using 'makeindex'\n" |
| 230 |
"% \\input{" basename ".ind}" |
| 231 |
"\n\n\\end{document}\n" |
| 232 |
} |
| 233 |
|
| 234 |
|
| 235 |
/* shortvitals(indi): Displays the short form of the vital statistics (birth |
| 236 |
and death only) of an individual. */ |
| 237 |
|
| 238 |
proc shortvitals(indi) |
| 239 |
{ |
| 240 |
call texname(inode(indi), 1) |
| 241 |
set(b, birth(indi)) |
| 242 |
set(d, death(indi)) |
| 243 |
if (and(b, long(b))) { ", b.\\ " strxlat(tex_xlat, long(b)) } |
| 244 |
if (and(d, long(d))) { ", d.\\ " strxlat(tex_xlat, long(d)) } |
| 245 |
"\n" |
| 246 |
} |
| 247 |
|
| 248 |
|
| 249 |
/* longvitals(i, name_parents, name_type) |
| 250 |
Prints out the complete vital statistics of the individual (i). If |
| 251 |
name_parents is not 0, then the names of the parents of the individual will |
| 252 |
be printed. The parameter name_type is passed to texname. The GEDCOM tags |
| 253 |
are divided into ones that would likely occur before getting married and |
| 254 |
ones that would likely occur after getting married. Within the two sets |
| 255 |
they are printed in the order in which they appear in the database. I |
| 256 |
haven't yet figured out a convenient way of indicating the sex. */ |
| 257 |
|
| 258 |
proc longvitals(i, name_parents, name_type) |
| 259 |
{ |
| 260 |
call texname(inode(i), name_type) "." call print_sources(inode(i)) "\n" |
| 261 |
|
| 262 |
set(dad, father(i)) |
| 263 |
set(mom, mother(i)) |
| 264 |
if (and(name_parents, or(dad, mom))) { |
| 265 |
if ( male(i)) { "Son of " } |
| 266 |
elsif (female(i)) { "Daughter of " } |
| 267 |
else { "Child of " } |
| 268 |
if (dad) { call texname(inode(dad), 0) } |
| 269 |
if (and(dad, mom)) { "\nand " } |
| 270 |
if (mom) { call texname(inode(mom), 0) } |
| 271 |
".\n" |
| 272 |
} |
| 273 |
|
| 274 |
set(name_found, 0) |
| 275 |
fornodes (inode(i), n) { |
| 276 |
if (eq(strcmp(tag(n), "ADOP"), 0)) { |
| 277 |
call process_event(n, "Adopted") |
| 278 |
} |
| 279 |
if (eq(strcmp(tag(n), "BAPL"), 0)) { |
| 280 |
call process_event(n, "Baptized") |
| 281 |
} |
| 282 |
if (eq(strcmp(tag(n), "BAPM"), 0)) { |
| 283 |
call process_event(n, "Baptized") |
| 284 |
} |
| 285 |
if (eq(strcmp(tag(n), "BARM"), 0)) { |
| 286 |
call process_event(n, "Bar mitzvah") |
| 287 |
} |
| 288 |
if (eq(strcmp(tag(n), "BASM"), 0)) { |
| 289 |
call process_event(n, "Bat mitzvah") |
| 290 |
} |
| 291 |
if (eq(strcmp(tag(n), "BIRT"), 0)) { |
| 292 |
call process_event(n, "Born") |
| 293 |
} |
| 294 |
if (eq(strcmp(tag(n), "BLES"), 0)) { |
| 295 |
call process_event(n, "Blessed") |
| 296 |
} |
| 297 |
if (eq(strcmp(tag(n), "CAST"), 0)) { |
| 298 |
"Caste: " call valuec(n) "." |
| 299 |
call print_sources(n) "\n" |
| 300 |
} |
| 301 |
if (eq(strcmp(tag(n), "CHR"), 0)) { |
| 302 |
call process_event(n, "Christened") |
| 303 |
} |
| 304 |
if (eq(strcmp(tag(n), "CONF"), 0)) { |
| 305 |
call process_event(n, "Confirmed") |
| 306 |
} |
| 307 |
if (eq(strcmp(tag(n), "CONL"), 0)) { |
| 308 |
call process_event(n, "Confirmed") |
| 309 |
} |
| 310 |
if (eq(strcmp(tag(n), "GRAD"), 0)) { |
| 311 |
call process_event(n, "Graduated") |
| 312 |
} |
| 313 |
if (eq(strcmp(tag(n), "NAME"), 0)) { |
| 314 |
if (eq(name_found, 0)) { |
| 315 |
set(name_found, 1) |
| 316 |
} else { |
| 317 |
"Also known as " call texname(n, 3) "." |
| 318 |
call print_sources(n) "\n" |
| 319 |
} |
| 320 |
} |
| 321 |
if (eq(strcmp(tag(n), "NAMR"), 0)) { |
| 322 |
"Religious name: " call valuec(n) "." |
| 323 |
call print_sources(n) "\n" |
| 324 |
} |
| 325 |
if (eq(strcmp(tag(n), "NATI"), 0)) { |
| 326 |
"Nationality: " call valuec(n) "." |
| 327 |
call print_sources(n) "\n" |
| 328 |
} |
| 329 |
if (eq(strcmp(tag(n), "ORDN"), 0)) { |
| 330 |
call process_event(n, "Ordained") |
| 331 |
} |
| 332 |
if (eq(strcmp(tag(n), "RELI"), 0)) { |
| 333 |
"Religious affiliation: " call valuec(n) "." |
| 334 |
call print_sources(n) "\n" |
| 335 |
} |
| 336 |
if (eq(strcmp(tag(n), "TITL"), 0)) { |
| 337 |
"Title: " value(n) "." |
| 338 |
call print_sources(n) "\n" |
| 339 |
} |
| 340 |
} |
| 341 |
if (eq(1, nfamilies(i))) { |
| 342 |
families(i, f, s, n) { |
| 343 |
"Married" call print_sources(fnode(f)) |
| 344 |
call spousevitals(s, f) |
| 345 |
} |
| 346 |
} else { |
| 347 |
families(i, f, s, n) { |
| 348 |
"Married " ord(n) "," call print_sources(fnode(f)) |
| 349 |
call spousevitals(s, f) |
| 350 |
} |
| 351 |
} |
| 352 |
fornodes (inode(i), n) { |
| 353 |
if (eq(strcmp(tag(n), "BURI"), 0)) { |
| 354 |
call process_event(n, "Buried") |
| 355 |
} |
| 356 |
if (eq(strcmp(tag(n), "CENS"), 0)) { |
| 357 |
call process_event(n, "Listed in census") |
| 358 |
} |
| 359 |
if (eq(strcmp(tag(n), "CHRA"), 0)) { |
| 360 |
call process_event(n, "Christened (as an adult)") |
| 361 |
} |
| 362 |
if (eq(strcmp(tag(n), "DEAT"), 0)) { |
| 363 |
call process_event(n, "Died") |
| 364 |
} |
| 365 |
/* One part of the GEDCOM standard says the tag should be DSCR, |
| 366 |
another part says DESR. */ |
| 367 |
if (eq(strcmp(tag(n), "DESR"), 0)) { |
| 368 |
"Description: " call valuec(n) |
| 369 |
call print_sources(n) "\n" |
| 370 |
} |
| 371 |
if (eq(strcmp(tag(n), "EVEN"), 0)) { |
| 372 |
call process_event(n, value(n)) |
| 373 |
} |
| 374 |
if (eq(strcmp(tag(n), "NATU"), 0)) { |
| 375 |
call process_event(n, "Naturalized") |
| 376 |
} |
| 377 |
if (eq(strcmp(tag(n), "OCCU"), 0)) { |
| 378 |
"Occupation: " call valuec(n) "." |
| 379 |
call print_sources(n) "\n" |
| 380 |
} |
| 381 |
if (eq(strcmp(tag(n), "PROB"), 0)) { |
| 382 |
call process_event(n, "Will probated") |
| 383 |
} |
| 384 |
if (eq(strcmp(tag(n), "PROP"), 0)) { |
| 385 |
"Possessions: " call valuec(n) "." |
| 386 |
call print_sources(n) "\n" |
| 387 |
} |
| 388 |
if (eq(strcmp(tag(n), "RETI"), 0)) { |
| 389 |
call process_event(n, "Retired") |
| 390 |
} |
| 391 |
if (eq(strcmp(tag(n), "WILL"), 0)) { |
| 392 |
call process_event(n, "Will dated") |
| 393 |
} |
| 394 |
} |
| 395 |
call print_notes(inode(i), "\n\n") |
| 396 |
} |
| 397 |
|
| 398 |
|
| 399 |
/* spousevitals (spouse, fam) |
| 400 |
Prints out information about a marriage (fam) and about a spouse in the |
| 401 |
marriage (spouse). */ |
| 402 |
|
| 403 |
proc spousevitals (spouse, fam) |
| 404 |
{ |
| 405 |
if (e, marriage(fam)) { |
| 406 |
call print_event(e) "," call print_sources(e) " " |
| 407 |
} |
| 408 |
"\n" |
| 409 |
if (spouse) { |
| 410 |
call texname(inode(spouse), 3) |
| 411 |
call print_sources(inode(spouse)) |
| 412 |
set(bir, birth(spouse)) |
| 413 |
set(chr, baptism(spouse)) |
| 414 |
set(dea, death(spouse)) |
| 415 |
set(bur, burial(spouse)) |
| 416 |
set(dad, father(spouse)) |
| 417 |
set(mom, mother(spouse)) |
| 418 |
if (or(bir, chr, dea, bur, mom, dad)) { |
| 419 |
"\n(" |
| 420 |
if (bir) { |
| 421 |
"born" call print_event(bir) |
| 422 |
if (or(dea, bur, mom, dad)) { "," } |
| 423 |
call print_sources(bir) |
| 424 |
if (or(dea, bur, mom, dad)) { "\n" } |
| 425 |
} |
| 426 |
if (and(chr, not(bir))) { |
| 427 |
"christened" call print_event(chr) |
| 428 |
if (or(dea, bur, mom, dad)) { "," } |
| 429 |
call print_sources(chr) |
| 430 |
if (or(dea, bur, mom, dad)) { "\n" } |
| 431 |
} |
| 432 |
if (dea) { |
| 433 |
"died" call print_event(dea) |
| 434 |
if (or(mom, dad)) { "," } |
| 435 |
call print_sources(dea) |
| 436 |
if (or(mom, dad)) { "\n" } |
| 437 |
} |
| 438 |
if (and(bur, not(dea))) { |
| 439 |
"buried" call print_event(bur) |
| 440 |
if (or(mom, dad)) { "," } |
| 441 |
call print_sources(bur) |
| 442 |
if (or(mom, dad)) { "\n" } |
| 443 |
} |
| 444 |
if (or(mom, dad)) { |
| 445 |
if ( male(spouse)) { "son of " } |
| 446 |
elsif (female(spouse)) { "daughter of " } |
| 447 |
else { "child of " } |
| 448 |
if (dad) { call texname(inode(dad), 3) } |
| 449 |
if (and(mom, dad)) { " and " } |
| 450 |
if (mom) { call texname(inode(mom), 3) } |
| 451 |
} |
| 452 |
")" |
| 453 |
} |
| 454 |
} else { |
| 455 |
"\\noname" |
| 456 |
} |
| 457 |
".\n" |
| 458 |
} |
| 459 |
|
| 460 |
|
| 461 |
/* texname (i, type) |
| 462 |
Prints an individual's name in LaTeX format, with the surname in small caps. |
| 463 |
For example, "David Kenneth /Olsen/ Jr." would be printed as |
| 464 |
"David Kenneth {\sc Olsen} Jr.". The type argument determines how the name |
| 465 |
will appear in the index. |
| 466 |
type = 0: no index |
| 467 |
type = 1: page number appears in bold |
| 468 |
type = 2: page number appears in bold-italics |
| 469 |
type = 3: page number appears in normal text |
| 470 |
The parameter i can be either an INDI node (NOT an individial) or a |
| 471 |
NAME node. */ |
| 472 |
|
| 473 |
proc texname (i, type) |
| 474 |
{ |
| 475 |
list(name_list) |
| 476 |
|
| 477 |
set(sname, "") |
| 478 |
extractnames(i, name_list, num_names, surname_no) |
| 479 |
forlist (name_list, nm, num) { |
| 480 |
if (eq(num, surname_no)) { |
| 481 |
if (eq(strcmp(nm, ""), 0)) { |
| 482 |
" \\noname" |
| 483 |
set(sname, "\\noname") |
| 484 |
} else { |
| 485 |
" {\\sc " strxlat(tex_xlat, save(nm)) "}" |
| 486 |
set(sname, nm) |
| 487 |
} |
| 488 |
} else { |
| 489 |
" " strxlat(tex_xlat, nm) |
| 490 |
} |
| 491 |
} |
| 492 |
if (gt(type, 0)) { |
| 493 |
"\\index{" strxlat(tex_xlat, sname) |
| 494 |
if (gt(num_names, 1)) { "," } |
| 495 |
forlist (name_list, nm, num) { |
| 496 |
if (ne(num, surname_no)) { |
| 497 |
" " strxlat(tex_xlat, nm) |
| 498 |
} |
| 499 |
} |
| 500 |
if (eq(type, 1)) { "|bold"} |
| 501 |
elsif (eq(type, 2)) { "|bfit"} |
| 502 |
"}" |
| 503 |
} |
| 504 |
} |
| 505 |
|
| 506 |
|
| 507 |
/* process_event (event_node, event_name) |
| 508 |
Prints information about a particular event (event_node, which is a GEDCOM |
| 509 |
node). event_name is verb form of the text describing the event (such as |
| 510 |
"Born", "Died", etc.). */ |
| 511 |
|
| 512 |
proc process_event (event_node, event_name) |
| 513 |
{ |
| 514 |
event_name |
| 515 |
call print_event(event_node) "." |
| 516 |
call print_sources(event_node) |
| 517 |
call print_notes(event_node, " ") "\n" |
| 518 |
} |
| 519 |
|
| 520 |
|
| 521 |
/* print_event (event_node): Prints the date and place of an event. */ |
| 522 |
|
| 523 |
proc print_event (event_node) |
| 524 |
{ |
| 525 |
if (date(event_node)) { " " strxlat(tex_xlat, date(event_node)) } |
| 526 |
if (place(event_node)) { " at " strxlat(tex_xlat, place(event_node)) } |
| 527 |
} |
| 528 |
|
| 529 |
|
| 530 |
/* print_notes (root, sep): Prints all the notes (NOTE nodes) associated with |
| 531 |
the GEDCOM line root, separated by the given separator. */ |
| 532 |
|
| 533 |
proc print_notes (root, sep) |
| 534 |
{ |
| 535 |
fornotes (root, note) { |
| 536 |
sep strxlat(tex_xlat, note) " " |
| 537 |
} |
| 538 |
} |
| 539 |
|
| 540 |
|
| 541 |
/* print_sources (root) |
| 542 |
Prints all sources (SOUR lines) associated with the given GEDCOM line. The |
| 543 |
sources are formated as LaTeX footnotes. This routine prints each SOUR line |
| 544 |
as a separate footnote, which is not correct. This should be corrected so |
| 545 |
that all sources are combined into a single footnote. */ |
| 546 |
|
| 547 |
proc print_sources (root) |
| 548 |
{ |
| 549 |
fornodes (root, n) { |
| 550 |
if (eq(strcmp(tag(n), "SOUR"), 0)) { |
| 551 |
"\\footnote{" call valuec(n) "}" |
| 552 |
} |
| 553 |
} |
| 554 |
} |
| 555 |
|
| 556 |
|
| 557 |
/* valuec(n): Prints the value of a GEDCOM node and the values of any CONT |
| 558 |
lines associated with it. */ |
| 559 |
|
| 560 |
proc valuec(n) |
| 561 |
{ |
| 562 |
value(n) |
| 563 |
fornodes (n, n1) { |
| 564 |
if (eq(strcmp(tag(n1), "CONT"), 0)) { |
| 565 |
"\n" strxlat(tex_xlat, value(n1)) |
| 566 |
} |
| 567 |
} |
| 568 |
} |
| 569 |
|
| 570 |
|
| 571 |
/* |
| 572 |
** function: strxlat |
| 573 |
** |
| 574 |
** This idea was copied and/or adapted from Jim Eggert's modification |
| 575 |
** to the ps-circ(le) program for LifeLines. |
| 576 |
** A typical call would look like: |
| 577 |
** set(str, strxlat(tex_xlat, name(person))) |
| 578 |
** which would translate characters in person's name according to the |
| 579 |
** table called tex_xlat -- which escapes the special characters being |
| 580 |
** displayed as text via LaTeX. The output is assigned to str. |
| 581 |
** The output of strxlat() can also be sent directly to output. |
| 582 |
** |
| 583 |
*/ |
| 584 |
|
| 585 |
func strxlat(xlat, string) |
| 586 |
{ |
| 587 |
if(opt_xlat) { |
| 588 |
set(fixstring, "") |
| 589 |
set(pos, 1) |
| 590 |
while(le(pos, strlen(string))) { |
| 591 |
set(char, substring(string, pos, pos)) |
| 592 |
if(special, lookup(xlat, char)) { |
| 593 |
set(fixstring, concat(fixstring, special)) |
| 594 |
} else { |
| 595 |
set(fixstring, concat(fixstring, char)) |
| 596 |
} |
| 597 |
incr(pos) |
| 598 |
} |
| 599 |
} else { |
| 600 |
set(fixstring, string) |
| 601 |
} |
| 602 |
return(save(fixstring)) /* save() is for compatibilty with older LL */ |
| 603 |
} |