Regarding the change from "ed. by" to "(ed.). This has changed since the accepted answer was posted. This gets very messy but here is what I gathered so far. BTW, I highly recommend placing this stuff in your home directory and never changing anything that is installed. The location for these files is ~/texmf/tex/latex/biblatex.
The overall goal is to replace the string that biblatex uses "ed. by" to whatever you want. Then that text is placed after the editor(s) and put into parentheses. Sounds easy right? Here is the TLDR; version.
You need to place this in your preamble to get the (ed.) to come after the editors. The \renewcommand*{\intitlepunct}{\space} bit will replace the in: with just in .
\renewcommand*{\intitlepunct}{\space}
\renewbibmacro*{byeditor+others}{%
\ifnameundef{editor}
{}
{%\setunit{\addspace}%
\printnames[byeditor]{editor}%
\clearname{editor}%
\setunit{\addspace}%
\usebibmacro{byeditor+othersstrg}%
\newunit}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}}
\DefineBibliographyStrings{english}{%
byeditor = {ed\adddot}
}
Also change the driver for incollection to the following. I believe that this is the exact format the OP is after but this is fairly trivial to change. (in this case authoryear-comp.bbx located but called standard.bbx)
\DeclareBibliographyDriver{incollection}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{in:}%
\usebibmacro{byeditor+others}%
\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
The TL version is below but this is exactly what is happening and why the answer is actually much simpler than almost everything else I have found on the internet so far. This is the first website hit for 'biblatex change "ed. by"' so it gets my answer.
First we need to figure out what is happening when the references are generated. I use the style "authoryear-comp" which has an associated bbx (style used in the references section) and cbx (style used in the text section). I need to change 'ed. by' to (ed.) in the reference section. That means an edit to authoryear-comp.bbx. But there is nothing except an import of the standard.bbx file, so we go there instead. As it turns out my reference is a chapter edited in a book which apparently is the type incollection. Still no idea why. Doesn't matter either. Search standard.bbx for
\DeclareBibliographyDriver{incollection}{%
This is where you will change the output format of the references. If you carefully look at it though, there isn't an obvious location for where I can change "ed. by" but here is some block of code which looks promising:
\usebibmacro{byeditor+others}%
\newunit\newblock
Now all I have to do is find where byeditor+others is defined and edit that macro to get the desired output. This macro (like almost all widely used macros) is found in the file biblatex.def which has this block of code:
\newbibmacro*{byeditor+others}{%
\ifnameundef{editor}
{}
{\usebibmacro{byeditor+othersstrg}%
\setunit{\addspace}%
\printnames[byeditor]{editor}%
\clearname{editor}%
\newunit}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}}
which upon careful inspection really just calls byeditor+othersstrg when the editor field is defined (it is, otherwise why would I bother writing all of this?).
Searching for byeditor+othersstrg yeilds the following:
\newbibmacro*{byeditor+othersstrg}{%
\iffieldundef{editortype}
{\def\abx@tempa{byeditor}}
{\edef\abx@tempa{by\thefield{editortype}}}%
\let\abx@tempb=\empty
\ifnamesequal{editor}{translator}
{\appto\abx@tempa{tr}%
\appto\abx@tempb{\clearname{translator}}}
{}%
\ifnamesequal{editor}{commentator}
{\appto\abx@tempa{co}%
\appto\abx@tempb{\clearname{commentator}}}
{\ifnamesequal{editor}{annotator}
{\appto\abx@tempa{an}%
\appto\abx@tempb{\clearname{annotator}}}
{}}%
\ifnamesequal{editor}{introduction}
{\appto\abx@tempa{in}%
\appto\abx@tempb{\clearname{introduction}}}
{\ifnamesequal{editor}{foreword}
{\appto\abx@tempa{fo}%
\appto\abx@tempb{\clearname{foreword}}}
{\ifnamesequal{editor}{afterword}
{\appto\abx@tempa{af}%
\appto\abx@tempb{\clearname{afterword}}}
{}}}%
\ifbibxstring{\abx@tempa}
{\printtext{\bibstring{\abx@tempa}}\abx@tempb}
{\usebibmacro{bytypestrg}{editor}{editor}}}
which if you are unfamiliar with latex scripting and are not well versed in coding will look like a giant wall of useless text. BTW, as a professional programer, the fact that none of this is documented in code is frustrating to say the least. As a test to see what is going on I changed the second to last line from
\printtext{\bibstring{\abx@tempa}}\abx@tempb
to
\printtext[bold]{\bibstring{\abx@tempa}}\abx@tempb
which only made bold the "ed. by". So the string which is outputting "ed. by" can only be \bibstring{\abx@tempa}. Now, as is turns out on page 202 of the manual (I am sure we all have time to read through the several hundred + pages of excellent documentation, and it is fantastic but exceptionally long) we find that bibstring is defined as \bibstring[wrapper]{key}. That means that \abx@tempa is somehow a string, and it is. For me, the field "editortype" is not defined which means that the variable \abx@tempa becomes \def\abx@tempa{byeditor} or in normal words:
\abx@tempa = "byeditor"
Do not be fooled by the macro called the same thing. I believe this is deprecated code but I have no justification for thinking so. This means that somewhere, somehow \abx@tempa is essentially a dictionary value and the resulting string is "ed. by" which is returned by \bibstring.
Here is the magic. This string is defined within the local file *.lbx. This is where all local strings are defined based on language. With my rather lax phrasing, it should be obvious that I am american so I go to the american.lbx to see that really it just calls english.lbx. searching for byeditor leads me to line 240 which reads:
byeditor = {{edited by}{ed\adddotspace by}},
byeditor is also described on page 204 of the biblatex manual. The manual goes on to explain that all of these values are set by \DeclareBibliographyStrings which is what needs to be overridden. Now, thanks to Where can I put biblatex style modifications? I can tell you that byeditor can be redefined within your preamble. This leads me to the answer posted above the TLDR marker. Place this block of code in your preable.
\DefineBibliographyStrings{english}{%
byeditor = {ed\adddot}
}
Thankfully, \adddot does exactly what you think it does. Do not add the trailing space and do not use \adddotspace. I think the space is removed by formatting or already taken into account within the biblatex framework.
This will get you "ed." instead of "ed. by". The rest is easy. Just print the text using the parens environment but this is done within the biblatex.def so if you want to put this in the preamble, the command would have to be renewed. This is in the block of code in the TLDR version.
{\printtext[parens]{\bibstring{\abx@tempa}}\abx@tempb}
And I want to put it after the editors, the byeditor+others should also be redefined so it prints out in (ed.)
This is the old macro
\newbibmacro*{byeditor+others}{%
\ifnameundef{editor}
{}
{\usebibmacro{byeditor+othersstrg}%
\setunit{\addspace}%
\printnames[byeditor]{editor}%
\clearname{editor}%
\newunit}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}}
This is the new macro:
\newbibmacro*{byeditor+others}{%
\ifnameundef{editor}
{}
{%\setunit{\addspace}%
\printnames[byeditor]{editor}%
\clearname{editor}%
\setunit{\addspace}%
\usebibmacro{byeditor+othersstrg}%
\newunit}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}}
The driver also requires an update as described above. This will rearrange the output format to place the in (ed.) in the correct order as specified by the OP.
@inbook
,@incollection
and@inproceedings
.