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>authorLast</code>]</b>: The last name of the last
40 <li><b>[<code>authorsN</code>]</b>: The last name of up to
41 N authors. If there are more authors, "EtAl" is
44 <li><b>[<code>authIniN</code>]</b>: The beginning of each
45 author's last name, using no more than N
46 characters.<br /></li>
48 <li><b>[<code>authorIni</code>]</b>: The first 5 characters
49 of the first author's last name, and the last name initials
50 of the remaining authors.<br /></li>
52 <li><b>[<code>authN</code>]</b>: The first N characters of
53 the first author's last name<br /></li>
55 <li><b>[<code>authN_M</code>]</b>: The first N characters
56 of the Mth author's last name<br /></li>
58 <li><b>[<code>auth.auth.ea</code>]</b>: The last name of
59 the first two authors, and ".ea" if there are more than
62 <li><b>[<code>auth.etal</code>]</b>: The last name of the
63 first author, and the last name of the second author if
64 there are two authors or ".etal" if there are more than
67 <li><b>[<code>authshort</code>]</b>: The last name if one
68 author is given; the first character of up to three
69 authors' last names if more than one author is given. A
70 plus character is added, if there are more than three
72 </ul><b>Note:</b> If there is no author (as in the case of an
73 edited book), then all of the above
74 <b><code>[auth...]</code></b> markers will use the editor(s)
75 (if any) as a fallback. Thus, the editor(s) of a book with no
76 author will be treated as the author(s) for label-generation
77 purposes. If you do not want this behaviour, i.e. you require a
78 marker which expands to nothing if there is no author, use
79 <b><code>pureauth</code></b> instead of
80 <b><code>auth</code></b> in the above codes. For example,
81 <b><code>[pureauth]</code></b>, or
82 <b><code>[pureauthors3]</code></b>.
85 <li><b>[<code>edtr</code>]</b>: The last name of the first
88 <li><b>[<code>edtrIniN</code>]</b>: The beginning of each
89 editor's last name, using no more than N
92 <li><b>[<code>editors</code>]</b>: The last name of all
95 <li><b>[<code>editorLast</code>]</b>: The last name of the last
98 <li><b>[<code>editorIni</code>]</b>: The first 5 characters
99 of the first editor's last name, and the last name initials
100 of the remaining editors.<br /></li>
102 <li><b>[<code>edtrN</code>]</b>: The first N characters of
103 the first editor's last name<br /></li>
105 <li><b>[<code>edtrN_M</code>]</b>: The first N characters
106 of the Mth editor's last name<br /></li>
108 <li><b>[<code>edtr.edtr.ea</code>]</b>: The last name of
109 the first two editors, and ".ea" if there are more than
112 <li><b>[<code>edtrshort</code>]</b>: The last name if one
113 editor is given; the first character of up to three
114 editors' last names if more than one editor is given. A
115 plus character is added, if there are more than three
118 <li><b>[<code>firstpage</code>]</b>: The number of the
119 first page of the publication (Caution: this will return
120 the lowest number found in the pages field, since bibtex
121 allows <code>7,41,73--97</code> or <code>43+</code>.)<br /></li>
123 <li><b>[<code>keywordN</code>]</b>: Keyword number N from
124 the "keywords" field, assuming keywords are separated by
125 commas or semicolons.<br /></li>
127 <li><b>[<code>lastpage</code>]</b>: The number of the last
128 page of the publication (See the remark on
129 <code>firstpage</code>)<br /></li>
131 <li><b>[<code>shorttitle</code>]</b>: The first 3 words of
134 <li><b>[<code>shortyear</code>]</b>: The last 2 digits of
135 the publication year<br /></li>
137 <li><b>[<code>veryshorttitle</code>]</b>: The first word of
138 the title, discounting 'the', 'a', 'an'.<br /></li>
141 <p>A field name (or one of the above pseudo-field names) may
142 optionally be followed by one or more modifiers. Modifiers are
143 applied in the order they are specified.</p>
146 <li><b>:abbr</b>: Abbreviates the text produced by the
147 field name or spcial field marker. Only the first character
148 and subsequent characters following white space will be
149 included. For example, <b>[journal:abbr]</b> would from the
150 journal name "Journal of Fish Biology" produce
153 <li><b>:lower</b>: Forces the text inserted by the field
154 marker to be in lowercase. For example, <b>[auth:lower]</b>
155 expands the last name of the first author in
156 lowercase.<br /></li>
159 <p>If you haven't defined a key pattern for a certain entry
160 type, the <b>Default key pattern</b> will be used. You can
161 change the default pattern - its setting is above the list of
162 entry types in the <b>Key pattern</b> section of the
163 <b>Preferences</b> dialog.</p>
165 <p>The default key pattern is [auth][year], and this could
166 produce keys like e.g. <code>Yared1998</code> If the key is not
167 unique in the current database, it is made unique by adding one
168 of the letters a-z until a unique key is found. Thus, the
169 labels might look like:</p>
172 <code>Yared1998</code><br />
173 <code>Yared1998a</code><br />
174 <code>Yared1998b</code>
177 <h2>Regular expression replace</h2>
179 <p>After the key pattern has
180 been applied to produce a key, you can choose to have the key
181 generator search for occurences of a specific regular
182 expression, and replace it with a string. The regular
183 expression and replacement string are entered in the text
184 fields below the list of key patterns. If the replacement
185 string is empty, matches of the regular expression will simply
186 be removed from the generated key.</p>