I need to change the command \parencite
for a specific case but I have absolutely no clue how to rewrite ist. Could anyone help me?
What I have as a database entry is this:
@online{ref1,
author = {{A Company}},
title = "Page Title",
year = "no date",
url = {https://url.xy},
urldate = "2017-10-14"
}
If I now use \parencite
, I will get
Some text (A Company, no date).
But what I need is
Some text (A Company, online).
So basically, I need to overwrite \parencite for the following criteria:
- IF the db entry is @online AND IF there is "no date" specified in 'year', PRINT (author, online).
- IF there are several entries of the same author and declared with @online without a date, PRINT (author (a), online).
- In every other case, use the APA-Citation style as before
- No impacts on bibliography!
MWE:
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage[style=apa]{biblatex}
\usepackage{csquotes}
\DeclareLanguageMapping{ngerman}{ngerman-apa}
\addbibresource{references.bib}
\NewBibliographyString{from}
\NewBibliographyString{retrieved}
\DefineBibliographyStrings{ngerman}{
retrieved = {Abgerufen am},
from = {von},
nodate = {{}},
}
\DeclareFieldFormat[online]{title}{\mkbibemph{#1}}
\begin{filecontents}{\sample.bib}
@online{ref1,
author = {{A Company}},
title = "Title",
year = "no date",
url = {https://url.xy},
urldate = "2017-11-15"
}
@online{ref2,
author = {{A Company}},
title = "Page Title",
year = "no date",
url = {https://url.xy},
urldate = "2017-10-14"
}
\end{filecontents}
\begin{document}
There is some text \parencite{ref1} and some other \parencite{ref2}.
\printbibliography
\end{document}
\usepackage[ngerman]{babel}
(ngerman
withn
instead ofgerman
). With recent versions ofbiblatex
andbiblatex-apa
\DeclareLanguageMapping{ngerman}{ngerman-apa}
is not needed any more and it does nothing in your example since the document usesgerman
and notngerman
. The same holds for\DefineBibliographyStrings{ngerman}
.german
. None of the settings forngerman
are picked up and you will get possibly incorrect (read: old orthography) hyphenation and string translations.nswissgerman
for new orthography andswissgerman
for old.