我的 .bib 文件如下所示:
@incollection{stal2,
author = {Robert Stalnaker},
title = {Assertion}
booktitle = {Context and Content},
publisher = {Oxford University Press},
year = 1999a,
pages = {78-95},
}
@incollection{stal3,
author = {Robert Stalnaker},
title = {On the Representation of Context}
booktitle = {Context and Content},
publisher = {Oxford University Press},
year = 1999b,
pages = {96-114},
}
@ONLINE {stal4,
author = "Robert Stalnaker",
title = "Common Ground",
publisher = "Linguistics and Philosophy 25",
pages = {701-721}
year = "2002",
url = "https://doi.org/10.1023/A:1020867916902https://www.oxfordhandbooks.com/view/10.1093/oxfordhb/9780190675233.001.0001/oxfordhb-9780190675233-e-27",
}
@BOOK{stal1,
title = {Inquiry},
publisher = {MIT Press},
author = {Robert Stalnacker},
year = {1984},
edition = {},
}
但出于某种原因,无论我先输入什么,都会在书名行中显示一条错误消息,说
BibTeX:语法错误:找到“booktitle”,预期条目结束(“}”或“)”)(跳至下一个“@”)
有想法该怎么解决这个吗?
答案1
在条目stal2
和中stal3
,字段末尾缺少逗号title
。逗号是必需的作为字段之间的分隔符。BibTeX 正在寻找终止title
字段的信号,但它遇到了关键字booktitle
,从而触发了语法错误报告。
pages
顺便说一句,条目中字段末尾也缺少一个逗号stal4
。
附录:条目和year
的字段中还隐藏着另一种类型的语法错误。如果字段是纯数字(或者如果它们是字符串变量,但这里不适用),则可以不使用或分隔符来写入字段。这两个条目的字段是和。这种数字和字母的混合也会触发错误。为了避免触发错误消息,您可以分别编写和。但是,这并不是很好的做法,因为无论您是否在文档中引用一个或两个出版物,您都会将字母和硬编码到相关信息中。定义一个宏会更好,如下所示stal2
stal3
{...}
" ... "
year
year = 1999a,
year = 1999b,
year = {1999a},
year = {1999b},
a
b
year
\noopsort
\providecommand\noopsort{#1}{}
并将年份字段分别写为year = {1999{\noopsort{a}}},
和year = {1999{\noopsort{b}}},
。 BibTeX 将自动形成适当的年份标签。