BibTeX, biblatex and biberbiblatex | Bibliography not printing correctly

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
Ross Ahmed
Posts: 15
Joined: Mon Dec 17, 2012 8:56 pm

biblatex | Bibliography not printing correctly

Post by Ross Ahmed »

I'm using biblatex to print my bibliography. Using the attached .bib file and .tex file, the bibliography is currently printing as in attached screenshot.

How can I get the bibliography to print as follows:
Andersson, S. 1999. Morphology....
Armenta, J.K., Dunn, P.O. & Whittingham, L.A. 2008. Effects.....

My bib file is as follows:

Code: Select all

@ARTICLE{AnderssonS1999,
  author = {Andersson, S.},
  title = {Morphology of UV reflectance in a whistling-thrush: implications
    for the study of structural colour signalling in birds},
  journal = {Journal of Avian Biology},
  year = {1999},
  volume = {30:},
  pages = {193-204}
}

@ARTICLE{armenta2008,
  author = {Armenta, J.K. and Dunn, P.O. and Whittingham, L.A.},
  title = {{Effects of specimen age on plumage color}},
  journal = {The Auk},
  year = {2008},
  volume = {125:},
  pages = {803--808},
  file = {:Users/rossahmed/Library/Application Support/Mendeley Desktop/Downloaded/Armenta, Dunn, Whittin\textit{g\textit{}}ham - 2008 - Effects of specimen age on plumage color.pdf:pdf},
  publisher = {BioOne},
  url = {http://www.bioone.org/doi/abs/10.1525/auk.2008.07006}
}
My .tex file is as follows:

Code: Select all

\documentclass{article}
\usepackage[firstinits=true,style=authoryear,natbib=true,doi=false,isbn=false,url=false,uniquename=false,uniquelist=false,sorting=none, maxcitenames=2]{biblatex}

\renewcommand*{\nameyeardelim}{\addspace} % remove comma inline citations

\renewcommand*{\finalnamedelim}{\addspace\&\space} % delimits authors inline citations with &

\renewcommand*{\multicitedelim}{\addcomma\space} % seperate multi authors by comma

\addbibresource{test.bib}
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{#1\iSDot}

\renewbibmacro{in:}{%
  \ifentrytype{article}{}{%
  \printtext{\bibstring{in}\intitlepunct}}}
  
\makeatletter
\ifcsundef{abx@macro@\detokenize{date+extrayear}}{%
  }{%
  \renewbibmacro*{date+extrayear}{%
    \iffieldundef{year}{%
      }{%
      \addperiod\space
      \printtext{\printdateextra}%
    }%
  }%
}
\makeatother

\DeclareFieldFormat[article]{pages}{#1}
\DeclareNameFormat[article,periodical,book,electronic]{author}{\mkbibbold{#1}}

\begin{document}

\title{test}
\author{test}
\date{}
\maketitle

some text \parencite{AnderssonS1999} and more text \parencite{armenta2008}

\printbibliography

\end{document}
Attachments
tex.jpg
tex.jpg (20.46 KiB) Viewed 5450 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

biblatex | Bibliography not printing correctly

Post by cgnieder »

The problem is your definition of the name format for author:

Code: Select all

\DeclareNameFormat[article,periodical,book,electronic]{author}{\mkbibbold{#1}}
The biblatex manual says about \DeclareNameFormat:
Defines the name list format format . This formatting directive is arbitrary code to be
executed for every name in a list processed by \printnames. If an entrytype is specified, the format is specific to that type. The entrytype argument may be a comma-separated list of values. The individual parts of a name will be passed to the code as separate arguments. These arguments are as follows:
  • #1 The last names. If a name consists of a single part only (for example, ‘Aristotle’), this part will be treated as the last name.
  • #2 The last names, given as initials.
  • #3 The first names. This argument also includes all middle names.
  • #4 The first names, given as initials.
  • #5 The name prefixes, for example von, van, of, da, de, del, della, etc. Note that name prefixes are referred to as the ‘von part’ of the name in the BibTeX file format documentation.
  • #6 The name prefixes, given as initials.
  • #7 The name affixes, for example ‘junior’, ‘senior’, ‘der Jüngere’, ‘der Ältere’, etc. Note that name affixes are referred to as the ‘junior part’ of the name in the BibTeX file format documentation.
  • #8 The name affixes, given as initials.
Maybe something like this (I merged the two parts of your MWE into one). Since I don't know the command \iSDot but biblatex provides \isdot I changed the former into the latter.

Code: Select all

\documentclass{article}
\usepackage[
  firstinits   = true ,
  style        = authoryear ,
  natbib       = true ,
  doi          = false ,
  isbn         = false ,
  url          = false ,
  uniquename   = false ,
  uniquelist   = false ,
  sorting      = none ,
  maxcitenames = 2
]{biblatex}

% remove comma inline citations
\renewcommand*{\nameyeardelim}{\addspace}

% delimits authors inline citations with &
\renewcommand*{\finalnamedelim}{\addspace\&\space}

% seperate multi authors by comma
\renewcommand*{\multicitedelim}{\addcomma\space}

% keep the example self-contained and let it create the bib file on the fly:
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTICLE{AnderssonS1999,
  author = {Andersson, S.},
  title = {Morphology of UV reflectance in a whistling-thrush: implications
for the study of structural colour signalling in birds},
  journal = {Journal of Avian Biology},
  year = {1999},
  volume = {30:},
  pages = {193-204}
}
@ARTICLE{armenta2008,
  author = {Armenta, J.K. and Dunn, P.O. and Whittingham, L.A.},
  title = {{Effects of specimen age on plumage color}},
  journal = {The Auk},
  year = {2008},
  volume = {125:},
  pages = {803--808},
  file = {:Users/rossahmed/Library/Application Support/Mendeley Desktop/Downloaded/Armenta, Dunn, Whittin\textit{g\textit{}}ham - 2008 - Effects of specimen age on plumage color.pdf:pdf},
  publisher = {BioOne},
  url = {http://www.bioone.org/doi/abs/10.1525/auk.2008.07006}
}
\end{filecontents}

\addbibresource{\jobname.bib}
\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{#1\isdot}

\renewbibmacro{in:}{%
  \ifentrytype{article}{}{%
  \printtext{\bibstring{in}\intitlepunct}}}
 
\makeatletter
\ifcsundef{abx@macro@\detokenize{date+extrayear}}{%
  }{%
    \renewbibmacro*{date+extrayear}{%
    \iffieldundef{year}{%
      }{%
        \addperiod\space
         \printtext{\printdateextra}%
      }%
    }%
  }
\makeatother

\DeclareFieldFormat[article]{pages}{#1}
\DeclareNameFormat[article,periodical,book,electronic]{author}{%
  \mkbibbold{#5\addspace#1\addcomma\addspace#4}}


\begin{document}

\title{test}
\author{test}
\date{}
\maketitle

some text \parencite{AnderssonS1999} and more text \parencite{armenta2008}

\printbibliography

\end{document}
biblatex.png
biblatex.png (33.49 KiB) Viewed 5444 times
Regards
site moderator & package author
Ross Ahmed
Posts: 15
Joined: Mon Dec 17, 2012 8:56 pm

Re: biblatex | Bibliography not printing correctly

Post by Ross Ahmed »

Many thanks, problem solved.
Post Reply