12

For a stylesheet I am following, I need to move the names of the editors of a book before the book title. In biblatex, the default behavior is to print Ed. by followed by the names. A similar question has been asked before (Citing @inbook with biblatex: how to put authors/editors before book title?), but the only answer given differs in many respects from what I need, and I don't know how to modify it to suit my needs here.

In the MWE, the printed result is:

Lennon, John (1965). This is my article in this book. In A book with articles. Ed. by Paul McCartney, John Lennon, George Harrison & Richard Starkey. Liverpool: Cavern Club. 65-87.

Whereas I need it to be:

Lennon, John (1965). This is my article in this book. In Paul McCartney, John Lennon, George Harrison & Richard Starkey (Eds.), A book with articles. Liverpool: Cavern Club. 65-87.

Notice the uppercase E in Eds. (which should be Ed. in the case of a single editor) and the comma following it.

\documentclass{article}
\usepackage[style = authoryear-comp, maxnames = 99]{biblatex}

\renewcommand*{\finalnamedelim}{\addspace\&\space} % use '&' before last author in citations and bibliography
\renewcommand*{\intitlepunct}{\space} % remove colon after "In:" for articles in books
\DeclareFieldFormat[article, incollection, unpublished]{pages}{#1} % no word 'pages' for articles in the bibliography (print as is)
\DeclareFieldFormat[article, incollection, unpublished]{title}{#1} % no quotes for article titles (print as is)
\renewcommand{\bibpagespunct}{\ifentrytype{article}{\addcolon}{\addperiod\addspace}} % colon between volume and page ranges for journal articles, period plus space for articles in books

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{lennon1965,
    AUTHOR = "John Lennon",
    BOOKTITLE = "A book with articles",
    EDITOR = "Paul McCartney and John Lennon and George Harrison and Richard Starkey",
    TITLE = "This is my article in this book",
    YEAR = "1965",
    LOCATION = "Liverpool",
    PAGES = "65--87",
    PUBLISHER = "Cavern Club"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

enter image description here

11
+500

Shameless plug: The styles of the biblatex-ext bundle have a slightly more sophisticated version of this implemented as an option. Load ext-<standardstyle>, e.g. ext-authoryear-comp and set the option innamebeforetitle to true.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber,
  style=ext-authoryear, innamebeforetitle=true]{biblatex}

\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimFormat{editortypedelim}{\addspace}

\DeclareFieldAlias{translatortype}{editortype}
\DeclareDelimAlias{translatortypedelim}{editortypedelim}

\addbibresource{biblatex-examples.bib}

\begin{document}
\cite{sigfridsson,gaonkar:in,westfahl:space,vizedom:related}
\printbibliography
\end{document}

Gaonkar, Dilip Parameshwar (2001). ‘On Alternative Modernities’. In: Dilip Parameshwar Gaonkar (ed.). Alternative Modernities. Durham and London: Duke University Press, pp. 1–23. isbn: 0-822-32714-7.//Sigfridsson, Emma and Ulf Ryde (1998). ‘Comparison of methods for deriving atomic charges from the electrostatic potential and moments’. In: Journal of Computational Chemistry 19.4, pp. 377–395. doi: 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P.//Vizedom, Monika B. and Gabrielle L. Caffee (trans.) (1960). The Rites of Passage. University of Chicago Press. Trans. of Arnold van Gennep. Les rites de passage. Paris: Nourry, 1909.//Westfahl, Gary (2000). ‘The True Frontier. Confronting and Avoiding the Realities of Space in American Science Fiction Films’. In: Gary Westfahl (ed.). Space and Beyond. The Frontier Theme in Science Fiction. Westport, Conn. and London: Greenwood, pp. 55–65.

This is really where biblatex is not that flexible.

We can use xpatch to patch the drivers for @inbook, @incollection and @inproceedings

\xpatchbibdriver{inbook}
  {\usebibmacro{in:}%
   \usebibmacro{bybookauthor}%
   \newunit\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {\usebibmacro{in:}%
   \usebibmacro{bybookauthor}%
   \newunit\newblock
   \usebibmacro{byeditor:in}%
   \newunit\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {}{}

\xpatchbibdriver{incollection}
  {\usebibmacro{in:}%
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {\usebibmacro{in:}%
   \usebibmacro{byeditor:in}%
   \setunit{\labelnamepunct}\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor}}
  {}{}

\xpatchbibdriver{inproceedings}
  {\usebibmacro{in:}%
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{event+venue+date}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {\usebibmacro{in:}%
   \usebibmacro{byeditor:in}%
   \setunit{\labelnamepunct}\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{event+venue+date}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {}{}

We also redefine byeditor:in

\newbibmacro*{byeditor:in}{%
  \ifnameundef{editor}
    {}
    {\printnames[editorin]{editor}%
     \addspace\bibsentence%
     \mkbibparens{\usebibmacro{editorstrg}}%
     \clearname{editor}%
     \printunit{\addcomma\space}}}

and a new name format

\DeclareNameAlias{editorin}{first-last}

MWE

\documentclass{article}
\usepackage{xpatch}
\usepackage[style = authoryear-comp, maxnames = 99]{biblatex}

\renewcommand*{\finalnamedelim}{\addspace\&\space}
\renewcommand*{\intitlepunct}{\space}
\DeclareFieldFormat[article, incollection, unpublished]{pages}{#1}
\DeclareFieldFormat[article, incollection, unpublished]{title}{#1}
\renewcommand{\bibpagespunct}{\ifentrytype{article}{\addcolon}{\addperiod\addspace}}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@incollection{lennon1965,
  author    = {John Lennon},
  booktitle = {A book with articles},
  editor    = {Paul McCartney and John Lennon and George Harrison and Richard Starkey},
  title     = {This is my article in this book},
  year      = {1965},
  location  = {Liverpool},
  pages     = {65--87},
  publisher = {Cavern Club},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\DeclareNameAlias{editorin}{first-last}

\newbibmacro*{byeditor:in}{%
  \ifnameundef{editor}
    {}
    {\printnames[editorin]{editor}%
     \addspace\bibsentence%
     \mkbibparens{\usebibmacro{editorstrg}}%
     \clearname{editor}%
     \printunit{\addcomma\space}}}

\xpatchbibdriver{inbook}
  {\usebibmacro{in:}%
   \usebibmacro{bybookauthor}%
   \newunit\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {\usebibmacro{in:}%
   \usebibmacro{bybookauthor}%
   \newunit\newblock
   \usebibmacro{byeditor:in}%
   \newunit\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {}{}

\xpatchbibdriver{incollection}
  {\usebibmacro{in:}%
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {\usebibmacro{in:}%
   \usebibmacro{byeditor:in}%
   \setunit{\labelnamepunct}\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor}}
  {}{}

\xpatchbibdriver{inproceedings}
  {\usebibmacro{in:}%
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{event+venue+date}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {\usebibmacro{in:}%
   \usebibmacro{byeditor:in}%
   \setunit{\labelnamepunct}\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{event+venue+date}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {}{}



\begin{document}
\nocite{*}
\printbibliography
\end{document}

enter image description here

  • As with Guido's example, your example flips the order of the names of the first editor from first-last to last-first. Can that be avoided? Also, the abbreviation for editor (Eds.) should be in parentheses with an uppercase E. And there should be a comma following it, i.e. (Eds.),. – Sverre Apr 27 '14 at 13:20
  • @Sverre Sure! Have a look at the edit. I'm afraid doing things like this are somewhat hard to achieve in biblatex, it might warrant a new style. – moewe Apr 27 '14 at 13:25
  • And what about (Eds.), instead of (eds.).? :) – Sverre Apr 27 '14 at 13:31
  • 1
    @Sverre Try again (I have re-edited the answer). – moewe Apr 27 '14 at 13:47
  • 1
    @svenper editortypedelim and editortype are indeed what you are looking for, but maybe you also want to change translatortypedelim and translatortype. As far as I am concerned those are not hacks, but the intended interface. – moewe Jun 29 '18 at 4:54
4

Guidos way, or - without another package, but with a lot of more code lines - you can change the bibliography-driver for @incollection from standard.bbx, to display the data in your wanted order; change the byeditor+others-macro from biblatex.def to put parencites around the editor data; and change the editorstrg from biblatex.def to use the capitalized version \bibcpstring instead of \bibstring.

\documentclass{article}
\usepackage[style = authoryear-comp, maxnames = 99]{biblatex}

\renewcommand*{\finalnamedelim}{\addspace\&\space} % use '&' before last author in citations and bibliography
\renewcommand*{\intitlepunct}{\space} % remove colon after "In:" for articles in books
\DeclareFieldFormat[article, incollection, unpublished]{pages}{#1} % no word 'pages' for articles in the bibliography (print as is)
\DeclareFieldFormat[article, incollection, unpublished]{title}{#1} % no quotes for article titles (print as is)
\renewcommand{\bibpagespunct}{\ifentrytype{article}{\addcolon}{\addperiod\addspace}} % colon between volume and page ranges for journal articles, period plus space for articles in books

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{lennon1965,
    AUTHOR = "John Lennon",
    BOOKTITLE = "A book with articles",
    EDITOR = "Paul McCartney and John Lennon and George Harrison and Richard Starkey",
    TITLE = "This is my article in this book",
    YEAR = "1965",
    LOCATION = "Liverpool",
    PAGES = "65--87",
    PUBLISHER = "Cavern Club"}
\end{filecontents}
\addbibresource{\jobname.bib}
\renewbibmacro*{editorstrg}{%from biblatex.def
  \printtext[editortype]{%
    \iffieldundef{editortype}
      {\ifboolexpr{
         test {\ifnumgreater{\value{editor}}{1}}
         or
         test {\ifandothers{editor}}
       }
         {\bibcpstring{editors}}%changed
         {\bibcpstring{editor}}}%changed
      {\ifbibxstring{\thefield{editortype}}
         {\ifboolexpr{
            test {\ifnumgreater{\value{editor}}{1}}
            or
            test {\ifandothers{editor}}
          }
            {\bibcpstring{\thefield{editortype}s}}%changed
            {\bibcpstring{\thefield{editortype}}}}%changed
         {\thefield{editortype}}}}}


\renewbibmacro*{byeditor+others}{%from biblatex.def
  \ifnameundef{editor}
    {}
    {\printnames[byeditor]{editor}%
     \addspace%added
     \mkbibparens{\usebibmacro{editorstrg}}%added
     \clearname{editor}%
     \newunit}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}}

\DeclareBibliographyDriver{incollection}{%from standard.bbx
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%changed
  \usebibmacro{byeditor+others}%changed
  \setunit{\addcomma\addspace}\newblock%changed
  \usebibmacro{maintitle+booktitle}%
  \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
  \usebibmacro{chapter+pages}%
  \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}}

\begin{document}
\nocite{*}
\printbibliography
\end{document}



Output:

Output

3

EDIT fixed the issue of multi-volume (with maintitle) and single editor.

A possibility is to abuse the biblatex in: macro to to format and print the information as desired.

\xpatchbibmacro{editorstrg}{\bibstring}{\bibcpstring}{}{}
\xpatchbibmacro{editorstrg}{\bibstring}{\bibcpstring}{}{}

\renewbibmacro*{in:}{
  \ifentrytype{incollection}{%
  \DeclareNameAlias{editor}{first-last}
  \printtext{In}
  \ifnameundef{editor}
    {}
    {\printnames{editor}%
     \addspace 
     \mkbibparens{\usebibmacro{editorstrg}}
     \setunit{\addcomma\addspace}% 
    }%
  \usebibmacro{maintitle+booktitle}
  \clearfield{maintitle}
  \clearfield{booktitle}
  \clearfield{volume}
  \clearfield{part}
  \clearname{editor}
  }
  {}%
}

In this case the "simple" in: contains the directives to print the editors and the book title.

The tricks are: (1) use a guard, \ifentrytype{incollection}, to restrict the modification to the specific entrytype; (2) delete the content of the fields booktitle and editor, thus they are no longer a available in the rest of directive in the driver for incollection, and (3) define a new directive to switch last name and first name for the editors: this can be specifying that editor is an "alias" for the predefined name format first-last, i.e., \DeclareNameAlias{editor}{first-last}.

Notice that the excellent and convenient xpatch package (i.e., include \usepackage{xpatch}) is used to modify how the biblatex string editor(s) is printed. Notice that we need to patch it twice one: the first for the plural version, and the second for the singular case (only one editor).

Here is the outcome:

enter image description here

  • In your example, the order of the names of the first editor is flipped from first-last to last-first. – Sverre Apr 27 '14 at 12:01
  • I overlooked that issue. I just changed it. – Guido Apr 27 '14 at 23:52
  • 1
    When there is only one editor, your code will print (ed.), instead of (Ed.), (i.e. it should have a capital E). – Sverre Sep 3 '14 at 11:28
  • Also, I've noticed that because of the way booktitle is included here, the code will print the title of a volume (i.e. booktitle) immediately after (Eds.),. But this is where the main title should be ... – Sverre Sep 3 '14 at 11:57
  • @Sverre fixed the issues. – Guido Sep 3 '14 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.