使用 biblatex 的参考书目:如何使用 authoryear 样式实现粗体标签?

使用 biblatex 的参考书目:如何使用 authoryear 样式实现粗体标签?

我目前正在用 LaTeX 写论文biblatex用于引用和参考书目。我尝试匹配关于书目条目第一部分的正式请求,这些请求必须看起来像“Meyer,B.(1990):“ 或者有两个以上的名字时 ”Meyer,B.;Wang,S. 等人(1992 年):“。条目的其余部分已经符合要求。通过调整作者年份样式,使用 Google 收集的条目,我得到了部分正确结果,但不是全部。我最大的问题似乎是“et al.”,它要么总是粗体,要么从不。让它总是粗体会导致一些编辑列表出现问题。如示例所示,名称前缀“de la Fuentes”也会出现同样的问题。

所以我想知道是否有可能用\mkbibbold一般命令来处理条目的标签,而不是单独更改每个部分?

这是我目前得到的示例(我为其长度感到抱歉,但我没有发现任何可以缩短的内容):

    \documentclass[ngerman, 12pt, a4paper, oneside, notitlepage]{scrreprt}
       \usepackage[utf8]{inputenc}
       \usepackage[ngerman]{babel}
       \usepackage[babel,german=quotes]{csquotes} 

    \usepackage [backend=bibtex,style=authoryear] {biblatex}
    \ExecuteBibliographyOptions{hyperref=true, firstinits=true, isbn=false, url=true, doi=false, sorting=nyt, minnames=1, maxcitenames=2, maxbibnames=2, language=ngerman, alldates=short, punctfont=true, autopunct=false, block=none, dashed=false}
       \addbibresource{literatur.bib} 
       \usepackage{filecontents} 

        \AtBeginBibliography{
            \renewcommand*{\multinamedelim}{\textbf\addsemicolon\space}
            \renewcommand*{\finalnamedelim}{\textbf\addsemicolon\space}
            \renewcommand*{\nameyeardelim}{\textbf\addcomma\space}
            \renewcommand*{\labelnamepunct}{\addcolon\space}
            \renewcommand*{\newunitpunct}{\addcomma\space}}

        \DefineBibliographyStrings{ngerman}{
            sequens = {f},  sequentes = {ff}} 
        \DefineBibliographyStrings{ngerman}{
            editors = {\mkbibbold{Hrsg.}},  editor = {\mkbibbold{Hrsg.}}, 
            andothers = {et\addspace al\adddotspace}, andmore = {et\addspace al\adddotspace}} % defining et al.

        \DeclareNameAlias{sortname}{last-first}

        \AtBeginBibliography{
            \renewcommand*{\mkbibnamelast}[1]{%bold names in label
            \ifmknamesc{\mkbibbold{#1}}{#1}}
            \renewcommand*{\mkbibnamefirst}[1]{
            \ifmknamesc{\mkbibbold{#1}}{#1}}
            \renewcommand*{\mkbibnameprefix}[1]{
            \ifboolexpr{ test {\ifmknamesc} and test {\ifuseprefix} }{\mkbibbold{#1}}{#1}}
            \def\ifmknamesc{%bold editors in labels, but not in content
            \ifboolexpr{ test {\ifcurrentname{labelname}}
            or test {\ifcurrentname{author}}
            or ( test {\ifnameundef{author}} and test {\ifcurrentname{editor}} ) }}

        \renewbibmacro*{name:andothers}{
            \ifthenelse{\value{listcount}=\value{liststop}\AND 
            \ifmorenames}
            {\ifnum\value{liststop}>1 \finalandcomma\fi 
            \andothersdelim\textbf{\bibstring{andothers}}}
            {}}
            }

        \setlength {\bibitemsep}{18pt}
        \setlength {\bibhang}{0.2cm}
        \DeclareFieldFormat[article, book, inbook, incollection, inproceedings, patent, thesis, unpublished, misc] 
            {title}{\mkbibquote{#1\isdot}}
        \DeclareFieldFormat [article, book, inbook, incollection, inproceedings, patent, thesis, unpublished, misc] 
            {date}{\mkbibbold{#1}}%bold-printed year in labels
        \DeclareFieldFormat{parens}{\mkbibbold{\mkbibparens{#1}}}%round brackets for year in label

    \usepackage[colorlinks, allcolors=black]{hyperref}
    \usepackage{url} 
    \urlstyle{same}

\begin{filecontents*}{literatur.bib} 
@article{nature, 
   author      =   {Rosa Rademakers and Manuela Neumann and Ian R. Mackenzie}, 
   title      =   {Advances in understanding the molecular basis of frontotemporal dementia - elongated title}, 
   journal      =   {Nature Reviews Neurology}, 
   volume      =   {8}, 
   year      =   {2012}, 
   pages      =   {423-434}, 
   doi         =   {10.1038/nrneurol.2012.117}} 
@article{fuente, 
   author      =   {D. de la Fuente and J.G. Castaño and M. Morcillo}, 
   title      =   {Long-term atmospheric corrosion of zinc}, 
   journal      =   {Corrosion Science}, 
   volume      =   {49}, 
   year      =   {2007}, 
   pages      =   {1420–1436 www.elsevier.com/locate/corsci}}, 
 @incollection{Rocca2007a,
   author = {Rocca, Emmanuel and Mirambet, Fran\c{c}ois},
   booktitle = {Corrosion of Metallic Heritage Artefacts: Investigation, Conservation and Prediction of Long Term Behaviour},
   chapter = {18},
   editor = {Philippe Dillmann and Pedro Piccardo and Gerard Beranger},
   pages = {308-334},
   title = {{Corrosion inhibitors for metallic artefacts: temporary protection}},
   year = {2007}}

\end{filecontents*} 

\begin{document} 
   Test\cite{nature}\\
   another test \cite{fuente} and \cite{Rocca2007a}
   \printbibliography
\end{document} 

答案1

您的示例不够简洁,因此我删除了一些与实际问题(实现粗体标签)无关的重新定义。我建议简单地将 bibmacro author(也会在样式中打印年份authoryear)包装成\mkbibbold-- 我使用xpatch包来执行此操作。(此外,还必须通过重新定义将年份后的冒号加粗\labelnamepunct。)

编辑:对于没有作者的作品,bbx:editorbibmacro 必须进行相应的更改。

\documentclass{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes} 

\usepackage[style=authoryear]{biblatex}
\ExecuteBibliographyOptions{firstinits=true,maxnames=2}

\setlength{\bibitemsep}{18pt}
\setlength{\bibhang}{0.2cm}

\DeclareNameAlias{sortname}{last-first}

\AtBeginBibliography{%
  \renewcommand*{\multinamedelim}{\addsemicolon\space}%
  \renewcommand*{\finalnamedelim}{\addsemicolon\space}%
}

\DefineBibliographyStrings{ngerman}{%
  andothers = {et\addspace al\adddotspace},%
  andmore = {et\addspace al\adddotspace},%
}

\usepackage{xpatch}
\xpretobibmacro{author}{\mkbibbold\bgroup}{}{}
\xapptobibmacro{author}{\egroup}{}{}
\xpretobibmacro{bbx:editor}{\mkbibbold\bgroup}{}{}
\xapptobibmacro{bbx:editor}{\egroup}{}{}

\renewcommand*{\labelnamepunct}{\mkbibbold{\addcolon\space}}

\usepackage{filecontents} 

\begin{filecontents*}{\jobname.bib} 
@article{nature, 
   author      =   {Rosa Rademakers and Manuela Neumann and Ian R. Mackenzie}, 
   title      =   {Advances in understanding the molecular basis of frontotemporal dementia - elongated title}, 
   journal      =   {Nature Reviews Neurology}, 
   volume      =   {8}, 
   year      =   {2012}, 
   pages      =   {423-434}, 
   doi         =   {10.1038/nrneurol.2012.117},
} 
@article{fuente, 
   author      =   {D. de la Fuente and J.G. Castaño and M. Morcillo}, 
   title      =   {Long-term atmospheric corrosion of zinc}, 
   journal      =   {Corrosion Science}, 
   volume      =   {49}, 
   year      =   {2007}, 
   pages      =   {1420–1436},
}
 @incollection{Rocca2007a,
   author = {Rocca, Emmanuel and Mirambet, Fran\c{c}ois},
   booktitle = {Corrosion of Metallic Heritage Artefacts: Investigation, Conservation and Prediction of Long Term Behaviour},
   chapter = {18},
   editor = {Philippe Dillmann and Pedro Piccardo and Gerard Beranger},
   pages = {308-334},
   title = {Corrosion inhibitors for metallic artefacts: temporary protection},
   year = {2007},
}
@misc{A01,
  editor = {Author, A.},
  year = {2001},
  title = {Alpha},
}
\end{filecontents*} 

\addbibresource{\jobname.bib} 

\nocite{*}

\begin{document}

\printbibliography

\end{document}

在此处输入图片描述

答案2

您可以将打印字符串“et al”的指令包装在条件中,并将其打开和关闭。考虑到各种书目信息的呈现顺序,我们可以在每个参考文献的开头设置开关,并且可以在容器标题之后关闭。

\newtoggle{boldetal}
\renewbibmacro{begentry}{\settoggle{boldetal}{true}}
\def\mymkbibbold{\iftoggle{boldetal}{\mkbibbold}{}} 

第一行创建一个切换。然后我们使用钩子begentry在每个引用的开头将切换设置为真。然后第三行是一个快捷方式:如果切换为真,则使用粗体打印,否则我们什么也不做。

name:andother在此基础上,修改了biblatex宏的定义以使用新的快捷方式。

\renewbibmacro*{name:andothers}{% 
   \ifthenelse{\value{listcount}=\value{liststop}\AND 
    \ifmorenames}%
    {\ifnum\value{liststop}>1 \finalandcomma\fi 
    \andothersdelim\mymkbibbold{\bibstring{andothers}}}
    {}}

最后,将关闭切换器的开关与标题一起插入。

\DeclareFieldFormat[article, book, inbook, incollection, inproceedings, patent, thesis, unpublished, misc] 
    {title}{\mkbibquote{#1\isdot}\global\settoggle{boldetal}{false}}

顺便说一下,在您的代码中,注释前有空格,即,{ %如果您删除它们,通过上述更改您将获得:

在此处输入图片描述

答案3

因为我遇到了类似的问题,但只需要将日期部分后的冒号加粗。

我刚刚改变了

FUNCTION {date.block}
{
  ":" *
  add.blank
}

在我的 .bst 文件中

FUNCTION {date.block}
{
  "\textbf{:}" *
  add.blank
}

相关内容