我需要以粗体打印参考书目条目的标签,将,
多个作者(如果有)之间的替换为;
,并以 结尾:
。下图是我的指导方针中的一个示例:
我认为这应该可以通过修改我的自定义 .bst 文件,尤其是函数来实现format.names
。基于这和这我想出了以下功能:
FUNCTION {makebold}{
{ duplicate$ empty$
{ pop$ "" }
{ "\textbf{" swap$ * "}" * }
if$
}
但是,当我将其添加到我的 bst 文件中时,我只得到编译错误甚至无需调用该函数,只需将其复制到文件中即可。
这是我当前的format.names
函数。
FUNCTION {format.names}
{ 'bibinfo :=
duplicate$ empty$ 'skip$ {
's :=
"" 't :=
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ s nameptr
"{vv~}{ll}{, jj}{, f{.}.}"
format.name$
bibinfo bibinfo.check
't :=
nameptr #1 >
{
nameptr #2
#1 + =
numnames #2
> and
{ "others" 't :=
#1 'namesleft := }
'skip$
if$
namesleft #1 >
{ ", " * t * }
{
s nameptr "{ll}" format.name$ duplicate$ "others" =
{ 't := }
{ pop$ }
if$
"," *
t "others" =
{
" " * bbl.etal *
}
{ " " * t * }
if$
}
if$
}
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
} if$
}
我对 bst 文件完全没有经验,但需要解决这个问题,因为我的导师已经在抱怨我应该使用 Word 而不是 LaTeX,如果我不能理清他心爱的参考书目风格,他会强迫我迁移我的论文 :(
如果有人能帮我打印出我的条目,那就太好了!
最后一句话:不知道这是否相关,但名字应该不是\citep
像我使用等时一样在文本中使用粗体。
更新:我已设法(通过反复试验)使标签变为粗体(我不得不将函数重命名为bolden
而不是makebold
,不知道为什么)并用分号替换作者之间的逗号。仍然缺少的是作者列表和标题之间的最后一个冒号。
我现在的format.names
样子是这样的:
FUNCTION {format.names}
{ 'bibinfo :=
duplicate$ empty$ 'skip$ {
's :=
"" 't :=
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ s nameptr
"{vv~}{ll}{, jj}{, f{.}.}"
format.name$ bolden
bibinfo bibinfo.check
't :=
nameptr #1 >
{
nameptr #2
#1 + =
numnames #2
> and
{ "others" 't :=
#1 'namesleft := }
'skip$
if$
namesleft #1 >
{ "; " * t * }
{
s nameptr "{ll}" format.name$ duplicate$ "others" =
{ 't := }
{ pop$ }
if$
"" *
t "others" =
{
" " * bbl.etal bolden *
}
{ "; " * t * }
if$
}
if$
}
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
} if$
}
答案1
以下是使用 biblatex 的代码,它似乎满足要求:
\documentclass[german]{article}%mkbib
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{babel}%
\usepackage{csquotes}
\usepackage{xpatch}
\usepackage[backend=biber, style=authoryear, firstinits, mergedate=false]{biblatex}
\addbibresource{marcedb.bib}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand*{\multinamedelim}{\addsemicolon\space}
\renewcommand*{\subtitlepunct}{\addcolon\space}
\renewcommand*{\newunitpunct}{\addcomma\space}
\renewcommand*{\finentrypunct}{\addperiod}
\renewcommand*{\revsdnamepunct}{\addcomma\space}%
\renewcommand*{\finalnamedelim}{\multinamedelim}
\renewcommand*{\mkbibnamelast}[1]{\textsc{#1}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareNameAlias{sortname}{last-first}
\DeclareNameFormat{last-first}{%
\iffirstinits
{\mkbibbold{\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}}%
{\mkbibbold{\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}}%
\usebibmacro{name:andothers}}
\renewcommand*{\labelnamepunct}{\bfseries\addcolon\space}
\renewbibmacro*{date+extrayear}{}%
\renewbibmacro*{date}{%
\mkbibparens{\printdate}}%
\renewbibmacro*{issue+date}{%
\printtext{\usebibmacro{date}}
\setunit*{\addcomma\space}
\printfield{issue}
\newunit}
\renewbibmacro*{series+number}{%
\addcomma\space
\iffieldundef{series}{}{\printtext[parens]{\printfield{series}%
\setunit*{\addsemicolon\space}%
\printfield{number}}}%
\newunit}
\renewbibmacro*{publisher+location+date}{%
\printlist{location}%
\iflistundef{publisher}{}%
{\addspace\printtext{u.a.:}}
\printlist{publisher}%
\addspace%
\usebibmacro{date}%
\newunit}
\xpatchbibmacro{byeditor+others}%
{\usebibmacro{byeditor+othersstrg}%
\setunit{\addspace}%
\printnames[byeditor]{editor}%
\clearname{editor}%
\newunit}%
{\printnames[byeditor]{editor}%
\clearname{editor}%
\setunit{\addspace}
\mkbibparens{Ed\addperiod}%
\newunit}%
\xpatchbibdriver{inbook}{%
\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}}%
{%
\iffieldundef{bybookauthor}{}%
{ \newunit\newblock}%
\usebibmacro{byeditor+others}%
\setunit{\addcolon\space}\newblock
\usebibmacro{maintitle+booktitle}}%
{}{}%
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addcomma\space}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\usebibmacro{volume+number+eid}%
\setunit{\addspace}%
\usebibmacro{issue+date}%
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
结果:
答案2
好吧,我解决了这个问题 :) 我会在这里发布解决方案,以防将来有人遇到这个问题。
需要三个步骤。首先,这是正确的format.names
:
FUNCTION {format.names}
{ 'bibinfo :=
duplicate$ empty$ 'skip$ {
's :=
"" 't :=
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ s nameptr
"{vv~}{ll}{, jj}{, f{.}.}"
format.name$ bolden
bibinfo bibinfo.check
't :=
nameptr #1 >
{
nameptr #2
#1 + =
numnames #2
> and
{ "others" 't :=
#1 'namesleft := }
'skip$
if$
namesleft #1 >
{ "\textbf{;} " * t * }
{
s nameptr "{ll}" format.name$ duplicate$ "others" =
{ 't := }
{ pop$ }
if$
"" *
t "others" =
{
" " * bbl.etal bolden *
}
{ "\textbf{;} " * t * }
if$
}
if$
}
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
} if$
": " bolden *
}
这是一个工作bolden
方法:
FUNCTION {bolden}
{ duplicate$ empty$
{ pop$ "" }
{ "\textbf{" swap$ * "}" * }
if$
}
第二步是在入口函数的调用output.nonperiod
之后添加以删除一个额外的点。format.authors
FUNCTION {article}
{ output.bibitem
format.authors output.nonperiod "author" output.check
author format.key output
new.block
format.title "title" output.check
new.block
crossref missing$
{
journal
"journal" bibinfo.check
"journal" output.check
format.vol.num.pages output
format.date "year" output.check
}
{ format.article.crossref output.nonnull
format.pages output
}
if$
format.issn output
new.block
format.note output
format.eprint output
fin.entry
}
第三步是最烦人的部分:对您使用的每个条目重复第二步。
这不是一个好的或干净的解决方案,但是这个 hack 可以完成我需要它做的事情,所以我目前很满意:)
编辑:为了完整起见,应该优先考虑 Bernard 的答案。我忘了nonperiod
在这里添加方法:
FUNCTION {output.nonperiod.nonnull}
{ 's :=
write$
s
}
FUNCTION {output.nonperiod}
{ duplicate$ empty$
'pop$
'output.nonperiod.nonnull
if$
}