删除地址/出版商和年份之间以及括号后的逗号

删除地址/出版商和年份之间以及括号后的逗号

我需要以以下形式出现的脚注引用(大部分):

本书首次亮相:

F. 作者 – TS 作者,长标题而非短标题,1965 年地址,4。

第二次出现:

F. 作者 – TS 作者,简称(参见第 1 条)5.

文章在期刊上首次发表:

A. 作者,“文章标题”,期刊名称65 (1968) 113-126。

到目前为止我已经:

F. 作者 – TS 作者,长标题而非短标题,地址,1965 年,第 4 页。

F. 作者 – TS 作者,简称(参阅第1节),5。

A. 作者,“文章标题”,期刊名称65 (1968), 113-126。

如您所见,我没能去掉地址和年份之间以及两个括号后面的逗号。到目前为止,我得到了以下代码:

\documentclass{scrartcl}
\begin{filecontents*}{mybib.bib}
@BOOK{Abook,
 author = "First Author and The Second Author",
 title = {The Longtitle and not the Shorttitle},
 shorttitle = {Shorttitle},
 publisher = "The Publisher",
 address =  "Address",
 year = "1965"}
@article{Aarticle,
Author = {Article Author},
Journal = {Journal Title},
Pages = {113-126},
Title = {Title of the Article},
Volume = {65},
Year = {1968}}
\end{filecontents*}

\usepackage[style=verbose-note,firstinits=true]{biblatex}

\renewbibmacro*{footcite:note}{%
  \ifnameundef{labelname}
    {\printfield{label}}
    {\printnames[first-last]{labelname}}%
    {\setunit*{\nametitledelim}%
     \printfield[title]{labeltitle}}%
  \setunit*{\space\printtext{(}}%
  \printtext{%
    \bibstring{seenote}\addnbspace
    \ref{cbx@\csuse{cbx@f@\thefield{entrykey}}})%
    \iftoggle{cbx:pageref}
      {\ifsamepage{\the\value{instcount}}
                  {)\csuse{cbx@f@\thefield{entrykey}}}
         {}
     {\addcomma\space\bibstring{page}\addnbspace
      \pageref{cbx@\csuse{cbx@f@\thefield{entrykey}}}}}
      {}}}

