我想定制一个BibTeX样式文件(.bst
),其中有针对未发表作品的以下功能:
FUNCTION {format.howpublished.address.year}
{ howpublished empty$
{ address empty$
{ "No address in " cite$ warning$ }
{ " \apyformat {" oaddress.opublisher.oyear.format address "}" * }
if$
}
{ address empty$
{ "There's only a howpublished (no address) in " cite$ * warning$ " \apyformat {" oaddress.opublisher.oyear.format howpublished * "}" * }
{ " \apyformat {" oaddress.opublisher.oyear.format address * "\bpubaddr {} " * howpublished "}" * * }
if$
}
if$
}
我想使用德语变音符号('ö'、'ä' 和 'ü')将字符串“No address in”更改为另一个字符串。但简单地输入变音符号会导致编译错误。如何做到这一点?
答案1
嗯,你不能轻易地"
在文件中使用字符串.bst
。一种方法是使用函数。最简单的方法是在参考书目序言中int.to.chr$
定义一个命令。\myumlaut
您的原始函数begin.bib
可能如下所示:
FUNCTION {begin.bib}
{ preamble$ empty$
'skip$
{ preamble$ write$ newline$ }
if$
"\providecommand{\bysame}{\leavevmode\hbox to3em{\hrulefill}\thinspace}"
write$ newline$
"\begin{thebibliography}{" longest.label * "}" *
write$ newline$
}
然后你将其修改为:
FUNCTION {begin.bib}
{ preamble$ empty$
'skip$
{ preamble$ write$ newline$ }
if$
"\let\myumlaut\" #34 int.to.chr$ *
write$ newline$
"\providecommand{\bysame}{\leavevmode\hbox to3em{\hrulefill}\thinspace}"
write$ newline$
"\begin{thebibliography}{" longest.label * "}" *
write$ newline$
}
现在,您可以写schöne
为sch\myumlaut{o}ne
。