1

I have my bibliography almost exactly as I want it, with one exception: I'd like the year to come after the journal title, separated by a comma, no parentheses. Right now, the issue number and year are in parentheses together. Also, the colon comes after the volume instead of after the issue, as I would like it. (I can't manually move the number from the "issue" field to the "number" field in hundreds of Bibtex entries, as suggested in another answer).

So, instead of this:enter image description here

I'd like this:enter image description here

Here's my MWE

\documentclass{scrreprt}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}

\usepackage[
backend=biber,
style=numeric-comp,
giveninits=true,
maxbibnames=2,
%citestyle=nature,
sorting=none,
isbn=false,
doi=false
]{biblatex}

\DeclareNameAlias{sortname}{family-given/given-family}
\DeclareNameAlias{author}{sortname}
\DeclareNameAlias{editor}{sortname}
\DeclareNameAlias{translator}{sortname} % 1st author as lastname, comma, firstname-initials, 2nd author as firstname-initials lastname

\DeclareNameWrapperFormat{sortname}{\mkbibbold{#1}}
\DeclareNameWrapperAlias{author}{sortname}
\DeclareNameWrapperAlias{editor}{sortname}
\DeclareNameWrapperAlias{translator}{sortname} %names bold

\AtEveryBibitem{\clearfield{month}} %month not printed
\AtEveryBibitem{\clearfield{day}} %day not printed
\AtEveryBibitem{\clearfield{note}} %notes not printed

\DeclareFieldFormat*{title}{#1} %no quotation marks

\DeclareDelimFormat[biblist,bib]{nametitledelim}{\addcomma\space} %comma after names

\renewrobustcmd*{\bibinitdelim}{\,} %thinspace between name initials

\renewbibmacro{in:}{%
    \ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}} %supresses "In:" before journal titles

\DeclareFieldFormat{titlecase}{#1} %Journal titles capitalized as given (not sentence case)

\DeclareFieldFormat[article, inbook, incollection, inproceedings, misc, thesis, unpublished]
{number}{\mkbibparens{#1}} %number/issue between brackets

\DeclareFieldFormat[article, inproceedings, incollection, inbook]
{pages}{p. #1} %single p. instead of pp.

\renewbibmacro*{volume+number+eid}{
    \printfield{volume}
    \printfield{number}
    \printunit{\addcolon}} %format 16(4):224--225 for articles


%year after journal title

%no parentheses around date

\addbibresource{test.bib}

\usepackage{filecontents}

\begin{filecontents}{test.bib}
@Article{Brem2002,
    author          = {Brem, Rachel B and Yvert, Gaël and Clinton, Rebecca and Kruglyak, Leonid},
    title           = {Genetic dissection of transcriptional regulation in budding yeast.},
    journal         = {Science},
    year            = {2002},
    volume          = {296},
    pages           = {752--755},
    month           = apr,
    issue           = {5568},
}

@Article{Yvert2003,
    author          = {Yvert, Gaël and Brem, Rachel B and Whittle, Jacqueline and Akey, Joshua M and Foss, Eric and Smith, Erin N and Mackelprang, Rachel and Kruglyak, Leonid},
    title           = {Trans-acting regulatory variation in Saccharomyces cerevisiae and the role of transcription factors.},
    journal         = {Nat. Genet.},
    year            = {2003},
    volume          = {35},
    pages           = {57--64},
    month           = sep,
    issue           = {1},
}

\end{filecontents}  

\begin{document}

    I'm citing \cite{Brem2002} and \cite{Yvert2003}.

    \printbibliography

\end{document}  
  • Please note that the code as shown is not a fully compilable example document. It is missing \end{document} and actual body contents (a few example citations and \printbibliography, presumably). The question is also missing relevant example entries from refs.bib. If the exact contents of your bib entries are not relevant, you can use the file biblatex-examples.bib that is available on all systems with biblatex. – moewe Aug 17 at 19:51
  • Sorry about that, I fixed it. – Anne Morbach Aug 18 at 13:23
2

The following redefinitions for journal+issuetitle and volume+number+eid are copied from the code for biblatex-ext. That's why they contain a few customisable macros.

Instead of using \clearfield to suppress month and days in the date, it should be simpler to just say date=year, in the load-time options.

\documentclass{article}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}

\usepackage[
  backend=biber,
  style=numeric-comp,
  sorting=none,
  maxbibnames=2,
  giveninits=true,
  date=year,
  isbn=false,
  doi=false,
]{biblatex}

\DeclareNameAlias{sortname}{family-given/given-family}
\DeclareNameAlias{author}{sortname}
\DeclareNameAlias{editor}{sortname}
\DeclareNameAlias{translator}{sortname}

\DeclareNameWrapperFormat{sortname}{\mkbibbold{#1}}
\DeclareNameWrapperAlias{author}{sortname}
\DeclareNameWrapperAlias{editor}{sortname}
\DeclareNameWrapperAlias{translator}{sortname}

\renewrobustcmd*{\bibinitdelim}{\,}

\DeclareDelimFormat[biblist,bib]{nametitledelim}{\addcomma\space}

\DeclareFieldFormat*{title}{#1}

\renewbibmacro{in:}{%
  \ifentrytype{article}
    {}
    {\printtext{\bibstring{in}\intitlepunct}}}

\newcommand*{\volnumdelim}{\adddot}
\renewbibmacro*{volume+number+eid}{%
  \printfield{volume}%
  \setunit*{\volnumdelim}%
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}

\renewcommand*{\volnumdelim}{}
\DeclareFieldFormat[article, periodical]{number}{\mkbibparens{#1}}

\newcommand*{\jourdatedelim}{\addcomma\space}
\newcommand*{\jourserdelim}{\addcomma\space}
\newcommand*{\datevolnumdelim}{\newunitpunct}

\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\jourdatedelim}%
  \iffieldundef{series}
    {}
    {\setunit*{\jourserdelim}%
     \printfield{series}%
     \setunit{\jourdatedelim}}%
  \usebibmacro{date}%
  \setunit{\datevolnumdelim}%
  \usebibmacro{volume+number+eid}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \newunit}

\renewcommand*{\bibpagespunct}{%
  \ifentrytype{article}
    {\addcolon}
    {\addcomma}%
  \space
}

\DefineBibliographyStrings{english}{
  pages = {p\adddot},
}

\addbibresource{biblatex-examples.bib}

\begin{document}
\autocite{sigfridsson}
\printbibliography
\end{document}

Sigfridsson, E. and U. Ryde, Comparison of methods for deriving atomic charges from the electrostatic potential and moments. Journal of Computational Chemistry, 1998. 19(4): p. 377–395.

Since your .bib file uses issue where number would be more appropriate you can fix this on the fly with a Biber source map: biblatex - issue number of journal in date.

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.