这是用户在 2025-2-25 23:22 为 https://retorque.re/zotero-better-bibtex/citing/index.html 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?

Citation Keys  引文键

Generating citekeys for your items
为您的项目生成 citekeys

The BibTeX citations keys generated by the standard Zotero exporters are always generated at time of export, using an algorithm that usually generates unique keys. For serious LaTeX users, “usually” presents the following problems:

  • If a non-unique key is generated, which one gets postfixed with a distinguishing character is essentially non-deterministic.
  • The keys are always auto-generated, so if you correct a typo in the author name or title, the key will change
    键值总是自动生成的,因此如果您更正作者姓名或标题中的错别字,键值将会更改
  • You can’t see the citation keys until you export them
    在导出之前,您无法看到参考文献键值

For a LaTeX author, the citation keys have their own meaning, fully separate from the other entry data, even if people usually pick a naming scheme related to them. As the citation key is the piece of data that connects your bibliography, this is a piece of data you want to have control over. BBT offers you this control:
对于 LaTeX 作者而言,参考文献键值具有其自身的含义,与其他条目数据完全分开,即使人们通常会选择与其相关的命名方案。由于参考文献键值是连接您参考文献的数据片段,因此这是您想要控制的数据片段。BBT 为您提供了这种控制:

  • Stable citation keys, without key clashes. BBT generates citation keys that take into account other existing keys in your library in a deterministic way, regardless of what part of your library you export, or the order in which you do it.
  • BBT is conservative about citation key changes, and allows you to fix keys to any value of your choosing.
  • Generate citation keys from JabRef(-ish) patterns.
    从 JabRef(类似)模式生成参考文献键值。

You can also  您还可以

  • Drag and drop LaTeX citations using these keys to your favorite LaTeX editor
    使用这些键将 LaTeX 参考文献拖放到您喜欢的 LaTeX 编辑器中
  • Show your citation keys in the item list view.
    在项目列表视图中显示您的参考文献键值。

Set your own, fixed citation keys
设置您自己固定的参考文献键值

By default, BBT generates the citation key from the item information, and this key may change when you edit the item. Such keys are called dynamic keys. In contrast, fixed keys are marked with a pushpin in the item list view and in the item details to distinguish them from dynamic keys.
默认情况下,BBT 会根据条目信息生成引用键,并且当您编辑条目时,此键可能会更改。此类键称为 dynamic 键。相比之下, fixed 键在条目列表视图和条目详细信息中用图钉标记,以区别于动态键。

You can fix the citation key (called pinning in BBT) for an item by adding the text Citation Key: <your citekey> anywhere in the extra field of the item on a line of its own. You can generate a pinned citation key by selecting one or more items, right-clicking, and selecting Generate BibTeX key, which will add the current citation key to the extra field, thereby pinning it.
您可以通过在条目的 extra 字段中单独一行添加文本 Citation Key: <your citekey> ,来固定条目的引用键(在 BBT 中称为 pinning )。您可以通过选择一个或多个条目,右键单击并选择 Generate BibTeX key 来生成固定的引用键,这将把当前的引用键添加到 extra 字段,从而固定它。

Drag and drop/hotkey citations
拖放/热键引用

