4

I tried to put the date in parenthesis and the result ist quite weird. I just want to have the year in this form: (2005) and instead (. 2005) is printed.

\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}`

and my test.bbx-file

% $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

and my test.cbx-file

% $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

Anyone a clue, please?

6
  • 1
    See §4.11.7.2 of the biblatex manual. Unit punctuation is not handled synchronously. There's an example almost identical to yours there.
    – Alan Munn
    Jun 29, 2013 at 0:31
  • 1
    okay it's working. i just had to replace \renewbibmacro*{date}{\mkbibparens{\printdate}} by \DeclareFieldFormat{parens}{\mkbibparens{#1}} and \renewbibmacro*{date}{\printtext[parens]{\printdate}} in test.bbx Thank you very much Alan!
    – ingo
    Jun 29, 2013 at 1:31
  • 1
    Since you solved your own problem (I just pointed you to the right place) you should turn your comment into an actual answer. You'll have to wait a day or so before you accept it (which you should, by clicking on the checkmark beside the answer).
    – Alan Munn
    Jun 29, 2013 at 1:36
  • ok, i'll do it.
    – ingo
    Jun 29, 2013 at 2:04
  • 3
    Ah now I understand this portal. There are questions, comments, answers and patient Alans:-) Now it should be okay.
    – ingo
    Jun 29, 2013 at 3:32

2 Answers 2

4

Unfortunately, as a guest I can't comment on the solution posted above. But I'd like to note that this solution will cause the 'mergedate=basic' option to stop working as expected. Using this instead:

\DeclareFieldFormat{parens}{\mkbibparens{#1}}
\renewbibmacro*{date}{%
\iffieldundef{month}
{}
{\printtext[parens]{\printdate}}}%

when using 'mergedate=basic' will be fine. For any other option one should take a look at authoryear.bbx file and adopt the according lines of code.

1
  • 1
    Needless to say that DeclareFieldFormat{parens}{\mkbibparens{#1}} is only ever necessary if you do not load a biblatex standard style (or one not based on biblatex.def). So with normal authoryear styles that line can be dropped, as it exactly corresponds to the definition in biblatex.def.
    – moewe
    Aug 25, 2015 at 9:54
2

The Solution:

Replace

\renewbibmacro*{date}{\mkbibparens{\printdate}}

by

\DeclareFieldFormat{parens}{\mkbibparens{#1}}
\renewbibmacro*{date}{\printtext[parens]{\printdate}}

and this is the new test.bbx-file:

`% $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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .