使用 biblatex/biber 将作者姓名、年份和期刊卷号加粗

使用 biblatex/biber 将作者姓名、年份和期刊卷号加粗

我正在使用 biber,它有以下选项:

\usepackage[backend=biber,style=authoryear,maxbibnames=9,maxcitenames=2,uniquelist=false,autocite=inline]{biblatex}
\addbibresource{references.bib}

在我的 tex 文档末尾,我打印了参考列表:

\printbibliography[title={References}]

期刊编辑要求我修改参考文献列表,使作者姓名、年份和期刊卷号变为粗体。我找不到明确的方法来做到这一点。这可能吗?如果可以,有什么线索可以告诉我怎么做吗?

答案1

使用biblatex-ext样式(提供标准样式的直接替代品),我们可以轻松自定义名称和日期格式。(见如何(正确地)删除 authoryear 样式中年份周围的括号?(v3))。感谢 moewe 指出更简单的名称代码(以及编写biblatex-ext)。

\documentclass{article}
\usepackage[style=ext-authoryear,maxbibnames=9,maxcitenames=2,uniquelist=false,autocite=inline]{biblatex}

\addbibresource{biblatex-examples.bib}

\DeclareNameAlias{sortname}{family-given}
\DeclareNameWrapperFormat{sortname}{\mkbibbold{#1}}
\DeclareFieldFormat{biblabeldate}{\mkbibparens{\mkbibbold{#1}}}
\DeclareFieldFormat[article,periodical]{volume}{\mkbibbold{#1}}

\begin{document}
\autocite{herrmann,doody}

\printbibliography
\end{document}

biblatex-ext 代码的输出

如果您想使用该apa样式(我不推荐)来执行此操作,则需要使用以下代码:

\documentclass{article}
\usepackage[style=apa,maxbibnames=9,maxcitenames=2,uniquelist=false,autocite=inline]{biblatex}

\addbibresource{biblatex-examples.bib}
\DeclareNameFormat{apaauthor}{\mkbibbold{%
  \ifthenelse{\value{listcount}=\maxprtauth\AND\value{listcount}<\value{listtotal}}
    {\addcomma\addspace\ldots\addspace}
    {\ifthenelse{\value{listcount}>\maxprtauth\AND\value{listcount}<\value{listtotal}}
      {}
      {\iffieldannotation{uncertain}
        {\mkbibbrackets{\usebibmacro{name:apa:family-given}%
                         {\namepartfamily}%
                         {\namepartgiven}%
                         {\namepartgiveni}%
                         {\namepartprefix}%
                         {\namepartsuffix}?}}
        {\usebibmacro{name:apa:family-given}%
          {\namepartfamily}%
          {\namepartgiven}%
          {\namepartgiveni}%
          {\namepartprefix}%
          {\namepartsuffix}}}}%
    \ifthenelse{\value{listcount}=\value{listtotal}}%
      {\ifmorenames{\printdelim{andothersdelim}\bibstring{andothers}}{}}{}}}

\DeclareFieldFormat[article,periodical]{apadate}{%
  \ifboolexpr{ test {\ifdatecirca} or test {\ifdateuncertain} }
    {\printtext{\mkbibbrackets{\mkbibbold{#1}}}}
    {\printtext{\mkbibparens{\mkbibbold{#1}}}}}

\DeclareFieldFormat[article,periodical]{volume}{\mkbibbold{#1}}




\begin{document}
\autocite{herrmann,doody}


\printbibliography
\end{document}

APA代码输出

答案2

<=====您必须在序言中添加一些代码,将所需的作者姓名、年份和卷号更改为粗体(请参阅重要代码的标记及其使用说明):

\DeclareFieldFormat{date}{\mkbibbold{#1}} % <=========================== date 
\DeclareFieldFormat[article,periodical]{volume}{\mkbibbold{#1}} % <===== volume
\DeclareNameAlias{sortname}{first-last-bold}
\DeclareNameFormat{first-last-bold}{\mkbibbold{% <====================== name
  \ifgiveninits
    {\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiveni}{\namepartprefix}{\namepartsuffix}}
    {\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}}%
  \usebibmacro{name:andothers}}}

因此,有了以下完整的 mwe(下次请自己在下一个问题中添加一个 - 这样更容易帮助您!)

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{ahlswede2000network,
  title={Network information flow},
  author={Ahlswede, Rudolf and Cai, Ning and Li, Shuo-Yen Robert and 
          Yeung, Raymond W},
  journal={Information Theory, IEEE Transactions on},
  volume={46},
  number={4},
  pages={1204--1216},
  year={2000},
  publisher={IEEE},
}
@article{einstein,
    author =       "Albert Einstein",
    title =        "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
    [{On} the electrodynamics of moving bodies]",
    journal =      "Annalen der Physik",
    volume =       "322",
    number =       "10",
    pages =        "891--921",
    year =         "1905",
    DOI =          "http://dx.doi.org/10.1002/andp.19053221004",
    keywords =     "physics",
}
@book{dirac,
    title={The Principles of Quantum Mechanics},
    author={Paul Adrien Maurice Dirac},
    isbn={9780198520115},
    series={International series of monographs on physics},
    year={1981},
    publisher={Clarendon Press},
    keywords = {physics},
}
\end{filecontents*}


\documentclass{article}

\usepackage[%
  backend=biber,
  style=authoryear,
  maxbibnames=9,
  maxcitenames=2,
  uniquelist=false,
  autocite=inline
]{biblatex}
\addbibresource{\jobname.bib}

\DeclareFieldFormat{date}{\mkbibbold{#1}} % <=========================== date 
\DeclareFieldFormat[article,periodical]{volume}{\mkbibbold{#1}} % <===== volume
\DeclareNameAlias{sortname}{first-last-bold}
\DeclareNameFormat{first-last-bold}{\mkbibbold{% <====================== name
  \ifgiveninits
    {\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiveni}{\namepartprefix}{\namepartsuffix}}
    {\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}}%
  \usebibmacro{name:andothers}}}


\begin{document}

Some \autocite{einstein} text \cite{einstein}.
\parencite[I.6.2]{dirac}.

\nocite{*}
\printbibliography[title={References}]

\end{document}

得到结果:

由此产生的书目

相关内容