1 <html xmlns="http://www.w3.org/1999/xhtml">
8 <h1>Customizing the BibTeX key generator</h1>
10 <p>In the 'Key pattern' tab in Preferences, one can set the fields
11 used in auto generation of BibTex labels. The pattern can be
12 set for each of the standard entry types.</p>
16 <p>The pattern can contain any text you wish,
17 in addition to field markers that indicate that a specific
18 field of the entry should be inserted at that position of the
19 key. A field marker generally consists of the field name
20 enclosed in square braces, e.g. <b>[volume]</b>. If the field
21 is undefined in an entry at the time of key generation, no text
22 will be inserted by the field marker.</p>
24 <p>Several special field markers are offered, which extract
25 only a specific part of a field. These are listed below. Feel
26 free to suggest new special field markers.</p>
28 <p>Special field markers:</p>
31 <li><b>[<code>auth</code>]</b>: The last name of the first
34 <li><b>[<code>authors</code>]</b>: The last name of all
37 <li><b>[<code>authorsN</code>]</b>: The last name of up to
38 N authors. If there are more authors, "EtAl" is
41 <li><b>[<code>authIniN</code>]</b>: The beginning of each
42 author's last name, using no more than N
43 characters.<br /></li>
45 <li><b>[<code>authorIni</code>]</b>: The first 5 characters
46 of the first author's last name, and the last name initials
47 of the remaining authors.<br /></li>
49 <li><b>[<code>authN</code>]</b>: The first N characters of
50 the first author's last name<br /></li>
52 <li><b>[<code>authN_M</code>]</b>: The first N characters
53 of the Mth author's last name<br /></li>
55 <li><b>[<code>auth.auth.ea</code>]</b>: The last name of
56 the first two authors, and ".ea" if there are more than
59 <li><b>[<code>auth.etal</code>]</b>: The last name of the
60 first author, and the last name of the second author if
61 there are two authors or ".etal" if there are more than
64 <li><b>[<code>authshort</code>]</b>: The last name if one
65 author is given; the first character of up to three
66 authors' last names if more than one author is given. A
67 plus character is added, if there are more than three
69 </ul><b>Note:</b> If there is no author (as in the case of an
70 edited book), then all of the above
71 <b><code>[auth...]</code></b> markers will use the editor(s)
72 (if any) as a fallback. Thus, the editor(s) of a book with no
73 author will be treated as the author(s) for label-generation
74 purposes. If you do not want this behaviour, i.e. you require a
75 marker which expands to nothing if there is no author, use
76 <b><code>pureauth</code></b> instead of
77 <b><code>auth</code></b> in the above codes. For example,
78 <b><code>[pureauth]</code></b>, or
79 <b><code>[pureauthors3]</code></b>.
82 <li><b>[<code>edtr</code>]</b>: The last name of the first
85 <li><b>[<code>edtrIniN</code>]</b>: The beginning of each
86 editor's last name, using no more than N
89 <li><b>[<code>editors</code>]</b>: The last name of all
92 <li><b>[<code>editorIni</code>]</b>: The first 5 characters
93 of the first editor's last name, and the last name initials
94 of the remaining editors.<br /></li>
96 <li><b>[<code>edtrN</code>]</b>: The first N characters of
97 the first editor's last name<br /></li>
99 <li><b>[<code>edtrN_M</code>]</b>: The first N characters
100 of the Mth editor's last name<br /></li>
102 <li><b>[<code>edtr.edtr.ea</code>]</b>: The last name of
103 the first two editors, and ".ea" if there are more than
106 <li><b>[<code>edtrshort</code>]</b>: The last name if one
107 editor is given; the first character of up to three
108 editors' last names if more than one editor is given. A
109 plus character is added, if there are more than three
112 <li><b>[<code>firstpage</code>]</b>: The number of the
113 first page of the publication<br /></li>
115 <li><b>[<code>keywordN</code>]</b>: Keyword number N from
116 the "keywords" field, assuming keywords are separated by
117 commas or semicolons.<br /></li>
119 <li><b>[<code>lastpage</code>]</b>: The number of the last
120 page of the publication<br /></li>
122 <li><b>[<code>shorttitle</code>]</b>: The first 3 words of
125 <li><b>[<code>shortyear</code>]</b>: The last 2 digits of
126 the publication year<br /></li>
128 <li><b>[<code>veryshorttitle</code>]</b>: The first word of
129 the title, discounting 'the', 'a', 'an'.<br /></li>
132 <p>A field name (or one of the above pseudo-field names) may
133 optionally be followed by one or more modifiers. Modifiers are
134 applied in the order they are specified.</p>
137 <li><b>:abbr</b>: Abbreviates the text produced by the
138 field name or spcial field marker. Only the first character
139 and subsequent characters following white space will be
140 included. For example, <b>[journal:abbr]</b> would from the
141 journal name "Journal of Fish Biology" produce
144 <li><b>:lower</b>: Forces the text inserted by the field
145 marker to be in lowercase. For example, <b>[auth:lower]</b>
146 expands the last name of the first author in
147 lowercase.<br /></li>
150 <p>If you haven't defined a key pattern for a certain entry
151 type, the <b>Default key pattern</b> will be used. You can
152 change the default pattern - its setting is above the list of
153 entry types in the <b>Key pattern</b> section of the
154 <b>Preferences</b> dialog.</p>
156 <p>The default key pattern is [auth][year], and this could
157 produce keys like e.g. <code>Yared1998</code> If the key is not
158 unique in the current database, it is made unique by adding one
159 of the letters a-z until a unique key is found. Thus, the
160 labels might look like:</p>
163 <code>Yared1998</code><br />
164 <code>Yared1998a</code><br />
165 <code>Yared1998b</code>
168 <h2>Regular expression replace</h2>
170 <p>After the key pattern has
171 been applied to produce a key, you can choose to have the key
172 generator search for occurences of a specific regular
173 expression, and replace it with a string. The regular
174 expression and replacement string are entered in the text
175 fields below the list of key patterns. If the replacement
176 string is empty, matches of the regular expression will simply
177 be removed from the generated key.</p>