4

I am using biblatex with the biber backend and the chem-acs style. For journals and inproceedings, the author list is printed followed by the title; however, for books and book chapters, there is a comma after the last author. I'd like to get rid of that extra comma.

For an MWE, please see below.

So far, I read some solutions to similar questions. Both remove comma after the last author and Need to remove comma after last author (only) seem to work on manually created .bst files, and I would like to use the chem-acs style.

In the question Colon (:) instead of period (.) after author with biblatex, alphabetic, a quite nice solution is given by

\renewcommand{\labelnamepunct}{\addcolon\space}

However, it seems that this only applies to journals and not to my "problematic" book types.

One solution seems to be to complete redefine the bibliograpy driver for book, but I'd like to circumvent that, because I only want to remove a single comma.

I had a look into the chem-acs.bbx file, and found the following definition:

\DeclareBibliographyDriver{book}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
(...)
}

I noticed that if I comment out the line \setunit{\labelnamepunct}\newblock, the comma stays. So I think it is defined somewhere inside the bibmacro for author/translator+others. However, I have no clue how to redefine that macro in a reasonable fashion, and to my best knowledge it is also not possible to redefine it only for types other than journal.

Here the MWE:

.tex file:

\documentclass{standalone}

\usepackage[style=chem-acs,articletitle,chaptertitle,backend=biber]{biblatex}
\addbibresource{mwe.bib}

\begin{document}

  Some journals: \cite{Agrafiotis2000,Agrafiotis2003}
  A book, chapter, and inproceeding: \cite{Ozgur2005,Alpaydin2010,Joachims1999}

  \printbibliography

\end{document}

.bib file:

