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}
\begin{document}
Here is one sentence.\cite{Knuth:ct-a}
Here is another sentence.\cite{noauthor_solcell_2020}
\printbibliography
\end{document}
And the .bib file code:
@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:
How do I make it print out the journaltitle/titleaddon instead of the title when there is no author?
Edit:
Here is the full code modified to use harvard referencing instead of the default:
\usepackage{csquotes}
\usepackage[backend=biber,style=authoryear-icomp,sorting=nyc,isbn=false,doi=true,dashed=false,maxbibnames=99,uniquename=init,giveninits]{biblatex}
\addbibresource{references.bib}
\DeclareFieldFormat[article]{title}{#1}
\renewbibmacro{in:}{}
\renewcommand*{\finalnamedelim}{\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}\addspace\&\space}
\DefineBibliographyStrings{swedish}{andothers={et\addabbrvspace al\adddot}}
\newcommand{\mkbibnodate}{u\adddot å\adddot}
\AtEveryCitekey{\iffieldundef{year}{\restorefield{labelyear}{\mkbibnodate}}{}}
\DeclareFieldFormat{urldate}{\mkbibbrackets{#1}}
\NewBibliographyString{available}
\DefineBibliographyStrings{swedish}{available={Tillgänglig}}
\DeclareFieldFormat{url}{\bibstring{available}\addcolon\space\url{#1}}
\DeclareFieldFormat[article]{volume}{vol. #1}
\renewbibmacro*{volume+number+eid}{\setunit{\addcomma\space}\printfield{volume}\setunit*{\addnbspace}\printfield{number}\setunit{\addcomma\space}\printfield{eid}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}
\DeclareFieldFormat[article]{pages}{ss. #1 \adddot}
\DeclareNameAlias{sortname}{family-given}
\renewcommand*{\bibfont}{\footnotesize}
\DeclareSortingTemplate{nyc}{\sort{\field{presort}}\sort[final]{\field{sortkey}}\sort{\field{sortname}\field{author}\field{editor}\field{translator}\field{journaltitle}\field{sorttitle}\field{title}}\sort{\field{sortyear}\field{year}}\sort{\citeorder}}
Can I implement some code which creates a titleaddon or label or another author from the url which it defaults to when there is no author? Since all url have www.websitename.xxx, is there some commands to make everything except what's between the two dots disappear? And is there some way to redefine author if no author is provided?
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?
Thanks in advance! /Alexander
