Amending Book Script

9 views
Skip to first unread message

teddiec

unread,
Nov 23, 2011, 3:51:19 PM11/23/11
to GEDitCOM II Discussions
Hi Folks

Thought I'd seek a little help from you LaTex experts out there.

In the bibliography created by the Book script, with particular
reference to a book source, when there is no author it places (no
author).

While with other parts of the reference I can use standard
abbreviations when there is no information I would like, in this case,
to have the source begin with the Title.

I can delete the words from the script and leave it blank but it still
places a ". " in its place.

How can I alter the script so that when there is no author it begins
with the Title.

Regards

Eddie

John Nairn

unread,
Nov 23, 2011, 4:49:50 PM11/23/11
to geditcom-ii...@googlegroups.com
The formatting of sources is handled by BibTeX, which is an extension of LaTeX for managing sources. All the script does is provide source fields to a standard BibTeX file (look at the book.bib file in an output files created by the text). These are then passed through BibTeX to create the bibliography. I have used LaTeX for 20 years, but BibTeX a lot less. I know you can get exactly what you want, but I have not learned how to do it. Here are things you can try:

1. The book.bib file is created in the script near the end in the section beginning with a comment line "# create bibliography". You could edit this section to control what goes in the book.bib file. Currently it looks at each source's "Type" (which is good to select for each source) and then fills in relevant (and in most cases required) fields for that type of source. Here is sample book.bib file with one book and one miscellaneous source:

%% This BibTeX bibliography file was created using GEDitCOM II.
%% http://www.geditcom.com

%% Created for John A. Nairn on 23 Nov 2011

%% Saved with string encoding Unicode (UTF-8)

@book{BSR1,
Author = {{Antonia Fraser}},
Title = {{The Lives of the Kings \&\ Queens of England}},
Publisher = {{Weidenfeld and Nicoloson, London}},
Year = {1975}}

@misc{BSR2,
Author = {{Henry Churchyard}},
Title = {{Royal Genealogies}},
Publisher = {{(no publisher)}},
Howpublished = {http://ftp.cac.psu.edu/\verb+~+saw/royal/royalgen.html},
Year = {1999}}

2. The current script outputs an "Author" field even if the field is empty (which is why the script works best if all source fields have content). It does that because BibTeX issues a warning if any required fields are missing. You got the "." with an empty author because that is part of the BibTeX formatting process for sources. That result, however, will be different depending on the "Type" of source. For example, I tried deleting the author from a "book" source and it starts with the title and no period.

3. One option is to check if auth=="" (in the script) and if it is, change the script to write a new style BibTeX record. It looks like "book" might do what you want or you could try some of the others (e.g., "misc") to see what they do without an author; article might even work if author is missing rather than just empty. You can probably ignore warnings you will get about missing, required fields. The section of the script might be altered to start with

if type == "article" :
bib.append("@book{B"+sour.key[1:-1]+",")
if auth != "" : bib.append(" Author = {{"+auth+"}},")
bib.append(" Title = {{"+titl+"}},")
if not(publ) : publ = "(no journal)"
bib.append(" Journal = {{"+publ+"}},")
bib.append(" Year = {"+year+"}}\n")

Now if author is missing, the author field is not used. This might remove the ".", but I did not try it (it does remove it for books, which I tried)

4. A more advanced option is to customize the BibTeX templates for display of sources. The templates could look for empty author and do something different. The current style is selected in the BookLaTeXDefs.tex file using the command

\bibliographystyle{unsrt}

which is a standard, unsorted style available in all LaTeX installations. You can change a different style of even create your own custom BibTeX style sheets and completely change that way sources are included. I have looked at BibTeX style sheets, but never tried to create my own. They look complicated. I have always tried to find the style closest to what I need. Here is list of styles you can try, but they do not give examples of who each one looks without an author. Many of the difference are in how the references are cited and not in how they appear in the bibliography.

http://www.cs.stir.ac.uk/~kjt/software/latex/showbst.html

Here is an experiment you could do:

a. Create new GEDitCOM II file
b. Create one individual
c. Create on source of each type and fill in all fields but leave the author field of each one blank. Put the "Type" name of source in its title (so it shows up in the book)
d. Link all sources to the individual
e. Create a book from the individual
f. Now edit the BookLaTeXDefs.tex file and change the biblography style to any other one listed above.
g. For each change, typeset the book (using TeXShop), run BibTeX (a separate menu command), and then typeset two more times (all steps are needed to switch to a new style)
h. Look at each style and make a note of those you like and how they deal with empty author.

Note that version 1.7, which is getting closer everyday, has much better help for making books. The script is improved and you can create "Book Style" records in your files to store all settings for a book. With several such records, you can create and maintain several books, each with a single click.

John Nairn

John Nairn, Developer

unread,
Nov 23, 2011, 5:03:07 PM11/23/11
to GEDitCOM II Discussions
I noticed a detail in the script. To remove "Author" field for any
BibTeX type, the correct line should be

if auth != "(no author)" : bib.append(" Author = {{"+auth+"}},")

rather then check for empty string (because script had earlier checked
for empty string).

Reply all
Reply to author
Forward
0 new messages