0

I am using the Nature citation style. I would like to change the position of the article year and change a little format.

This is my sample code.

\usepackage[backend=biber,bibencoding=utf8,refsegment=chapter,style=nature,firstinits=true,isbn=false,doi=false,url=false,sorting=none,clearlang=true,natbib=true,intitle=true]{biblatex}
\DeclareFieldFormat[article]{citetitle}{#1}
\DeclareFieldFormat[article]{date}{#1;}
\AtEveryBibitem{%
    \ifentrytype{article}{
        \clearfield{url}%
        \clearfield{urldate}%
        \clearfield{review}%
        \clearfield{series}%
        \clearfield{eprint}%
        \clearfield{eprinttype}%
    }{}
}
\DeclareFieldFormat{booktitle}{\textbf{#1}\isdot}
\DeclareFieldFormat{journaltitle}{\textbf{#1}\isdot}

This is a result enter image description here

I would like to move the article year and put it after the journal name without round brackets.

This is my expected result. enter image description here

Please suggest to me.

2

You may want to try the following redefinitions.

\documentclass[american]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber,
  style=nature,
  intitle=true,
  isbn=false, doi=false, url=false, eprint=false,
]{biblatex}

\DeclareFieldFormat[article]{citetitle}{#1}
\DeclareFieldFormat{booktitle}{\textbf{#1}\isdot}
\DeclareFieldFormat{journaltitle}{\textbf{#1}\isdot}

\DeclareFieldFormat*{volume}{#1}

\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\addspace}%
  \iffieldundef{series}
    {}
    {%
      \newunit
      \printfield{series}%
      \setunit{\addspace}%
    }%
  \setunit{\addspace}%
  \printfield{issue}%
  \setunit*{\addspace}%
  \usebibmacro{date}%
  \setunit{\addsemicolon\space}%
  \printfield{volume}%
  \newunit
  \usebibmacro{issue}%
  \newunit
}
\renewbibmacro{issue+date}{}


\addbibresource{biblatex-examples.bib}


\begin{document}
\autocite{sigfridsson,aksin}

\printbibliography
\end{document}

Sigfridsson, E. & Ryde, U. Comparison of methods for deriving atomic charges from the electrostatic potential and moments. Journal of Computational Chemistry 1998; 19, 377–395.


If you want to know which bibmacros or field definitions you need to change, you usually have to have a look at the source of the bibliography style you are using. For @article, the type discussed in the question, nature.bbx has

\DeclareBibliographyDriver{article}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \iftoggle{bbx:articletitle}
    {%
      \usebibmacro{title}%
      \newblock
    }
    {}%
  \printlist{language}%
  \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
  \iftoggle{bbx:isbn}
    {\printfield{issn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \setunit{\addspace}\newblock
  \usebibmacro{issue+date}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}%
}

Some guessing and a bit of trial and error shows that the bibmacro journal+issuetitle prints the journal title and volume, number information. note+pages prints the pages and issue+date the date.

So step one is to redefine issue+date to do nothing. The second step is to insert code to print the date after the journal title. To do that we redefine journal+issuetitle, which is originally defined in nature.bbx as

\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\addspace}%
  \iffieldundef{series}
    {}
    {%
      \newunit
      \printfield{series}%
      \setunit{\addspace}%
    }%
  \printfield{volume}%
  \newunit
  \usebibmacro{issue}%
  \newunit
}

You'll notice that the code we added to journal+issuetitle is a simplified version of nature.bbx's issue+date

\renewbibmacro*{issue+date}{%
  \iffieldundef{year}
    {}
    {%
      \iffieldundef{issue}
        {\printtext[parens]{\usebibmacro{date}}}
        {%
          \printtext[parens]{%
            \printfield{issue}%
            \setunit*{\addspace}%
            \usebibmacro{date}%
          }%
        }%
    }%
  \newunit  
}

The bottom line is: If you want to know which macros you need to redefine, check the implementation in the .bbx and .cbx files and chase down the bibmacro definitions.

4
  • Thank you, it's work. Could you please explain your code? I tried to use \renewbibmacro but I have no clue to do that. Why did you use "\renewbibmacro*{journal+issuetitle}"? where can I get the document for this command? – Pisit Nakjai Sep 27 '20 at 8:19
  • @PisitNakjai I added some explanations. Things like this can usually only be found out by reading the style source code. The documentation will usually not discuss this (as that would make things much too verbose.) – moewe Sep 28 '20 at 6:16
  • Thank you very much. – Pisit Nakjai Sep 28 '20 at 7:10
  • @PisitNakjai, you should express your gratitude by upvoting of answer and even accept it. – Zarko Oct 28 '20 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.