如何在 \parencite 上省略年份后的点并在作者后添加逗号

如何在 \parencite 上省略年份后的点并在作者后添加逗号

当我\parencite写东西时,我希望省略年份后的点,并在作者后添加逗号。以下命令已在我的序言中:

\renewcommand*{\postnotedelim}{\addcolon\space} % add colon after year on \parencite
\DeclareFieldFormat{postnote}{#1} %no page prefix when citing
\DeclareFieldFormat{multipostnote}{#1} %no page prefix when citing

这将显示我引用的来源为

(作者 1975.:49)

但我希望它们显示为

(作者,1975:49)


平均能量损失

\documentclass{article}
\usepackage[serbian]{babel}

\usepackage[backend=biber, style=authoryear]{biblatex}

\renewcommand*{\postnotedelim}{\addcolon\space}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \parencite[42]{sigfridsson}
\end{document}

答案1

serbian.lbx\adddot在年份后面加上并\mkbibdateshort关联宏。您可以通过重新定义 中的宏来删除这些点\DefineBibliographyExtras{serbian}

您可以在作者后添加逗号\renewcommand*{\nameyeardelim}{\addcomma\space}

\documentclass[serbian]{article}

\usepackage[T1]{fontenc}
\usepackage[serbian]{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear]{biblatex}

\DefineBibliographyExtras{serbian}{%
  \renewcommand*\mkbibordinal[1]{\stripzeros{#1}}
  \renewcommand*\mkbibdateshort[3]{%
    \iffieldundef{#3}{}{\mkbibordinal{\thefield{#3}}%
      \iffieldundef{#2}{}{\addnbspace}}%
    \iffieldundef{#2}{}{\mkbibordinal{\thefield{#2}}%
      \iffieldundef{#1}{}{\addnbspace}}%
    \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}%
    {\dateeraprintpre{#1}\mkyearzeros{\thefield{#1}}}}%
  \renewcommand*\mkbibseasondateshort[2]{%
    \mkbibseason{\thefield{#2}}%
    \iffieldundef{#1}{}{\space}%
    \dateeraprintpre{#1}\mkyearzeros{\thefield{#1}}}%
    \renewcommand*\mkbibseasondatelong[2]{%
    \mkbibseason{\thefield{#2}}%
    \iffieldundef{#1}{}{\space}%
    \dateeraprintpre{#1}\mkyearzeros{\thefield{#1}}}%
}

\renewcommand*{\postnotedelim}{\addcolon\space} % add colon after year on \parencite
\renewcommand*{\nameyeardelim}{\addcomma\space}
\DeclareFieldFormat{postnote}{#1} %no page prefix when citing
\DeclareFieldFormat{multipostnote}{#1} %no page prefix when citing


\begin{filecontents}{\jobname.bib}
@book{elk,
  author    = {Anne Elk},
  title     = {A Theory on Brontosauruses},
  year      = {1972},
  publisher = {Monthy \& Co.},
  location  = {London},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \parencite[380]{sigfridsson}
ipsum \parencite[42]{elk}

\printbibliography
\end{document}

这似乎产生了所需的输出,但可能会产生副作用并破坏其他地方的情况。

在此处输入图片描述

相关内容