You can drag and drop citations into your LaTeX/Markdown/Orgmode editor, and it will add a proper \cite{citekey}/[@citekey]/[[zotero://select...][@citekey]. The cite command is configurable for LaTeX by setting the config option in the preferences. Do not include the leading backslash.
您可以将引用拖放到 LaTeX/Markdown/Orgmode 编辑器中,它将添加正确的 \cite{citekey} / [@citekey] / [[zotero://select...][@citekey] 。可以通过设置首选项中的配置选项来配置 LaTeX 的 cite 命令。请勿包含开头的反斜杠。

This feature requires a one-time setup: choose the Quick Copy format under the Citation keys preferences for BBT, and go to Zotero preferences, tab Export, under Default Output Format, select “Better BibTeX Quick Copy: [format you just selected]”.
此功能需要一次性设置:在 BBT 的 Citation keys 首选项下选择快速复制格式,然后转到 Zotero 首选项,选项卡“导出”,在“默认输出格式”下,选择“Better BibTeX Quick Copy: [您刚刚选择的格式]”。

Find duplicate keys through integration with Report Customizer
通过与 Report Customizer 集成查找重复的键

The plugin will generate BibTeX comments to show whether a key conflicts and with which entry. BBT integrates with Zotero: Report Customizer to display the BibTeX key plus any conflicts between them in the zotero report.
该插件将生成 BibTeX 注释,以显示键是否冲突以及与哪个条目冲突。BBT 与 Zotero 集成:Report Customizer,以在 zotero 报告中显示 BibTeX 键以及它们之间的任何冲突。

Configurable citekey generator
可配置的 citekey 生成器

BBT also implements a citekey generator for those entries that don’t have a citekey set explicitly; the formatter pattern language used to follow the JabRef key formatting syntax, but now uses a javascript-ish format. You can set your generator pattern in the Better BibTeX preferences (you can get there via the Zotero preferences, or by clicking the Better BibTeX “Preferences” button in the addons pane.

Better BibTeX knows four kinds of “things” to build the citekey from:
Better BibTeX 知道四种类型的“内容”来构建 citekey:

  1. “functions”, these produce text based on the item the key is being constructed from, eg shorttitle. Even though these are largely case insensitive, they must start with a lowercase letter.
    “functions”,这些函数基于构建键值的条目生成文本,例如。 尽管这些函数在很大程度上不区分大小写,但它们必须以小写字母开头。
  2. “field access”, direct text from the zotero item fields; these again are largely case insensitive, but they must start with an uppercase letter
  3. “filters”, these are actions that act on the text returned from either functions, field access, or from a subformula like (auth + title || year). these are fully case insensitive, and you can chain these together, each acting on the output of the previous filter.
    “过滤器”,这些是作用于从函数、字段访问或子公式(如 (auth + title || year) )返回的文本的操作。这些完全不区分大小写,您可以将它们链接在一起,每个过滤器都作用于前一个过滤器的输出。
  4. bare strings (text quoted in single or double quotes)

There are 5 ways you can build subformulae:
可以通过五种方式构建子公式:

  1. composition: (auth + title)  组合: (auth + title)
  2. alternates: (auth || title) (use the first thing that returns any text, so auth if that returns text, otherwise title). Note the test-filters like .len *will skip to the next formula if it fails; see also sequence below
    备选方案: (auth || title) (使用返回任何文本的第一个,因此如果 auth 返回文本,则使用 auth ,否则使用 title )。请注意,诸如 .len 之类的测试过滤器如果失败将跳到下一个公式;另请参见下面的序列
  3. ternaries: (auth ? year : title) (if auth returns any text, use year, otherwise use title). Ternary operators have the format condition ? output_if_true : output_if_false, and you can use it like an if-or statement.
  4. sequences: (auth, shorttitle.len, '', title, 'hi'). The first element of the sequence that returns a non-empty output is used. Tests like .len that would usually skip to the next formula don’t do so in a sequence, they just return empty output if they fail, except the last element in the sequence. If that is a test, and it fails, the current formula is skipped and the next started. You would usually want a non-test here, or a fixed value.
  5. (auth + title) > 0 or auth > 0 are shorthand for (auth + title).len / auth.len.
    或作为 的简写。

these can be combined, eg (auth || shorttitle || year) ? (auth + title) : (year || title), but subformulae cannot appear in parameters, so title.select(auth ? 3 : 4) is not valid. Filters (explained below) can be applied to subformulae, so (title || auth).lower checks whether the title function produces output (i.e. not empty). If it does, the title function is used; otherwise, the formula will use the auth function. It then converts the output of (title || auth) to lowercase.
这些可以组合,例如 (auth || shorttitle || year) ? (auth + title) : (year || title) ,但子公式不能出现在参数中,因此 title.select(auth ? 3 : 4) 无效。过滤器(如下所述)可以应用于子公式,因此 (title || auth).lower 检查 title 函数是否产生输出(即非空)。如果产生输出,则使用 title 函数;否则,公式将使用 auth 函数。然后,它将 (title || auth) 的输出转换为小写。

You can also explicitly test whether a formula part is not empty and jump to the next formula if not:
您还可以显式测试公式部分是否不为空,如果不是,则跳转到下一个公式:

title.lower.len + year; auth + year

which would have the formula evaluate whether the title function returns a non-empty text; if this condition is not met, formula evaluaton jumps to the next formula auth + year. You can also test for a minimal length using eg

title > 1 + year | auth + year

which is shorthand for

title.len('>',1) + year | auth + year

which checks whether the title output is longer than 1 character.

The default key pattern is auth.lower + shorttitle(3,3) + year; if you have papers that use keys which were generated by the key generator of the standard Bib(La)TeX exporters of Zotero you may want to use zotero.clean instead in order to ease migration from existing exports for people who previously used the standard Zotero Bib(La)TeX exports.

auth.lower + shorttitle(3,3) + year, means  ,表示

  1. last name of first author without spaces, in lowercase because of the .lower filter
  2. The first n (default: 3) words of the title, apply capitalization to first m (default: 0) of those.
  3. year of publication if any,
    出版年份(如果有)
  4. a letter postfix (a, b, c, etc) in case of a clash (this part is always added, you can’t disable it, although you can change it to Zotero-style numeric)

Changing a pattern will only affect items created/changed after you changed the pattern; existing keys are not automatically regenerated when you change the pattern. If you want your keys to update after a pattern change you will have to select your items, right-click, and select Refresh. This will not affect keys you have pinned.
更改模式只会影响您更改模式后创建/更改的项目;现有密钥在您更改模式时不会自动重新生成。如果您希望密钥在模式更改后更新,您必须选择您的项目,右键单击,然后选择 。这不会影响您已固定的密钥。

If you want to get fancy, you can set multiple patterns separated by a semicolon (;) or vertical bar (|), of which the first will be applied that yields a non-empty string. If all return a empty string, a random key will be generated.
如果您想更高级一些,您可以用分号 (;) 或竖线 (|) 分隔设置多个模式,系统将首先应用产生非空字符串的模式。如果所有模式都返回空字符串,则会生成一个随机键。

An example application for this behavior is to use the tex.shortauthor from the extra field when defined to generate short citation keys for entries with long group author names, but to default to auth.lower otherwise:
一个此行为的示例应用是从定义的额外字段生成具有长组作者名称的条目的简短引用键,否则默认为:

extra('tex.shortauthor').transliterate.clean.lower.len + year; auth.lower + year

You can add a verbatim text by just including it in single or double quotes:
您可以通过将其包含在单引号或双引号中来添加逐字文本:

extra('tex.shortauthor').transliterate.clean.lower.len + year; 'default' + auth.lower + year

Formulas have some ternary and or-style choice support; you can use them in formulas instead of a function, but not in parameters; you can for example use
公式具有一些三元和或式选择支持;您可以在公式中使用它们来代替函数,但不能在参数中使用;例如,您可以使用

(title ? title : auth).lower + year

or  

(title || auth).lower + year

instead of  代替

title.len + year | auth + year

and you can test for length of subsections; what you would previously do with
并且你可以测试小节的长度;你之前会用什么来做

auth + title + len + year

to jump to the next formula if auth and title were both empty is now
如果两者都为空,则跳到下一个公式

(auth + title).len + year

Generating citekeys  生成参考文献键

To generate your citekeys, you use a formula composed of functions and filters. Broadly, functions grab text from your item, and filters transform that text. Note that the formula syntax has changed from a bracketed format to a javascript-ish format. The old syntax was getting harder to maintain and its inflexibility prevented new extensions to the functions being implemented cleanly. The old syntax still works but will be translated to the new format automatically.
要生成您的 citekeys,您使用一个由函数和过滤器组成的公式。大体上,函数从您的项目中提取文本,过滤器转换该文本。请注意,公式语法已从方括号格式更改为类似 JavaScript 的格式。旧语法越来越难以维护,其缺乏灵活性阻碍了对函数的新扩展的干净实现。旧语法仍然有效,但会自动转换为新格式。

Below you will find a full list of functions and filters you can use, in the new format only, sorry. You can still use these in the old syntax, but they support only positional parameters, where I would recommend generally to use the new syntax with named parameters.
以下是您可以使用的所有函数和过滤器的完整列表,仅限于新格式,抱歉。您仍然可以使用旧语法,但它们仅支持位置参数,我通常建议使用带命名参数的新语法。

Note: a number of functions below talk about the author’s lastname; you can read that as “when available”. If you have the name as a single-field name (for entities like International Business Machines or Aristoteles), Zotero doesn’t have a last name, and the full single-field name is taken instead.
注意:下面许多函数都提到了作者的姓氏;您可以将其理解为“如果可用”。如果您只有一个字段的姓名(对于诸如 或 之类的实体),Zotero 没有姓氏,则会改用完整的单字段姓名。

Functions  功能

auth(n: number = 0, m: number = 1, creator: ("author" | "editor" | "translator" | "collaborator" | "*") = '*', initials: boolean = false)
auth(n: number = 0, m: number = 1, creator: ("作者" | "编辑" | "译者" | "合作者" | "*") = '*', initials: boolean = false)

The first n (default: all) characters of the mth (default: first) author's last name.
第一个(默认:全部)作者姓氏的字符(默认:第一个)。

authAuthEa(creator: ("author" | "editor" | "translator" | "collaborator" | "*") = '*', initials: boolean = false, sep: string = '.')
authAuthEa(creator: ("作者" | "编辑" | "译者" | "合作者" | "*") = '*', initials: boolean = false, sep: string = '.')

The last name of the first two authors, and ".ea" if there are more than two.
前两位作者的姓氏,如果超过两位,则添加“.ea”。

authEtAl(creator: ("author" | "editor" | "translator" | "collaborator" | "*") = '*', initials: boolean = false, sep: string = ' ')

The last name of the first author, and the last name of the second author if there are two authors or "EtAl" if there are more than two. This is similar to auth.etal. The difference is that the authors are not separated by "." and in case of more than 2 authors "EtAl" instead of ".etal" is appended.
第一作者的姓氏,如果作者有两位,则为第一作者和第二作者的姓氏;如果作者超过两位,则为“EtAl”。这与.类似。不同之处在于作者之间没有用“.”分隔,并且如果作者超过 2 位,则附加“EtAl”而不是“.etal”。

authEtal2(creator: ("author" | "editor" | "translator" | "collaborator" | "*") = '*', initials: boolean = false, sep: string = '.')

The last name of the first author, and the last name of the second author if there are two authors or ".etal" if there are more than two.
第一作者的姓氏,如果作者有两位,则为第一作者和第二作者的姓氏;如果作者超过两位,则为“.etal”。

authForeIni(creator: ("author" | "editor" | "translator" | "collaborator" | "*") = '*')

The given-name initial of the first author.
首位作者的名字首字母。

authIni(n: number = 0, creator: ("author" | "editor" | "translator" | "collaborator" | "*") = '*', initials: boolean = false, sep: string = '.')

The beginning of each author's last name, using no more than n characters (0 = all).
每位作者姓氏的开头,使用不超过字符数(0 = 全部)。

authorIni(creator: ("author" | "editor" | "translator" | "collaborator" | "*") = '*', initials: boolean = false, sep: string = '.')
authorIni(创建者:(“作者” | “编辑” | “译者” | “合作者” | “*”)= '*',首字母缩写:布尔型 = false,分隔符:字符串 = '.')

The first 5 characters of the first author's last name, and the last name initials of the remaining authors.
第一位作者姓氏的前 5 个字符,以及其余作者的姓氏首字母。

authorLast(creator: ("author" | "editor" | "translator" | "collaborator" | "*") = '*', initials: boolean = false)
authorLast(创建者:(“作者” | “编辑” | “译者” | “合作者” | “*”)= '*',首字母缩写:布尔型 = false)

The last name of the last author
最后一位作者的姓氏

authorLastForeIni(creator: ("author" | "editor" | "translator" | "collaborator" | "*") = '*')
authorLastForeIni(创建者:(“作者” | “编辑” | “译者” | “合作者” | “*”)= '*')

The given-name initial of the last author.
最后一位作者的给名首字母。

authorsAlpha(creator: ("author" | "editor" | "translator" | "collaborator" | "*") = '*', initials: boolean = false, sep: string = ' ')

Corresponds to the BibTeX style "alpha". One author: First three letters of the last name. Two to four authors: First letters of last names concatenated. More than four authors: First letters of last names of first three authors concatenated. "+" at the end.
对应于 BibTeX 样式 "alpha"。一位作者:姓氏的前三个字母。两位到四位作者:姓氏的首字母连接。超过四位作者:前三位作者的姓氏首字母连接。末尾加 "+"。

authorsn(n: number = 0, creator: ("author" | "editor" | "translator" | "collaborator" | "*") = '*', initials: boolean = false, sep: string = ' ')

The last names of the first n (default: all) authors.
n 位(默认:全部)作者的姓氏。

authshort(creator: ("author" | "editor" | "translator" | "collaborator" | "*") = '*', initials: boolean = false, sep: string = '.')

The last name if one author/editor is given; the first character of up to three authors' last names if more than one author is given. A plus character is added, if there are more than three authors.
如果只有一位作者/编辑,则显示其姓氏;如果有多位作者,则显示最多三位作者姓氏的首字母。如果作者超过三位,则添加加号。

creators(n: (number | [ number, number ]) = 0, type: ("*" | Creator | Creator[] | (Creator | "*")[][]) = [['primary', 'editor', 'translator', '*']], name: `sprintf-style format template` = '%(f)s', etal: string = '', sep: string = ' ', min: number = 0, max: number = 0)

Author/editor information.
作者/编辑信息。

Creator is one of: artist, attorneyAgent, author, bookAuthor, cartographer, castMember, commenter, composer, contributor, cosponsor, counsel, director, editor, guest, interviewee, interviewer, inventor, performer, podcaster, presenter, producer, programmer, recipient, reviewedAuthor, scriptwriter, seriesEditor, sponsor, translator, wordsBy
作者类型包括:艺术家、律师代理人、作者、图书作者、地图绘制者、演员、评论员、作曲家、贡献者、共同发起人、法律顾问、导演、编辑、嘉宾、被采访者、采访者、发明家、表演者、播客、主持人、制片人、程序员、接受者、评论作者、编剧、系列编辑、赞助商、翻译、撰稿人

creatortypes(match?: RegExp)

This will return a comma-separated list of creator type information for all creators on the item in the form <1 or 2><creator-type>, where 1 or 2 denotes a 1-part or 2-part creator, and creator-type is one of {{% citekey-formatters/creatortypes %}}, or primary for the primary creator-type of the Zotero item under consideration. The list is prefixed by the item type, so might look like audioRecording:2performer,2performer,1composer.
此函数将返回项目中所有创建者创建者类型信息的逗号分隔列表,格式为 <1 or 2><creator-type> ,其中 12 表示单部分或双部分创建者, creator-type 是 {{% citekey-formatters/creatortypes %}} 之一,或 primary 表示所考虑的 Zotero 项目的主要创建者类型。该列表以项目类型为前缀,因此可能如下所示: audioRecording:2performer,2performer,1composer

date(format: string = '%Y-%m-%d')

The date of the publication
出版日期

extra(variable: string)

A pseudo-field from the extra field. eg if you have Original date: 1970 in your extra field, you can get it as extra(originalDate), or tex.shortauthor: APA which you could get with extra('tex.shortauthor'). Any tex. field will be picked up, the other fields can be selected from this list of key names.
来自额外字段的伪字段。例如,如果您的 extra 字段中有 Original date: 1970 ,您可以将其作为 extra(originalDate) 获取,或者使用 extra('tex.shortauthor') 获取 tex.shortauthor: APA 。将拾取任何 tex. 字段,可以从此键名列表中选择其他字段。

field(name: string)  字段(名称: 字符串)

Gets the value of the item field
获取项目字段的值

firstpage

The number of the first page of the publication (Caution: this will return the lowest number found in the pages field, since BibTeX allows 7,41,73--97 or 43+.)
出版物的第一页页码(注意:这将返回 pages 字段中找到的最小数字,因为 BibTeX 允许或。)

group(name: string)

Tests whether the item is in the given group library
测试该条目是否在给定的组库中

infix(format: string = '%(a)s', start: number = 0)

a pseudo-function that sets the citekey disambiguation infix using an sprintf-js format spec for when a key is generated that already exists. The infix charachter appears at the place of this function of the formula instead of at the and (as postfix does). You must include exactly one of the placeholders %(n)s (number), %(a)s (alpha, lowercase) or %(A)s (alpha, uppercase). For the rest of the disambiguator you can use things like padding and extra text as sprintf-js allows. With start set to 1 the disambiguator is always included, even if there is no need for it when no duplicates exist. The default format is %(a)s.
一个伪函数,用于设置 citekey 消歧后缀,使用 sprintf-js 格式规范,当生成的 key 已存在时使用。后缀字符出现在公式中该函数的位置,而不是在末尾(如后缀那样)。您必须包含占位符(数字)、(小写字母)或(大写字母)中的一个。对于消歧符的其余部分,您可以使用 sprintf-js 允许的填充和额外文本等。如果将 start 设置为,则始终包含消歧符,即使在不存在重复项时也不需要它。默认格式为 .

inspireHep

Fetches the key from inspire-hep based on DOI or arXiv ID
基于 DOI 或 arXiv ID 从 inspire-hep 获取 key

item(id: ("key" | "id") = 'key')

returns the internal item ID/key
返回内部 item ID/key

journal(abbrev: ("off" | "abbrev" | "auto" | "abbrev+auto" | "full") = 'abbrev+auto')

returns the journal abbreviation, or, if not found, the journal title, If 'automatic journal abbreviation' is enabled in the BBT settings, it will use the same abbreviation filter Zotero uses in the wordprocessor integration. You might want to use the abbr filter on this. Abbreviation behavior can be specified as abbrev+auto (the default) which uses the explicit journal abbreviation if present, and tries the automatic abbreviator if not (if auto-abbrev is enabled in the preferences), auto (skip explicit journal abbreviation even if present), abbrev (no auto-abbrev even if it is enabled in the preferences) or full/off (no abbrevation).
返回期刊缩写,如果找不到,则返回期刊标题。如果在 BBT 设置中启用了“自动期刊缩写”,它将使用与 Zotero 在文字处理器集成中使用的相同缩写过滤器。您可能需要在此处使用 abbr 过滤器。缩写行为可以指定为 abbrev+auto (默认值),如果存在,则使用显式期刊缩写,如果不存在(如果在首选项中启用了自动缩写),则尝试自动缩写器; auto (即使存在也跳过显式期刊缩写); abbrev (即使在首选项中启用了自动缩写也不使用);或 full / off (不缩写)。

keyword(n: number)

Tag number n. Mostly for legacy compatibility
标签编号。主要用于向后兼容

language(...name: string[])

Tests whether the item has the given language set, and skips to the next pattern if not
测试项目是否设置了给定的语言,如果没有,则跳到下一个模式

lastpage

The number of the last page of the publication (See the remark on firstpage)
期刊的最后一页页码(参见关于……的说明)

library  

Tests whether the item is in the user library
测试项目是否在用户库中

month  

the month of the publication
出版物的月份

origdate

the original date of the publication
出版物的原始日期

origyear

the original year of the publication
出版年份

postfix(format: `sprintf-style format template` = '%(a)s', start: number = 0)

a pseudo-function that sets the citekey disambiguation postfix using an sprintf-js format spec for when a key is generated that already exists. Does not add any text to the citekey otherwise. You must include exactly one of the placeholders %(n)s (number), %(a)s (alpha, lowercase) or %(A)s (alpha, uppercase). For the rest of the disambiguator you can use things like padding and extra text as sprintf-js allows. With start set to 1 the disambiguator is always included, even if there is no need for it when no duplicates exist. The default format is %(a)s.
一个伪函数,使用格式规范设置 citekey 消歧后缀,用于生成已存在的键时。否则不会向 citekey 添加任何文本。您可以包含占位符 (number)、(alpha, lowercase) 或 (alpha, uppercase)。对于其余的消歧符,您可以使用 sprintf-js 允许的填充和额外文本等。当 start 设置后,即使在不存在重复项时不需要消歧符,它也会始终包含在内。默认格式为 。

shorttitle(n: number = 3, m: number = 0)
shorttitle(n: 数字 = 3, m: 数字 = 0)

The first n (default: 3) words of the title, apply capitalization to first m (default: 0) of those.
标题的前 n 个词(默认值:3),将首字母大写应用于其中的前 m 个词(默认值:0)。

shortyear

The last 2 digits of the publication year

title

Capitalize all the significant words of the title, and concatenate them. For example, An awesome paper on JabRef will become AnAwesomePaperJabref

type(...allowed: string[])

Without arguments, returns the item type. When arguments as passed, tests whether the item is of any of the given types, and skips to the next pattern if not, eg type(book) + veryshorttitle | auth + year.
没有参数时,返回项目类型。当传递参数时,测试项目是否属于给定的任何类型,如果不是,则跳到下一个模式,例如 type(book) + veryshorttitle | auth + year

veryshorttitle(n: number = 1, m: number = 0)
veryshorttitle(n: 数字 = 1, m: 数字 = 0)

The first n words of the title, apply capitalization to first m of those
标题的前 n 个词,将首字母大写应用于其中的前 m 个词

year  

The year of the publication
出版年份

zotero

Generates citation keys as the stock Zotero Bib(La)TeX export does. Note that this pattern inherits all the problems of the original Zotero citekey generation -- you should really only use this if you have existing papers that rely on this behavior.

Note: All auth... functions will fall back to editors if no authors are present on the item.
注意:如果项目上没有作者,所有 auth... 功能将回退到编辑。

Note: The functions above used to have the clean function automatically applied to them, this is no longer the case, so if you have CJK authors/titles and you want to manipulate them (using eg. capitalize), you could have to use transliterate on them first, eg. authEtal2.transliterate.capitalize + year + shorttitle(3, 3).
注意:上述函数过去会自动应用 clean 函数,现在不再如此,因此,如果您有 CJK 作者/标题并想操作它们(例如使用 capitalize ),您可能需要先对它们使用 transliterate ,例如 authEtal2.transliterate.capitalize + year + shorttitle(3, 3)

Direct access to unprocessed fields
直接访问未处理字段

The above functions all retrieve information stored in the item’s fields and process it in some way. If you don’t want this, you can instead call field contents without any processing. To access Zotero fields, refer to them as given in the table below:
上述函数都会检索存储在项目字段中的信息,并以某种方式对其进行处理。如果您不希望这样,您可以直接调用字段内容而不进行任何处理。要访问 Zotero 字段,请参考下表中的名称:

AbstractNote AccessDate AdminFlagJM AdoptionDateJM
AlbumJM ApplicationNumber Archive ArchiveCollectionJM
ArchiveIDZ ArchiveLocation  存档位置 ArtworkMedium  艺术品媒介 ArtworkSize  艺术品尺寸
AssemblyNumberJM  组件编号 JM Assignee  受让人 AudioFileType  音频文件类型 AudioRecordingFormat  录音格式
AuthorityZ  权限 Z BillNumber  账单号码 BlogTitle  博客标题 BookAbbreviationJM  书名缩写 JM
BookTitle  书名 CallNumber  索书号 CaseName  病例名称 Code  代码
CodeNumber  代码编号 CodePages  代码页码 CodeVolume  代码卷号 Committee  委员会
Company  公司 ConferenceDateJM  会议日期 JM ConferenceName  会议名称 Country  国家
Court  法院 DOI Date  日期 DateAmendedJM  修正日期 JM
DateDecided  判决日期 DateEnacted  颁布日期 DictionaryTitle  词典名称 Distributor  经销商
DivisionJM  部门 JM DocketNumber  卷宗号 DocumentNameJM  文件名 JM DocumentNumber  文件号
Edition  版本 EncyclopediaTitle  百科全书标题 EpisodeNumber  剧集数 FilingDate  提交日期
FirstPage  首页 FormatZ  格式 Z ForumTitle  论坛标题 GazetteFlagJM  公报标志 JM
Genre  类型 History  历史 ISBN ISSN
IdentifierZ Institution InterviewMedium Issue
IssueDate IssuingAuthority JournalAbbreviation JurisdictionJM
Label Language LegalStatus LegislativeBody
LetterType LibraryCatalog ManuscriptType MapType
Medium MeetingName MeetingNumberJM NameOfAct
Network NewsCaseDateJM NumPages Number
NumberOfVolumes OpeningDateJM OpusJM OrganizationZ
OriginalDateJM Pages ParentTreatyJM PatentNumber
Place PostType PresentationType PriorityDateJM
PriorityNumbers ProceedingsTitle ProgramTitle ProgrammingLanguage
PublicLawNumber PublicationDateJM PublicationNumberJM PublicationTitle
Publisher References RegnalYearJM RegulationTypeJM
RegulatoryBodyJM ReignJM ReleaseJM ReportNumber
ReportType Reporter ReporterVolume RepositoryZ
RepositoryLocationZ ResolutionLabelJM Rights RunningTime
Scale Section Series SeriesNumber
SeriesText SeriesTitle Session SessionTypeJM
ShortTitle SigningDateJM Status Studio
Subject SupplementNameJM System ThesisType
Title TreatyNumberJM Type University
Url VersionNumber VideoRecordingFormat Volume
VolumeTitleJM WebsiteTitle WebsiteType YearAsVolumeJM

(fields marked Z are only available in Zotero, fields marked with JM are only available in Juris-M).

Filters

abbr(chars: number = 1)

Abbreviates the text. Only the first character and subsequent characters following white space will be included.

acronym(list: string = 'acronyms', reload: boolean = false, passthrough: boolean = false)

Does an acronym lookup for the text.

alphanum

clears out everything but unicode alphanumeric characters (unicode character classes L and N)

ascii

removes all non-ascii characters

capitalize

uppercases the first letter of each word

clean

transliterates the citation key and removes unsafe characters

condense(sep: string = '')

replaces spaces in the value passed in. You can specify what to replace it with by adding it as a parameter, e.g .condense('\_') will replace spaces with underscores. Equivalent to .replace(/\s+/g, sep).

default(text: string)

Returns the given text if no output was generated

discard

discards the input

find(match: (string | RegExp), passthrough: boolean = false)

Finds a text in the string and returns it.

formatDate(format: string = '%Y-%m-%d')

formats date as by replacing y, m and d in the format

ideographs

Treat ideaographs as individual words

jieba(mode?: ("cn" | "tw" | "hant"))

word segmentation for Chinese items. Uses substantial memory, and adds about 7 seconds to BBTs startup time; must be enabled under Preferences -> Better BibTeX -> Advanced -> Citekeys

kuromoji

word segmentation for Japanese items. Uses substantial memory; must be enabled under Preferences -> Better BibTeX -> Advanced -> Citekeys

len(relation: ("<" | ">" | "<=" | "==" | "!=" | ">=") = '>', length: number = 0)

If the length of the output does not match the given number, skip to the next pattern.

localTime

transforms date/time to local time. Mainly useful for dateAdded and dateModified as it requires an ISO-formatted input.

lower

Forces the text inserted by the field marker to be in lowercase. For example, auth.lower expands to the last name of the first author in lowercase.

match(match: (string | RegExp), clean: boolean = false)

If the output does not match the given string/regex, skip to the next pattern.

nopunct(dash: string = '-')

Removes punctuation

nopunctordash

Removes punctuation and word-connecting dashes. alias for nopunct(dash='')

numeric

returns the value if it's an integer

pinyin

transliterates the citation key to pinyin

postfix(postfix: string)

postfixes with its parameter, so postfix('\_') will add an underscore to the end if, and only if, the value it is supposed to postfix isn't empty

prefix(prefix: string)

prefixes with its parameter, so .prefix('\_') will add an underscore to the front if, and only if, the value it is supposed to prefix isn't empty.

replace(find: (string | RegExp), replace: string)

replaces text, for the text to match you can pass either:

  • a string: .replace('.etal','&etal') which will match case-insensitive, so will replace .EtAl with &etal.
  • javascript regular expression: .replace(/[.]etal/ig, '&etal')
select(start: number = 1, n?: number)

selects words from the value passed in. The format is select(start,number) (1-based), so select(1,4) or select(n=4) would select the first four words. If n is not given, all words from start to the end are selected.

skipwords(nopunct: boolean = false)

filters out common words like 'of', 'the', … the list of words can be seen and changed by going into about:config under the key extensions.zotero.translators.better-bibtex.skipWords as a comma-separated, case-insensitive list of words.

If you want to strip words like 'Jr.' from names, you could use something like Auth.nopunct.skipwords.fold after adding jr to the skipWords list. Note that this filter is always applied with nopunct on if you use title (which is different from Title) or shorttitle.

substring(start: number = 1, n?: number)

substring(start,n) selects n (default: all) characters starting at start

transliterate(mode?: ("minimal" | "tw" | "mn" | "arabic" | "chinese" | "german" | "japanese" | "mongolian" | "russian" | "ru" | "uk" | "ar" | "de" | "ja" | "zh" | "zh-hant" | "ukranian"))

transliterates the citation key. If you don't specify a mode, the mode is derived from the item language field

upper

Forces the text inserted by the field marker to be in uppercase. For example, auth.upper expands the last name of the first author in uppercase.

Usage note: the functions condense, skipwords, capitalize and select rely on whitespaces for word handling. Most functions strip whitespace and thereby make these filter functions sort of useless. You will in general want to use the fields from the table above, which give you the values from Zotero without any changes. The fields with ** are only available in Juris-M.