2

After a crash course here on biblatex formatting, and reading through the biblatex documentation I am unable to remove an additional space between "in" and the list of editors.

The format requirements are from the International Journal of Productivity and Performance Management.

My guess is that I am missing something painfully obvious. In the example below, I have left out several lines to concentrate on the issue with "in". Any help would be most appreciated!

MWE:

\documentclass[12pt]{article}

\usepackage[
backend=biber,
style=authoryear,
uniquename=false,
dashed=false,
natbib=true,
url=false, 
doi=true,
eprint=false,
giveninits=true,
maxcitenames=2,
maxbibnames=99]{biblatex}

 \begin{filecontents}{\jobname.bib}

@INCOLLECTION{Vo2005,
author = {Vo, Huy V and Poole, Marshall Scott and Courtney, James F},
title = {An empirical comparison of collective causal mapping approaches},
booktitle = {Causal Mapping for Research in Information and Technology},
publisher = {Idea Group Publishing, Hershey, PA},
year = {2005},
editor = {Narayanan, V.K. and Armstrong, D.J.},
pages = {142--173},
address = {Hershey, PA}}

@INCOLLECTION{test2007,
author = {McTesty, Test},
title = {The title of the work},
booktitle = {The name of the collection},
publisher = {The publisher},
year = {2007},
editor = {Editor1, M.G. and Editor2, M.A.},
pages = {142--173},
address = {Hershey, PA}
 }
\end{filecontents}
\addbibresource{\jobname.bib}
\nocite{*}

\renewcommand*{\intitlepunct}{}
% remove 'in:' preceding article title
\renewbibmacro{in:}{% suppresses “In:” …
\iffieldequalstr{entrytype}{incollection}
  {\printtext{in}}
  {}
}

\renewbibmacro*{editorstrg}{%from biblatex.def
\printtext[editortype]{%
\iffieldundef{editortype}
  {\ifboolexpr{
     test {\ifnumgreater{\value{editor}}{1}}
     or
     test {\ifandothers{editor}}
   }
     {\bibcpstring{editors}}%
     {\bibcpstring{editor}}}%
  {\ifbibxstring{\thefield{editortype}}
     {\ifboolexpr{
        test {\ifnumgreater{\value{editor}}{1}}
        or
        test {\ifandothers{editor}}
      }
        {\bibcpstring{\thefield{editortype}s}}%
        {\bibcpstring{\thefield{editortype}}}}%
     {\thefield{editortype}}}}}

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

 %Here is where the trouble begins
 \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}%
\setunit{}\newblock
\newunit\newblock
\usebibmacro{in:} %Here is the source of some of my suffering
\usebibmacro{byeditor+others}
\setunit{\addcomma\addspace}\newblock
\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}
\begingroup
    \setlength\bibitemsep{5pt}
    \printbibliography
\endgroup
\end{document}  

1 Answers1

2

You are missing some % comments which means extra spaces are inserted:

\renewbibmacro{in:}{% suppresses “in:” …
\iffieldequalstr{entrytype}{incollection}
  {\printtext{in}}
  {}% <- add this
}

And another one here. Plus, you shouldn't use \addspace directly as it will possibly mess up punctuation tracking—put it inside a \setunit instead. And neither should you use \mkbibparens directly in a macro. Instead use \printtext[parens]{…}

\renewbibmacro*{byeditor+others}{%from biblatex.def  
\ifnameundef{editor}
{}
{% <- add this
 \printnames[byeditor]{editor}%
 \setunit{\addspace}% <- you should use \setunit here
 \printtext[parens]{\usebibmacro{editorstrg}}% <- change this line
 \clearname{editor}%
 \newunit}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}}

There are problems in the main driver too:

\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}%
\setunit{}\newblock% <- this line is not doing anything, by the way
\newunit\newblock
\usebibmacro{in:}% (remove space before %) Here is the source of some of my suffering
\setunit{\addspace}% <- add this line
\usebibmacro{byeditor+others}
\setunit{\addcomma\addspace}\newblock
\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}}

Also, you have a period after the title, then a lowercase in. Is this what you intend? Looks a bit funny. You could do this:

\renewbibmacro{in:}{% suppresses “in:” …
\iffieldequalstr{entrytype}{incollection}
  {\bibstring{in}}% <- change this line
  {}% <- add this
}

Here's the final image:

enter image description here

David Purton
  • 25,884
  • @ryan-kwan-do, no worries. Check a couple of extra changes I made to my answer. – David Purton Mar 14 '17 at 12:37
  • You can make \iffieldequalstr{entrytype}{incollection} shorter by using \ifentrytype{incollection}. \printtext[parens]{\usebibmacro{editorstrg}} could probably also be done by \DeclareFieldFormat{editortype}{\mkbibparens{#1}}. – moewe Mar 14 '17 at 14:56