dcpurton / biblatex-sbl

Society of Biblical Literature (SBL) style files for biblatex
25 stars 6 forks source link

Colon after title #7

Closed baem2 closed 8 years ago

baem2 commented 8 years ago

The colon after the title should only be there if there is no question mark (or similar) at the end of the title. Would that be possible?

Example:

\listfiles
\documentclass{article}
\usepackage[english]{babel}

\usepackage[utf8]{inputenc}

\begin{filecontents}{lit.bib}
@article{leyerle:1993,
  author = {Leyerle, Blake},
  title = {Title is a question?},
  subtitle = {And has a subtitle!},
  shorttitle = {Chrysostom},
  journaltitle = {Journal of Early Christian Studies},
  shortjournal = {JECS},
  volume = {1},
  date = {1993},
  pages = {159-174}
}
\end{filecontents}

\usepackage[style=sbl]{biblatex}
\bibliography{lit.bib}

\begin{document}
A short test: \cite{leyerle:1993}
\end{document} 

It does not matter whether I write ? or \addquestion there.

dcpurton commented 8 years ago

Confirm (See section 6.1.3.1 on page 72 of the handook). I'll look into it.

In the mean time, you could put this subtitle in the title field., e.g.,

@book{author:year,
  …
  title = {title? subtitle},
  shorttitle = {title?},
  …
}
moewew commented 8 years ago

This is what \DeclarePunctuationPairs is for (p. 205 of the biblatex manual), the default setting is

\DeclarePunctuationPairs{colon}{*!?}

and allows colons after (abbreviation) dots, exclamation marks and question marks. If you want to suppress a colon after the latter two, you will need to issue \DeclarePunctuationPairs{colon}{*} in \DefineBibliographyExtras (this setting is language-specific), for example

\DefineBibliographyExtras{british}{\DeclarePunctuationPairs{colon}{*}}

in

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{csquotes}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{leyerle:1993,
  author = {Leyerle, Blake},
  title = {Title is a question?},
  subtitle = {And has a subtitle!},
  shorttitle = {Chrysostom},
  journaltitle = {Journal of Early Christian Studies},
  shortjournal = {JECS},
  volume = {1},
  date = {1993},
  pages = {159-174}
}
\end{filecontents}

\usepackage[style=authoryear]{biblatex}
\addbibresource{\jobname.bib}
\renewcommand{\subtitlepunct}{\addcolon\space}
\DefineBibliographyExtras{british}{\DeclarePunctuationPairs{colon}{*}}

\begin{document}
A short test: \cite{leyerle:1993}
\printbibliography
\end{document} 
baem2 commented 8 years ago

Thank you, that's working great! https://github.com/baem2/biblatex-sbl/commit/2f118e4b6ad8613bf6a718c62de9a7d85ce29453

moewew commented 8 years ago

If you want to use this in an .lbx file (I just noticed you have an sbl-english.lbx), it is probably nicer to use \DeclareBibliographyExtras instead of \DefineBibliographyExtras{<language>}.

Speaking of sbl-english.lbx, I think you might be missing a \ in line 29

baem2 commented 8 years ago

Okay, thanks for that hint (I am not used to TeX programming at all ...)

dcpurton commented 8 years ago

Thanks @moewew! Very helpful. I'll fix both problems.

baem2 commented 8 years ago

Have a look in my branch, you can just merge it in (see the pull request).

dcpurton commented 8 years ago

I think in sbl-german.lbx, the \DeclarePunctuationPairs{colon}{*} should go inside the existing \DeclareBibliographyExtras. I'll fix it now and push it. If that works, we can close this issue. It works under English.

baem2 commented 8 years ago

Okay, seems to be fine -- closing.