Well, there are quite some modifications to be done here.
To change the translation of "and others" from "med flere" to "et al.", we define.
\DefineBibliographyStrings{norsk}{%
andothers = {et\addabbrvspace al\adddot},
andmore = {et\addabbrvspace al\adddot},
}
You can find a list of all the bibstrings (the localisation kyes) in the biblatex
documentation in §4.9.2 Localization Keys. For more on this topic, §4.9 Localization Modules is worth a read.
To change the last name delimiter from "og" ("and") to "&", we redefine
\renewcommand*{\finalnamedelim}{%
%\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% there really should be no funny Oxford comma business here
\addspace\&\space}
Note that the second line that normally deals with Oxford commas is uncommented here, but that does not concern Norwegian as that does not use the Oxford comma anyway.
Now, over to @inbook
and @incollection
.
First, the easy part, to get rid of the colon after "I:" ("In:"), define
\renewcommand*{\intitlepunct}{\space}
This will get rid of the colon for all entry types, however; if you prefer to keep it for all the other entry types (Why would you want to do that? It would be pretty pretty inconsistent.), try
\newbibmacro*{in:}{%
\printtext{%
\bibstring{in}%
\ifboolexpr{test {\ifentrytype{inbook}} or test {\ifentrytype{incollection}}}
{\addspace}%
{\intitlepunct}}}
The biggest problem is reordering the output. One could copy and paste the whole driver to the document and modify it, but since you use xpatch
anyway, why not use that?
% This gets rid of page numbers, don't worry they will be re-added later
\xpatchbibdriver{inbook}
{\newunit\newblock
\usebibmacro{chapter+pages}}
{}
{}
{}
\xpatchbibdriver{incollection}
{\newunit\newblock
\usebibmacro{chapter+pages}}
{}
{}
{}
\xpatchbibdriver{incollection}
{\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
}
{\renewbibmacro*{date+extrayear}{}%
\usebibmacro{editor+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\ifboolexpr{not (test {\iffieldundef{chapter}} and test {\iffieldundef{pages}})}
{\nopunct\printtext[parens]{\usebibmacro{chapter+pages}}}%
{}%
\newunit\newblock
}%
{}
{\typeout{failed to replace \usebibmacro{byeditor+others} by \usebibmacro{editor+others} in BibliographyDriver{incollection}}}%
\xpatchbibdriver{inbook}
{\usebibmacro{bybookauthor}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
}
{\renewbibmacro*{date+extrayear}{}%
\usebibmacro{editor+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\ifboolexpr{not (test {\iffieldundef{chapter}} and test {\iffieldundef{pages}})}
{\nopunct\printtext[parens]{\usebibmacro{chapter+pages}}}%
{}%
}%
{}
{\typeout{failed to replace \usebibmacro{byeditor+others} by \usebibmacro{editor+others} in BibliographyDriver{inbook}}}%
We move the editor macro before the title, but use the editor
not byeditor
macros.
To get the string "editor" in parentheses and to get rid of the comma preceding it, use
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\xpatchbibmacro{bbx:editor}%
{\setunit{\addcomma\space}%
}
{\setunit{\addspace}%
}
{}
{\typeout{failed to patch bibmacro{bbx:editor}}}
The quite long and not so M WE
\documentclass[norsk,12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{lmodern}
\usepackage[style=authoryear-comp, firstinits=true, backend=biber, maxcitenames=3, citetracker=true, maxbibnames=99, dashed=false,texencoding=ascii]{biblatex}
\DeclareNameAlias{sortname}{last-first}
\renewcommand*{\nameyeardelim}{\addcomma\space}
\addbibresource{biblatex-examples.bib}
\usepackage{breakurl}
\DefineBibliographyStrings{norsk}{%
andothers = {et\addabbrvspace al\adddot},
andmore = {et\addabbrvspace al\adddot},
}
%from http://tex.stackexchange.com/questions/48846/biblatex-et-al-beginning-from-second-citation
\usepackage{xpatch}
\AtEveryCitekey{\ifciteseen{}{\clearfield{namehash}}}
\xpatchbibmacro{cite}
{\printnames{labelname}}
{\ifciteseen
{\printnames{labelname}}
{\printnames[][1-999]{labelname}}}
{}
{}
\xpatchbibmacro{textcite}
{\printnames{labelname}}
{\ifciteseen
{\printnames{labelname}}
{\printnames[][1-999]{labelname}}}
{}
{}
\renewcommand*{\finalnamedelim}{%
%\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% there really should be no funny Oxford comma business here
\addspace\&\space}
%\renewcommand*{\intitlepunct}{\space}
\newbibmacro*{in:}{%
\printtext{%
\bibstring{in}%
\ifboolexpr{test {\ifentrytype{inbook}} or test {\ifentrytype{incollection}}}
{\addspace}%
{\intitlepunct}}}
\xpatchbibdriver{inbook}
{\newunit\newblock
\usebibmacro{chapter+pages}}
{}
{}
{}
\xpatchbibdriver{incollection}
{\newunit\newblock
\usebibmacro{chapter+pages}}
{}
{}
{}
\xpatchbibdriver{incollection}
{\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
}
{\renewbibmacro*{date+extrayear}{}%
\usebibmacro{editor+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\ifboolexpr{not (test {\iffieldundef{chapter}} and test {\iffieldundef{pages}})}
{\nopunct\printtext[parens]{\usebibmacro{chapter+pages}}}%
{}%
\newunit\newblock
}%
{}
{\typeout{failed to replace \usebibmacro{byeditor+others} by \usebibmacro{editor+others} in BibliographyDriver{incollection}}}%
\xpatchbibdriver{inbook}
{\usebibmacro{bybookauthor}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
}
{\renewbibmacro*{date+extrayear}{}%
\usebibmacro{byeditor+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\ifboolexpr{not (test {\iffieldundef{chapter}} and test {\iffieldundef{pages}})}
{\nopunct\printtext[parens]{\usebibmacro{chapter+pages}}}%
{}%
}%
{}
{\typeout{failed to replace \usebibmacro{byeditor+others} by \usebibmacro{editor+others} in BibliographyDriver{inbook}}}%
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\xpatchbibmacro{bbx:editor}%
{\setunit{\addcomma\space}%
}
{\setunit{\addspace}%
}
{}
{\typeout{failed to patch bibmacro{bbx:editor}}}
\begin{document}
\cite{aksin} again \cite{aksin}.
\nocite{wilde,kant:kpv,hyman,pines,baez/article}
\printbibliography[title=Kilder]
\end{document}
yields
Summary of my changes :
Issue 1a. - Various editor format
Formatting of editors is off, the \DeclareNameAlias[collection, incollection]{editor}{given-family:plain} has no effect.
moewe comments was that "\DeclareNameAlias can only accept one value in the optional argument, it doesn't do several comma-separated values. So you need two lines \DeclareNameAlias[collection]{editor}{given-family:plain} \DeclareNameAlias[incollection]{editor}{given-family:plain}."
Change made
Replace the lines
\DeclareNameAlias[collection]{author}{given-family:plain}
\DeclareNameAlias[collection, incollection]{editor}{given-family:plain}
by
\DeclareNameAlias[collection]{author}{given-family:plain}
\DeclareNameAlias[collection]{editor}{given-family:plain}
\DeclareNameAlias[incollection]{editor}{given-family:plain}
Issue 1b. - Formatting title
formatting of the title in the incollection is also off.
moewe comments was that "[f]or the title you want \DeclareFieldFormat[incollection]{title}{#1}. The starred \DeclareFieldFormat*{title} turns all titles into italics, a following \DeclareFieldFormat[incollection]{title}` will then change the formatting for @incollection"
Change made
Replace the line
\DeclareFieldFormat*{title}{\mkbibemph{#1}}
by
\DeclareFieldFormat*{title}{\mkbibemph{#1}}
\DeclareFieldFormat[incollection]{title}{#1}
Issue 1c. - Correction of spacing (missing some %)
There are some funny spacing in front of the collection/incollection entries
moewe comments was that "[t]he unwanted spaces comes again from forgotten %s you need \DeclareBibliographyDriver{collection}{% and \DeclareBibliographyDriver{incollection}{% (i.e. you have to add a % after the {)"
Change made
Replace the line
\DeclareBibliographyDriver{collection}{
by
\DeclareBibliographyDriver{collection}{%
and
Replace the line
\DeclareBibliographyDriver{incollection}{
by
\DeclareBibliographyDriver{incollection}{%
Issue 1d. - Formating of (edit.)
The label "(edit.)" is missing
This issue was caused by two sources : (1) The current ShareLatex version is 3.7. Biblatex v3.8 offers more cutomization (2) My lbx was wrongly formatted and missing some field redefinition. Hence the change
Change made
- Setting the format in .bbx file.
this code was then inserted in the bbx file.
% set delimiter of editor-type to a space (instead of ", ")
\DeclareDelimFormat{editortypedelim}{\addspace}
% add parenthesis around the label of editortype
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
- Workaround for v3.7 code (not needed in recent version)
The spacing was not working, but this is due to my version biblatex being outdated. Hence, I've simply copied the latest version of the code.
% Workaround, due to v3.7, solved in v3.8+ %
% Need to copy the current biblatex 3.11 macro %
\renewbibmacro*{editor}{%
\ifboolexpr{
test \ifuseeditor
and
not test {\ifnameundef{editor}}
}
{\printnames{editor}%
\setunit{\printdelim{editortypedelim}}%
\usebibmacro{editorstrg}%
\clearname{editor}}
{}}
- Changing the lbx code with the custom "edit"
in order to work, my lbx code needs a better formatting, as per Moewe comments. The code hereafter change the default "editor(s)" entry type with my updated version.
\DeclareBibliographyStrings{%
inherit = {french},
editor = {{\'editeur}{\'edit\adddot}},
editors = {{\'editeurs}{\'edit\adddot}},
}
Best Answer
NB you will need to run Biber (
backend=biber
) for what follows.Second things first: You do not have to retype all the information from the
@collection
for the@incollection
, if you use Biber's awesomecrossref
field.Farrer1965Christian
will automatically inherit all the needed fields in the right meaning, i.e.Gibb1965Light
'stitle
will becomeFarrer1965Christian
'sbooktitle
.For the clickable hyperlink to the
booktitle
, try the following modification. It should work for all standard styles, but I'm not to sure about others.This links to the
crossref
entry if it is not empty. Note that in some situations this might go wrong (suppose thecrossref
'd entry did not supply thebooktitle
).An MWE