答案1
实现期刊缩写的基本技术是一个包含大量嵌套if$
语句的函数,每个语句if$
对应一对完整的期刊名称及其相应的缩写。以下是一个缩写两个期刊名称的函数示例。请注意,对于每个较长的期刊名称,根据文件中输入字段的内容,可能会有多个版本.bib
。例如,\&
和and
都可能出现在第一个期刊名称中,而IPA
、{IPA}
和International Phonetic Association
可能出现在第二个期刊名称中。
该函数必须出现前任何调用它的函数,因此它必须在函数article
和format.article.crossref
函数之前。
FUNCTION { journal.abbrev } {
journal "Natural Language and Linguistic Theory" = { "NLLT" }
{ journal "Natural Language \& Linguistic Theory" = { "NLLT" }
{ journal "Journal of the International Phonetic Association" = { "Jour. IPA" }
{ journal "Journal of the {IPA}" = { "Jour. IPA" }
{ journal "Journal of the IPA" = { "Jour. IPA" }
{ journal } if$ } if$ } if$ } if$} if$}
现在我们使用这个函数传递给article
期刊标题格式化函数(以下内容改编自作为alpha.bst
基础的),而不仅仅是传递journal
。
FUNCTION {article}
{ output.bibitem
format.authors "author" output.check
new.block
format.title "title" output.check
new.block
crossref missing$
{ journal.abbrev emphasize "journal" output.check
format.vol.num.pages output
format.date "year" output.check
}
{ format.article.crossref output.nonnull
format.pages output
}
if$
new.block
note output
fin.entry
}
由于这种风格奇怪地还允许交叉引用链接到文章,因此您还需要更改该功能:
FUNCTION {format.article.crossref}
{ key empty$
{ journal empty$
{ "need key or journal for " cite$ * " to crossref " * crossref *
warning$
""
}
{ "In {\em " journal.abbrev * "\/}" * }
if$
}
{ "In " key * }
if$
" \cite{" * crossref * "}" *
}
要删除,
期刊标题后的 ,需要做一些额外的工作。
首先我们需要在期刊标题后添加一个额外的标志来表示状态,我们首先将其添加到整数变量列表中:
INTEGERS { output.state before.all mid.sentence after.sentence after.block after.journal }
然后给它赋值:
FUNCTION {init.state.consts}
{ #0 'before.all :=
#1 'mid.sentence :=
#2 'after.sentence :=
#3 'after.block :=
#4 'after.journal :=
}
现在我们修改该output.nonnull
函数来检查after.journal
:
FUNCTION {output.nonnull}
{ 's :=
output.state after.journal =
{" " * write$ }
{
output.state mid.sentence =
{ ", " * write$ }
{ output.state after.block =
{ add.period$ write$
newline$
"\newblock " write$
}
{ output.state before.all =
'write$
{ add.period$ " " * write$ }
if$
}
if$
mid.sentence 'output.state :=
}
if$
}
if$
s
}
最后我们改变article
函数来将状态设置为after.journal
。
FUNCTION {article}
{ output.bibitem
format.authors "author" output.check
new.block
format.title "title" output.check
new.block
crossref missing$
{ after.journal 'output.state :=
journal.abbrev emphasize "journal" output.check
format.vol.num.pages output
format.date "year" output.check
}
{ format.article.crossref output.nonnull
format.pages output
}
if$
new.block
note output
fin.entry
}
示例文档(.bst
我已将修改后的文件命名为alpha-abbrv.bst
)。
\documentclass{article}
\begin{filecontents}{\jobname.bib}
@article{Boeckx2001scope,
Author = {Boeckx, Cedric},
Journal = {Natural Language and Linguistic Theory},
Number = {3},
Pages = {503--548},
Title = {Scope reconstruction and {A}-movement},
Volume = {19},
Year = {2001}}
@article{MayrDavies2011,
Author = {Mayr, Robert and Davies, Hannah},
Journal = {Journal of the International Phonetic Association},
Number = {1},
Pages = {1--25},
Title = {A cross-dialectal acoustic study of the monophthongs and diphthongs of {Welsh}},
Volume = {41},
Year = {2011}}
@article{AounChoueiri2000,
Author = {Joseph Aoun and Lisa Choueiri},
Journal = {Natural Language \& Linguistic Theory},
Pages = {1--39},
Title = {Epithets},
Volume = {18},
Year = {2000}}
\end{filecontents}
\bibliographystyle{alpha-abbrv}
\begin{document}
\cite{MayrDavies2011,AounChoueiri2000,Boeckx2001scope}
\bibliography{\jobname}
\end{document}