4

With BibLaTeX, I'd like to separate title and subtitle with a colon, as is done in some citation styles. However, I'd like the mechanism to detect if the the title ends in a quotation mark and if it does, omit the subtitlepunct.

The documentation in §4.7.3 says:

\addcolon Adds a colon unless it is preceded by a comma, a semicolon, another colon, or a period.

Can I add "quotation mark" to that list? I.e., is there a solution that avoids \isdot?


\documentclass{article}

\begin{filecontents}{test.bib}
    @book{testbook,
      author = {A. U. Thor},
      year = {2020},
      title = {An example title?},
      subtitle = {An example subtitle}
    }
\end{filecontents}

\usepackage{biblatex}
\addbibresource{test.bib}
\renewcommand*{\subtitlepunct}{\addcolon\space}

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

1 Answer 1

5

You can declare acceptable punctuation before \addcolon with \DeclarePunctuationPairs. The default setting

\DeclarePunctuationPairs{colon}{*!?}

allows abbreviation dots, exclamation marks and question marks before a colon. After all other punctuation marks the colon is suppressed.

You probably want

\documentclass{article}

\usepackage{biblatex}

\renewcommand*{\subtitlepunct}{\addcolon\space}

\DeclarePunctuationPairs{colon}{*}

\begin{filecontents}{\jobname.bib}
@book{testbook,
  author   = {A. U. Thor},
  year     = {2020},
  title    = {An example title?},
  subtitle = {An example subtitle}
}
\end{filecontents}
\addbibresource{\jobname.bib}

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

A. U. Thor. An example title? An example subtitle. 2020.

Note that \DeclarePunctuationPairs is usually language-specific and therefore usually needs to live in \DefineBibliographyExtras. This is not required in the MWE (which loads neither babel nor polyglossia), but may be very relevant in your real-world application. See Biblatex punctuation recognition for more details.

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.