\renewcommand{\newunitpunct}{\addcomma\space}
\renewcommand*{\mkbibnamefirst}[1]{{\iffirstinits{\let~\-}{}#1}}

\renewcommand*{\multinamedelim}{~--\space}
\renewcommand*{\finalnamedelim}{~--\space}

\renewbibmacro{in:}{%
  \ifentrytype{article}{}{%
  \printtext{\bibstring{in}\intitlepunct}}}

\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}
\DeclareFieldFormat{pages}{#1}

\AtEveryCitekey{%
  \clearlist{publisher}%
}

\DefineBibliographyStrings{english}{%
  seenote = {cf. nt.},
}

\bibliography{mybib}

\begin{document}

Here and there. \footcite[4]{Abook}

There and here. \footcite[5]{Abook}

Up and down. \footcite{Aarticle}

\end{document}

我第一次尝试采取\ifciteseen以下方式:

\renewcommand*{\postnotedelim}{%
  \ifciteseen 
  {\space}
  {\addcomma\space}}

这不起作用,因为第一次出现也被视为已经看到过(我认为是因为它与另一个嵌套\ifciteseen在里面\newbibmacro*{footcite}

所以我的第二次尝试是:

\newbibmacro*{footcite}{%
  \usebibmacro{cite:citepages}%
  \ifciteseen
    {\renewcommand*{\postnotedelim}{\space}
    {\iffieldundef{shorthand}
       {\usebibmacro{footcite:note}}
       {\usebibmacro{footcite:shorthand}}}}
    {\usebibmacro{footcite:full}%
     \usebibmacro{footcite:save}}}

这解决了部分问题,但又产生了另一个问题:它保留了书第一次出现时的逗号(god),删除了第二次出现时的逗号(god),在脚注编号和引用之间添加了一个空格(bad)。

对于地址和年份之间的逗号以及文章引用中的括号后的逗号,我不知道该如何进行。

那么,有什么建议可以去掉提到的三个逗号,而不触及其他逗号?

答案1

您需要\nopunct针对这两个不同的问题将其插入到适当的位置。

对于年份,这是在 biblatex 宏中issue+date,您可以在最后插入它\newunit

\renewbibmacro{issue+date}{%
  \printtext[parens]{%
    \iffieldundef{issue}
      {\usebibmacro{date}}
      {\printfield{issue}%
       \setunit*{\addspace}%
       \usebibmacro{date}}}%
  \nopunct\newunit}

对于参见注释,它应该是您footnote:cite在右括号后重新定义的一部分。我还建议将左括号移到同一个块中。

将其放入您的代码中,我们得到:

示例输出

\documentclass{scrartcl}
\begin{filecontents*}{mybib.bib}
@BOOK{Abook,
 author = "First Author and The Second Author",
 title = {The Longtitle and not the Shorttitle},
 shorttitle = {Shorttitle},
 publisher = "The Publisher",
 address =  "Address",
 year = "1965"}
@article{Aarticle,
Author = {Article Author},
Journal = {Journal Title},
Pages = {113-126},
Title = {Title of the Article},
Volume = {65},
Year = {1968}}
\end{filecontents*}

\usepackage[style=verbose-note,firstinits=true]{biblatex}

\renewbibmacro*{footcite:note}{%
  \ifnameundef{labelname}
    {\printfield{label}}
    {\printnames[first-last]{labelname}}%
    {\setunit*{\nametitledelim}%
     \printfield[title]{labeltitle}}%
  \setunit*{\space}%
  \printtext{%
  (%
    \bibstring{seenote}\addnbspace
    \ref{cbx@\csuse{cbx@f@\thefield{entrykey}}})\nopunct%
    \iftoggle{cbx:pageref}
      {\ifsamepage{\the\value{instcount}}
                  {)\csuse{cbx@f@\thefield{entrykey}}}
         {}
     {\addcomma\space\bibstring{page}\addnbspace
      \pageref{cbx@\csuse{cbx@f@\thefield{entrykey}}}}}
      {}}}

\renewcommand{\newunitpunct}{\addcomma\space}
\renewcommand*{\mkbibnamefirst}[1]{{\iffirstinits{\let~\-}{}#1}}

\renewcommand*{\multinamedelim}{~--\space}
\renewcommand*{\finalnamedelim}{~--\space}

\renewbibmacro{in:}{%
  \ifentrytype{article}{}{%
  \printtext{\bibstring{in}\intitlepunct}}}

\renewbibmacro{issue+date}{%
  \printtext[parens]{%
    \iffieldundef{issue}
      {\usebibmacro{date}}
      {\printfield{issue}%
       \setunit*{\addspace}%
       \usebibmacro{date}}}%
  \nopunct\newunit}

\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}
\DeclareFieldFormat{pages}{#1}

\AtEveryCitekey{%
  \clearlist{publisher}%
}

\DefineBibliographyStrings{english}{%
  seenote = {cf.~nt.\adddot},
}


\bibliography{mybib}

\begin{document}

Here and there. \footcite[4]{Abook}

There and here. \footcite[5]{Abook}

Up and down. \footcite{Aarticle}

\end{document}

答案2

我通过重写 \renewbibmacro*{footcite} 解决了部分问题(额外的空间):

\renewbibmacro*{footcite}{%
   \usebibmacro{cite:citepages}%
   \ifciteseen%
   {\renewcommand*{\postnotedelim}{\space}\iffieldundef{shorthand}                                 {\usebibmacro{footcite:note}}
    {\usebibmacro{footcite:shorthand}}}
   {\usebibmacro{footcite:full}%
    \usebibmacro{footcite:save}}}

所以剩下要解决的就是文章引用中地址和年份之间以及括号后的逗号。

相关内容