19

Customising a biblatex style, I want to ensure that after the title of books only a space is used. If you take a look at one of the standard drivers:

\DeclareBibliographyDriver{book}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \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
  \printfield{pagetotal}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

changing the part about the book title to read

  \usebibmacro{maintitle+title}%
  \setunit{\addspace}%

does not work as the various \newunit instructions seem to over-ride it even if no additional fields are printed. What's the correct way to say 'the next punctuation must always be just a space'?

12

According to section 4.7.3 of the manual, the \nopunct macro "[a]dds an internal marker which will cause the next punctuation command to print nothing." The following seems to work:

  \usebibmacro{maintitle+title}%
  \nopunct
| improve this answer | |
  • Excellent: I knew there would be a way, but was failing to find it. – Joseph Wright Feb 27 '11 at 7:09
2

You could try to replace every following \newunit by \setunit*{\newunitpunct}, as the starred variant of \setunit prints the punctuation only if the previous command (\printtext, \printfield, \printlist, \printnames, \bibstring) was executed. Although I am not sure if this works, it is worth a try.

| improve this answer | |

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.