如何在 Biblatex 中添加已删除的句号

如何在 Biblatex 中添加已删除的句号

不幸的是,我似乎用逗号替换了“标题”和“日记”字段后的句号,尽管我希望它们在那里。那么,如何使用 numeric-comp 设置在 Biblatex 中恢复“日记”条目前后的句号?

@article{Steeds2011,
author = {Steeds RP},
title = {{Echocardiography: frontier imaging in cardiology}},
journal = {Br J Radiol},
volume = {84},
number = {3},
pages = {237--44},
year = {2011},
month = {Dec},

}

最后,我希望下面的 .bib 条目看起来像这样:

Steeds RP,超声心动图:心脏病学前沿成像。Br J Radiol. 2011;84(3):237-44。

但是,我不明白在什么时候我将“标题”和“期刊”字段后的句号替换为逗号!

这是我当前实现的宏:

\usepackage[style=numeric-comp]{biblatex}


\usepackage{xpatch}

\DeclareFieldFormat[article]{title}{#1}
\DeclareFieldFormat[article]{volume}{\textbf{#1}}

\renewcommand\newunitpunct{\addcomma\space}
\DefineBibliographyStrings{english}{%
page = {},
pages = {},
}


\renewbibmacro{in:}{\addcomma\addspace}

\renewbibmacro*{volume+number}{%
\isdot
\printfield{volume}%
\setunit*{\addcomma\addspace}%
\iffieldundef{number}{}{%
\printtext{no\adddot\addnbthinspace}%
}%
\printfield{(number)}%
\setunit{\addcolon\space}%
\printfield{eid}}

\renewbibmacro*{journal+issuetitle}{%
 \usebibmacro{journal}%
  \setunit*{\addperiod}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  \usebibmacro{issue+date}%
  \setunit{\addperiod\space}%
  \usebibmacro{volume+number+eid}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \newunit}

\renewcommand*{\bibpagespunct}{\addcolon\space}


\newbibmacro*{issue+date}{%
    \iffieldundef{issue}
      {\usebibmacro{date}}
      {\printfield{issue}%
       \setunit*{\addspace}%
       \usebibmacro{date}}%
  \newunit}



\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\addperiod}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  \setunit{\addspace}%
  \usebibmacro{issue+date}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \setunit{\addsemicolon\space}%
  \usebibmacro{volume+number+eid}%
  \newunit}




% No dot before number of articles
\xpatchbibmacro{volume+number+eid}{%
  \setunit*{\adddot}%
}{%
}{}{}

% Number of articles in parentheses
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}} 

答案1

您的代码有点不寻常,我删除了冗余和完全不必要的代码,并尝试对其余代码进行现代化处理。我并没有删除所有我觉得有问题的代码,但biblatex现在结果应该稍微更 -y 一些。

可以添加句号\renewbibmacro{in:}(代替逗号)和第二个句号\renewbibmacro*{journal+issuetitle}(代替空格)。

请注意,这author = {Steeds RP}是非常错误的,正确的输入应该是author = {Steeds, R. P.}。然后你让我们biblatex来处理格式化。

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=numeric-comp, giveninits, terseinits]{biblatex}

\usepackage{xpatch}


\DeclareNameAlias{author}{sortname}
\DeclareNameAlias{editor}{sortname}
\DeclareNameAlias{translator}{sortname}
\DeclareNameAlias{sortname}{family-given}

\renewcommand*{\revsdnamepunct}{}


\renewcommand\newunitpunct{\addcomma\space}

\DeclareFieldFormat[article]{title}{#1}

\renewbibmacro{in:}{\addperiod\addspace}

\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\addperiod\space}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  \usebibmacro{issue+date}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \setunit{\addsemicolon\space}%
  \usebibmacro{volume+number+eid}%
  \newunit}

\renewbibmacro*{issue+date}{%
  \printfield{issue}%
  \setunit*{\addspace}%
  \usebibmacro{date}%
  \newunit}

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

\xpatchbibmacro{volume+number+eid}{%
  \setunit*{\adddot}%
}{%
}{}{}

\renewcommand*{\bibpagespunct}{\addcolon\space}
\DeclareFieldFormat{pages}{#1}


\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Steeds2011,
  author  = {Steeds, R. P.},
  title   = {Echocardiography: frontier imaging in cardiology},
  journal = {Br J Radiol},
  volume  = {84},
  number  = {3},
  pages   = {237--44},
  year    = {2011},
}
\end{filecontents}

\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}


\begin{document}
\cite{sigfridsson,Steeds2011}
\printbibliography
\end{document}

Sigfridsson E 和 Ryde U,《从电势和电势矩推导原子电荷的方法比较》。《计算化学杂志》。1998;19(4):377–395,doi:10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P.//Steeds RP,《超声心动图:心脏病学前沿成像》。《英国放射学杂志》。2011;84(3):237–44。

相关内容