我尝试将日期放在括号中,结果很奇怪。我只想以这种形式显示年份:(2005),但打印出来的却是 (. 2005)。
\begin{filecontents*}{test.bib}
@ARTICLE{Andreasen2005,
author = {Nancy C Andreasen and William T Carpenter and John M Kane and Robert
A Lasser and Stephen R Marder and Daniel R Weinberger},
title = {Remission in schizophrenia: proposed criteria and rationale for consensus.},
journal = {Am J Psychiatry},
year = {2005},
volume = {162},
pages = {441--449},
number = {3},
month = {3}
}
\end{filecontents*}
\documentclass[
12pt,
DIV10,
ngerman,
a4paper,
]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[
bibstyle=test, citestyle=test
]{biblatex}
\bibliography{test.bib}
\begin{document}
\cite{Andreasen2005}
\printbibliography
\end{document}`
和我的 test.bbx 文件
% $Id: test.bbx,v 0.1 2013/06/28 19:09:07 lehman unstable $
\ProvidesFile{test.bbx}
[\abx@bbxid $Id: test.bbx,v 0.1 2013/06/28 19:09:07 lehman unstable $]
\newbibmacro*{begentry}{}
\newbibmacro*{finentry}{\finentry}
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{bytranslator+others}%
\newunit\newblock
\printfield{version}%
\newunit\newblock
\usebibmacro{journal+issuetitle}%
\newunit
\usebibmacro{byeditor+others}%
\newunit
\usebibmacro{note+pages}%
\newunit\newblock
\usebibmacro{date}
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\usebibmacro{finentry}}
\newbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addspace}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\usebibmacro{volume}%
\setunit{\addspace}%
\usebibmacro{issue}%
\setunit{\addcolon\space}%
\newunit}
\newbibmacro*{volume}{%
\printfield{volume}%
\setunit*{\adddot}%
}
\newbibmacro*{issue}{%
\iffieldundef{issue}
{}
{\printtext[parens]{%
{\printfield{issue}%
\setunit*{\addspace}}}%
\newunit}}
\newbibmacro*{series+number}{%
\printfield{series}%
\setunit*{\addspace}%
\printfield{number}%
\newunit}
\newbibmacro*{note+pages}{%
\printfield{note}%
\setunit{\bibpagespunct}%
\printfield{pages}%
\newunit}
\renewbibmacro*{date}{\mkbibparens{\printdate}}
\endinput
和我的 test.cbx 文件
% $Id: test.cbx,v 1.7 2011/11/13 19:09:07 lehman stable $
\ProvidesFile{test.cbx}
[\abx@cbxid $Id: verbose-inote.cbx,v 1.7 2011/11/13 19:09:07 lehman stable $]
\providebool{bbx:subentry}
\DeclareFieldFormat{entrysetcount}{\mknumalph{#1}}
\newbibmacro*{cite}{%
\printtext[bibhyperref]{%
\printfield{prefixnumber}%
\printfield{labelnumber}%
\ifbool{bbx:subentry}
{\printfield{entrysetcount}}
{}}}
\DeclareCiteCommand{\cite}[\mkbibbrackets]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{postnote}}
\AtEveryBibitem{\clearfield{month}}
\endinput
有人能提供线索吗?
答案1
不幸的是,作为客人,我无法对上面发布的解决方案发表评论。但我想指出的是,此解决方案将导致“mergedate=basic”选项停止按预期工作。改用此方法:
\DeclareFieldFormat{parens}{\mkbibparens{#1}}
\renewbibmacro*{date}{%
\iffieldundef{month}
{}
{\printtext[parens]{\printdate}}}%
使用“mergedate=basic”就可以了。对于任何其他选项,应查看 authoryear.bbx 文件并采用相应的代码行。
答案2
解决方案:
代替
\renewbibmacro*{date}{\mkbibparens{\printdate}}
经过
\DeclareFieldFormat{parens}{\mkbibparens{#1}}
\renewbibmacro*{date}{\printtext[parens]{\printdate}}
这是新的 test.bbx 文件:
`% $Id: test.bbx,v 0.1 2013/06/28 19:09:07 lehman unstable $
\ProvidesFile{test.bbx}
[\abx@bbxid $Id: test.bbx,v 0.1 2013/06/28 19:09:07 lehman unstable $]
\newbibmacro*{begentry}{}
\newbibmacro*{finentry}{\finentry}
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{bytranslator+others}%
\newunit\newblock
\printfield{version}%
\newunit\newblock
\usebibmacro{journal+issuetitle}%
\newunit
\usebibmacro{byeditor+others}%
\newunit
\usebibmacro{note+pages}%
\newunit\newblock
\usebibmacro{date}
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\usebibmacro{finentry}}
\newbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addspace}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\usebibmacro{volume}%
\setunit{\addspace}%
\usebibmacro{issue}%
\setunit{\addcolon\space}%
\newunit}
\newbibmacro*{volume}{%
\printfield{volume}%
\setunit*{\adddot}%
}
\newbibmacro*{issue}{%
\iffieldundef{issue}
{}
{\printtext[parens]{%
{\printfield{issue}%
\setunit*{\addspace}}}%
\newunit}}
\newbibmacro*{series+number}{%
\printfield{series}%
\setunit*{\addspace}%
\printfield{number}%
\newunit}
\newbibmacro*{note+pages}{%
\printfield{note}%
\setunit{\bibpagespunct}%
\printfield{pages}%
\newunit}
\DeclareFieldFormat{parens}{\mkbibparens{#1}}
\renewbibmacro*{date}{\printtext[parens]{\printdate}}
\endinput