更改 biblatex bibitems 的格式

更改 biblatex bibitems 的格式

Biblatex 格式的工作论文参考文献(有些有数字)后面跟着一个句号。我想把它改成逗号。

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@techreport{johndoe1_techreport,
title = {first report},
author = {Dow, John},
year = {2017},
institution = {Stackoverflow University},
number = {5},
type = {working paper},
}
@techreport{johndoe2_techreport,
title = {second report},
author = {Dow, John},
year = {2017},
institution = {Stackoverflow University},
number = {},
type = {working paper},
}
\end{filecontents}
\usepackage[authordate,backend=biber]{biblatex-chicago}
\addbibresource{\jobname.bib}
\begin{document}
I need a comma after ``5'' in the first reference and one after ``working paper'' in the second.
\textcite{johndoe1_techreport,johndoe2_techreport}
\printbibliography
\end{document}

答案1

这里有一个解决方案,xpatch还有一个技巧:为了避免在没有编号的技术报告中出现虚假空间,请设置number={\unskip}

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@techreport{johndoe1_techreport,
title = {first report},
author = {Dow, John},
year = {2017},
institution = {Stackoverflow University},
number = {5},
type = {working paper},
}
@techreport{johndoe2_techreport,
title = {second report},
author = {Dow, John},
year = {2017},
institution = {Stackoverflow University},
type = {working paper},
number = {\unspace}
}
\end{filecontents}
\usepackage[authordate,backend=biber]{biblatex-chicago}

\usepackage{xpatch}
\xpatchbibdriver{report}{%
\newunit
\printfield{note}%
\newunit\newblock}%
{%
\setunit*{\addcomma\addspace}
\printfield{note}%
\setunit*{\addcomma\addspace}\newblock}{}{}
\addbibresource{\jobname.bib}
\nocite{*}

\begin{document}

I need a comma after ``5'' in the first reference and one after ``working paper'' in the second.

\printbibliography

\end{document} 

在此处输入图片描述

相关内容