6

I need my footnotes and bibliography entries look a certain way. I am almost there but I have a problem with how the editor of an edited book / incollection looks like. Currently, it looks like this in the footnote:

Brian Smith, ‘How to do it’ in Big Book of Knowledge, ed. by Tony Riley (Oxford: Oxford University Press, 2012), pp. 12–34.

and this in the bibliography:

Smith, Brian, ‘How to do it’ in Big Book of Knowledge, ed. by Tony Riley (Oxford: Oxford University Press, 2012), pp. 12–34.

What I need it to read is:

Smith, Brian, ‘How to do it’ in Tony Riley (ed.), Big Book of Knowledge (Oxford: Oxford University Press, 2012), pp. 12–34.

So how do I adapt the verbose-style that it reads "... Tony Riley (ed.)" instead of "ed. by Tony Riley"?

Additionally, that the editor comes after "in", i.e. before the title of the book. ("in Tony Riley (ed.), The Big Book of Knowledge" instead of "in The Big Book of Knowledge, ed. by Tony Riley")?

PS: This is my little example:

\documentclass[paper=a4,fontsize=12pt]{scrartcl}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{Smith2012,
    Address = {Oxford},
    Author = {Brian Smith},
    Booktitle = {Big Book of Knowledge},
    Editor = {Tony Riley},
    Pages = {12-34},
    Publisher = {Oxford University Press},
    Title = {How to do it},
    Year = {2012}}
\end{filecontents}

\usepackage[style=verbose-trad3, 
natbib=true,
sortcites=true, 
block=space, 
isbn=false, 
url=false, 
doi=false, 
dashed=false, 
dateabbrev=false,
backend=biber,
bibencoding=utf8,
]{biblatex}

\renewcommand{\footcite}{\cite}
\usepackage[ngerman,british]{babel}
\usepackage[applemac]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[style=english,english=british]{csquotes}


\renewcommand*{\cite}{\autocite}
\renewcommand*{\newunitpunct}{\addcomma\space}


\usepackage{biblatex}
\renewbibmacro{in:}{%
\ifentrytype{article}{space}{%
\nopunct
\printtext{\bibstring{in}\nopunct\addspace}}}



\renewbibmacro*{publisher+location+date}{%
\nopunct% ADDED
\printtext[parens]{% ADDED
\printlist{location}%
\iflistundef{publisher}
{\setunit*{\addcomma\space}}
{\setunit*{\addcolon\space}}%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\usebibmacro{date}%
}
\newunit}

\addbibresource{\jobname.bib}

\begin{document}
This is an example sentence.\cite{Smith2012}

\printbibliography

\end{document}
1
  • 1
    This question addresses (among other things) changes in the editor string format and print order for @inbook, @incollection and @inproceedings.
    – Audrey
    Commented Jul 19, 2012 at 13:38

2 Answers 2

2

First, compiling your document I get an error:

! Package biblatex Error: 'backend' is load-time only option.

You should move backend=biber, bibencoding=utf8, to the package options.

To swap the appearance of editor and booktitle, you have to alter the definitions of incollection, inbook, etc. This shouldn't be too hard, you'll find them in the file biblatex.def.

Then you need to redefine the bibmacro byeditor+others to get something like "John Doe (ed.)". The following code, redefining bibmacro byeditor+others, works for your example, though you might run in some problems with other editortypes:

\documentclass[paper=a4,fontsize=12pt]{scrartcl}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{Smith2012,
    Address = {Oxford},
    Author = {Brian Smith},
    Booktitle = {Big Book of Knowledge},
    Editor = {Tony Riley},
    Pages = {12-34},
    Publisher = {Oxford University Press},
    Title = {How to do it},
    Year = {2012}}
\end{filecontents}

\usepackage[style=verbose-trad3, 
natbib=true,
sortcites=true, 
block=space, 
isbn=false, 
url=false, 
doi=false, 
dashed=false, 
dateabbrev=false,
backend=biber,
bibencoding=utf8,
]{biblatex}

\renewcommand{\footcite}{\cite}
\usepackage[ngerman,british]{babel}
\usepackage[applemac]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[style=english,english=british]{csquotes}

\renewcommand*{\cite}{\autocite}
\renewcommand*{\newunitpunct}{\addcomma\space}

\usepackage{biblatex}
\renewbibmacro{in:}{%
\ifentrytype{article}{space}{%
\nopunct
\printtext{\bibstring{in}\nopunct\addspace}}}

\renewbibmacro*{publisher+location+date}{%
\nopunct% ADDED
\printtext[parens]{% ADDED
\printlist{location}%
\iflistundef{publisher}
{\setunit*{\addcomma\space}}
{\setunit*{\addcolon\space}}%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\usebibmacro{date}%
}
\newunit}

\renewbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
    {}
    {\ifnamesequal{author}{editor}
      {\bibnamedash}
      {\printnames{editor}}%
     \addspace
     \mkbibparens{\usebibmacro{editorstrg}}%
     \clearname{editor}}
    {}}

\addbibresource{\jobname.bib}

\begin{document}
This is an example sentence.\cite{Smith2012}

\printbibliography

\end{document}
0
2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .