comma between title and edition

As per the answer to another question I have removed the punctuation at the end of book titles like this:

\DeclareFieldFormat[article]{title}{#1\addcomma}
\DeclareFieldFormat[book]{title}{\textit{#1}\nopunct}


This also removes the comma between book titles and the edition, but I need the comma between the book title and the edition. Is there a way to reinstate the comma in that specific case?

MWE:

\documentclass{article}
\usepackage[style=authoryear]{biblatex}
\begin{filecontents}{\jobname.bib}
@book{crut1997,
Author = {Alan Cruttenden},
Edition = {2},
Publisher = {Cambridge University Press},
Title = {Intonation},
Year = 1997}
\end{filecontents}
\DeclareFieldFormat[book]{title}{\textit{#1}\nopunct}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

• Mhhh, since you seem to implement a fully fledged style you may want to think about modifying the drivers directly. On this site you will often get clever answers that try not to modify the drivers because that often means lots of code for a fairly minute change. But if you need to do many changes they mount up and at some point changing the driver might be the cleverer idea. – moewe Jul 22 '16 at 14:17
• More to the point: Where exactly do you need the space instead of point? Before the publisher, the note, the series and number? After the edition? – moewe Jul 22 '16 at 14:18

To me it seems you just need to suppress punctuation before the pair of brackets around publisher, location and date. That can be done with

\renewbibmacro*{publisher+location+date}{%
\printtext[parens]{%
\printlist{location}%
\iflistundef{publisher}
\printlist{publisher}%
\usebibmacro{date}}%
\newunit}


Where \setunit{\addspace} and \printtext[parens]{ are the additions to the standard version of the macro.

Because of the way biblatex's punctuation tracker works the \setunit{\addspace} overrides any other punctuation before it and we are left with a nice single spaces before the brackets.

• Yes, that seems to do it. In response to one of your other comments, after spending some time (including on here) trying to tweak things to get the style I need, I am starting to think that coming up with a proper, full-fledged style will be better than a patchwork approach. Your code will be useful in that. – Gareth Walker Jul 23 '16 at 10:17

I moved the bibliography info to a separate file. I edited my answer. Basically added a test to see if edition field is defined. Based on that we use either a period or a comma. Now it works with and without edition field.

PS. Of course it might fail if you add some other fields between title and edition. And this change affects book, collecton and proceedings types. It is possible to restrict only to books.

\documentclass{article}
\usepackage[style=authoryear,backend=biber]{biblatex}

\renewbibmacro*{maintitle+title}{%
\iffieldsequal{maintitle}{title}
{\clearfield{maintitle}%
\clearfield{mainsubtitle}%
{\iffieldundef{maintitle}
{}
{\usebibmacro{maintitle}%
\newunit\newblock
\iffieldundef{volume}
{}
{\printfield{volume}%
\printfield{part}%
\usebibmacro{title}%
\iffieldundef{edition}% <----- Added this test and next 2 lines
{\nopunct}%

• Great. That very nearly works - it puts a period after the title if there is no edition, but there shouldn't be one. Changing \addperiod to \nopunct seems to fix that. – Gareth Walker Jul 22 '16 at 9:56
• No, that needs to go as well. I seem to be able to get that effect with \DefineBibliographyStrings{english}{edition={edn\nopunct}} so all is good now – Gareth Walker Jul 22 '16 at 10:15