如何在 \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}

這似乎會產生所需的輸出,但可能會產生副作用並破壞其他地方的東西。

在此輸入影像描述

相關內容