0

Here is the existing document code:

\documentclass[12pt, final, a4paper]{article}

\usepackage[backend=biber,style=authoryear-icomp,sorting=nyt,isbn=false,doi=true,dashed=false,maxbibnames=99,uniquename=init,giveninits]{biblatex}
\addbibresource{referenser.bib}
\DeclareLabeltitle{%
\field{titleaddon}
\field{shorttitle}
\field{title}
\field{maintitle}
}

\begin{document}
Here is one sentence.\parencite{Knuth:ct-a}

Here is another sentence.\parencite{noauthor_solcell_2020}
\printbibliography
\end{document}

And the .bib file:

@Book{Knuth:ct-a,
author =       "Donald E. Knuth",
title =        "The {\TeX}book",
publisher =    "Addison-Wesley",
year =         "1986",
volume =       "A",
series =       "Computers and Typesetting",
pages =        "ix + 483",
}

@online{noauthor_solcell_2020,
titleaddon = {Nationalencyklopedin},
title = {solcell},
url = {https://www.ne.se/uppslagsverk/encyklopedi/l%C3%A5ng/solcell},
urldate = {2020-04-13},
date = {2020}
}

As of now it prints out:

enter image description here

How do I make it print out Nationalencyklopedin in the reference list instead of the title solcell when there are no authors?

I used the \DeclareLabletitle to make Nationalencyklopedin print instead of the title in the text. Is there some similar way to change the reference list as well?

As I do not fully understand what is happening in the code above could you show where it is safe to put these changes in my code for it to work?

moewe
  • 175,683
Alexander
  • 11
  • 2

1 Answers1

1

As I wrote in my answer to Why is biblatex defaulting to using title instead of author when no author is provided and how do I change it to using journaltitle instead? it is perfectly fine to "upgrade" corporate authors like Nationalencyklopedin to the author of your @online entry.

\documentclass[12pt, final, a4paper]{article}

\usepackage[backend=biber, style=authoryear-icomp,
  maxbibnames=99, uniquename=init, giveninits,
  dashed=false,
  isbn=false, doi=true,]{biblatex}

\begin{filecontents}{\jobname.bib}
@book{Knuth:ct-a,
  author    = {Donald E. Knuth},
  title     = {The {\TeX}book},
  publisher = {Addison-Wesley},
  year      = {1986},
  volume    = {A},
  maintitle = {Computers and Typesetting},
  pagetotal = {ix + 483},
}
@online{noauthor_solcell_2020,
  author     = {Nationalencyklopedin},
  title      = {solcell},
  url        = {https://www.ne.se/uppslagsverk/encyklopedi/l%C3%A5ng/solcell},
  urldate    = {2020-04-13},
  date       = {2020},
}
\end{filecontents}
\addbibresource{\jobname.bib}


\begin{document}
Here is one sentence. \autocite{Knuth:ct-a}

Here is another sentence. \autocite{noauthor_solcell_2020}
\printbibliography
\end{document}

Nationalencyklopedin (2020). solcell. url: https://www.ne.se/uppslagsverk/encyklopedi/l%C3%A5ng/solcell (visited on 04/13/2020).

I can understand that it may not feel quite right to put Nationalencyklopedin down as an editor, but it certainly gives the best results here.

In theory you could also use the label field that serves as a fallback in case no author, editor or translator is given.

@online{noauthor_solcell_2020,
  label     = {Nationalencyklopedin},
  title     = {solcell},
  url       = {https://www.ne.se/uppslagsverk/encyklopedi/l%C3%A5ng/solcell},
  urldate   = {2020-04-13},
  date      = {2020},
}

The disadvantage of the label field is that Biber can not perform uniqueness calculations with label and so you may end up with two identical labels for different entries if you cite two Nationalencyklopedins articles from 2020. So I can't really recommend label here.

moewe
  • 175,683