对于我的公司,我正在调整biblatex
风格archaeologie
。一切都很好,除了一件事:
标准内联/脚注引用样式是作者年份没有括号。但对于未发表的作品,我需要在字段输出周围加上括号pubstate
——既用于文内引用,也用于参考书目内。
对于参考书目,这很容易建立,使用DeclareFieldFormat
,但我无法让它与文内引用一起工作。我搜索了cbx
和bbx
文件,以及非常详细的文档。据我所知,我需要重新定义\printlabeldateextra
bibmacro cite:labeldate+extradate
,但到目前为止无法正确定义。
我仍然觉得我错过了一些非常明显的东西......
我的 MWE:
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{xpatch}
\usepackage{filecontents}
\usepackage[%
backend=biber,
style=archaeologie,
]{biblatex}
\renewcommand{\finentrypunct}{\adddot}
\begin{filecontents*}[overwrite]{testbib.bib}
@Article{testentry,
author = {Guy, Some},
journal = {Some Journal},
title = {A Title},
pubstate = {submitted},
}
@article{testentry2,
author = {Doubtfire, Mrs.},
journal = {Another Journal},
title = {What a title?},
year = {2000},
}
\end{filecontents*}
\addbibresource{testbib.bib}
\DeclareFieldFormat{pubstate}{\ifbibstring{#1}{\bibstring[\mkbibparens]{#1}}{\mkbibparens{#1}}}
\begin{document}
\cite{testentry}
\cite{testentry2}
\printbibliography
\end{document}
在参考书目中,(已提交)正确用括号括起来。在文本中它仍然是家伙提交, 但是我需要盖伊(已提交)当然,其他引文应该打印不带括号的年份,就像在 MWE 中一样。
答案1
labeldate
如果labeldate
来自,您可以修改字段格式以打印括号pubstate
。
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[%
backend=biber,
style=archaeologie,
]{biblatex}
\renewcommand{\finentrypunct}{\adddot}
\DeclareFieldFormat{labeldate}{%
\iffieldequalstr{labeldatesource}{pubstate}
{\mkbibparens{#1}}
{#1}}
\DeclareFieldFormat{pubstate}{%
\mkbibparens{%
\ifbibstring{#1}
{\bibstring{#1}}
{#1}}}
\begin{filecontents*}{\jobname.bib}
@article{testentry,
author = {Guy, Some},
journal = {Some Journal},
title = {A Title},
pubstate = {submitted},
}
@article{testentry2,
author = {Doubtfire, Mrs.},
journal = {Another Journal},
title = {What a title?},
year = {2000},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\cite{testentry}
\cite{testentry2}
\printbibliography
\end{document}