@INPROCEEDINGS{Ozgur2005,
  author = {{\"O}zg{\"u}r, Arzucan and {\"O}zg{\"u}r, Levent and G{\"u}ng{\"o}r,
Tunga},
  title = {{Text Categorization with Class-Based and Corpus-Based Keyword Selection}},
  booktitle = {Proceedings of the 20th International Conference on Computer and
Information Sciences},
  year = {2005},
  pages = {606-615},
}

@ARTICLE{Agrafiotis2000,
  author = {Dimitris K. Agrafiotis and Victor S. Lobanov},
  title = {{Nonlinear Mapping Networks}},
  journal = {Journal of Chemical Information and Computer Sciences},
  year = {2000},
  volume = {40},
  number = {6},
  pages = {1356-1362},
}

@ARTICLE{Agrafiotis2003,
  author = {Dimitris K. Agrafiotis and Huafeng Xu},
  title = {{A Geodesic Framework for Analyzing Molecular Similarities}},
  journal = {Journal of Chemical Information and Computer Sciences},
  year = {2003},
  volume = {43},
  number = {2},
  pages = {475-484},
}

@BOOK{Alpaydin2010,
  title = {{Introduction to Machine Learning}},
  publisher = {MIT Press},
  year = {2010},
  author = {Ethem Alpaydin},
  edition = {2nd},
}

@INBOOK{Joachims1999,
  chapter = {{Making Large-Scale Support Vector Machine Learning Practical}},
  pages = {169-184},
  title = {{Advances in Kernel Methods}},
  publisher = {MIT Press},
  year = {1999},
  editor = {Sch{\"o}lkopf, Bernhard and Burges, Christopher J. C. and Smola,
Alexander J.},
  author = {Joachims, Thorsten},
}

Output: refs (4) and (5) contain commas after the authors

2
  • Well, technically Joachims1999 is not really right, title = {{Advances in Kernel Methods}} should be booktitle = {{Advances in Kernel Methods}} and chapter = {{Making Large-Scale Support Vector Machine Learning Practical}}, should be title = {{Making Large-Scale Support Vector Machine Learning Practical}},
    – moewe
    Nov 14, 2013 at 17:18
  • this is a valuable suggestion - thanks, I will check how the bibliography behaves if I change this.
    – Jenny
    Nov 14, 2013 at 18:08

2 Answers 2

2

In the chem-acs style the \newunitpunct macro is defined as \addcomma\addspace so whenever you start a new unit you are going to get a comma. For book entries the unit is being started by the maintitle+title bibmacro while for inbook entries it is being started by the driver itself. While you could globally set \newunitpunct, this will have effects all over the place. Instead, I would use the xpatch package to patch the bibmacro and driver more locally and use \setunit to locally control the punctuation.

\xpatchbibmacro{maintitle+title}{\newunit\newblock}{\newunit\setunit{\addspace}\newblock}{}{}
\xpatchbibdriver{inbook}{\usebibmacro{byauthor}\newunit}{\usebibmacro{byauthor}\newunit\setunit{\addspace}}{}{}
2
  • I tried, but unfortunately I get errors using the xpatch package: ! Undefined control sequence. <argument> \ExplFileName This prevents me from trying at the moment.
    – Jenny
    Nov 15, 2013 at 9:06
  • also works perfectly, but with much less code than the solution below. thanks a lot!
    – Jenny
    Nov 15, 2013 at 9:56
2

You might want to try the following.

The bibdriver for inbook, incollection and inproceedings do not seem to be quite right for the task, as the \labelnamepunct are not inserted directly before the title, but before other fields.

\usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit
  \iftoggle{bbx:chaptertitle}
    {\usebibmacro{title}}
    {}%

Add the following lines to your preamble. First, we renew the maintitle+title

\renewbibmacro*{maintitle+title}{%
  \iffieldsequal{maintitle}{title}
    {\clearfield{maintitle}%
     \clearfield{mainsubtitle}%
     \clearfield{maintitleaddon}}
    {\iffieldundef{maintitle}
      {}
      {\usebibmacro{maintitle}}%
      %\newunit\newblock%<-- we comment this
    }%
  \usebibmacro{title}%
  \newunit
}

\newcommand{\patchcomma}[1]{%
  \xpatchbibdriver{#1}
    {\usebibmacro{title}}
    {\setunit{\labelnamepunct}\newblock\usebibmacro{title}}
    {\typeout{patched macro (#1)}}{\typeout{failed to patch macro (#1)}}
}
\patchcomma{inbook}\patchcomma{incollection}

So we patch the drivers to include the \labelnamepunct directly before the title.

The MWE

\documentclass{article}
\usepackage[style=chem-acs,articletitle,chaptertitle,backend=biber]{biblatex}
\usepackage{filecontents}
\usepackage{xpatch}
\addbibresource{\jobname.bib}
\begin{filecontents*}{\jobname.bib}
@INPROCEEDINGS{Ozgur2005,
  author = {{\"O}zg{\"u}r, Arzucan and {\"O}zg{\"u}r, Levent and G{\"u}ng{\"o}r,
Tunga},
  title = {{Text Categorization with Class-Based and Corpus-Based Keyword Selection}},
  booktitle = {Proceedings of the 20th International Conference on Computer and
Information Sciences},
  year = {2005},
  pages = {606-615},
}

@ARTICLE{Agrafiotis2000,
  author = {Dimitris K. Agrafiotis and Victor S. Lobanov},
  title = {{Nonlinear Mapping Networks}},
  journal = {Journal of Chemical Information and Computer Sciences},
  year = {2000},
  volume = {40},
  number = {6},
  pages = {1356-1362},
}

@ARTICLE{Agrafiotis2003,
  author = {Dimitris K. Agrafiotis and Huafeng Xu},
  title = {{A Geodesic Framework for Analyzing Molecular Similarities}},
  journal = {Journal of Chemical Information and Computer Sciences},
  year = {2003},
  volume = {43},
  number = {2},
  pages = {475-484},
}

@BOOK{Alpaydin2010,
  title = {Introduction to Machine Learning},
  publisher = {MIT Press},
  year = {2010},
  author = {Ethem Alpaydin},
  edition = {2nd},
}

@INBOOK{Joachims1999,
  title = {{Making Large-Scale Support Vector Machine Learning Practical}},
  pages = {169-184},
  booktitle = {{Advances in Kernel Methods}},
  booksubtitle = {Support Vector Learning},
  publisher = {MIT Press},
  year = {1999},
  editor = {Sch{\"o}lkopf, Bernhard and Burges, Christopher J. C. and Smola,
Alexander J.},
  author = {Joachims, Thorsten},
}
\end{filecontents*}

\renewbibmacro*{maintitle+title}{%
  \iffieldsequal{maintitle}{title}
    {\clearfield{maintitle}%
     \clearfield{mainsubtitle}%
     \clearfield{maintitleaddon}}
    {\iffieldundef{maintitle}
      {}
      {\usebibmacro{maintitle}}%
      %\newunit\newblock
    }%
  \usebibmacro{title}%
  \newunit
}

\newcommand{\patchcomma}[1]{%
  \xpatchbibdriver{#1}
    {\usebibmacro{title}}
    {\setunit{\labelnamepunct}\newblock\usebibmacro{title}}
    {\typeout{patched macro (#1)}}{\typeout{failed to patch macro (#1)}}
}
\patchcomma{inbook}\patchcomma{incollection}
\begin{document}

  Some journals: \cite{Agrafiotis2000,Agrafiotis2003}
  A book, chapter, and inproceeding: \cite{Ozgur2005,Alpaydin2010,Joachims1999}

  \printbibliography

\end{document}

yields

enter image description here

5
  • Are you allowed to have more than one \labelnamepunct? The documentation makes it sound like it controls sorting so won't this potentially cause problems?.
    – StrongBad
    Nov 14, 2013 at 18:08
  • Thank you! I will also have a look tomorrow, today time's running out here.
    – Jenny
    Nov 14, 2013 at 18:09
  • @DanielE.Shub It might not be overly semantically sound, and I should probably have removed the first occurrence (but I could not be bothered and was not to sure about language before title anyway), but should have no adverse effect on anything else. (According to §4.10.1 User-definable Commands and Hooks, p. 211, of the biblatex documentation: "The default is \newunitpunct, i.e., it is not handled differently from regular unit punctuation but permits convenient reconfiguration.")
    – moewe
    Nov 14, 2013 at 18:16
  • The renewing of maintitle+title worked for my book entry, thanks a lot! Unfortunately, I did not get the xpatch package to work (probably to my old tex installation).
    – Jenny
    Nov 15, 2013 at 9:08
  • perfectly working on another installation! thank you!
    – Jenny
    Nov 15, 2013 at 9:51

You must log in to answer this question.

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