Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

biblatex and \makesentencecase{}

235 views
Skip to first unread message

max...@umiacs.umd.edu

unread,
Jun 19, 2016, 12:41:23 AM6/19/16
to
I just tracked down a bug in some code we had written for our local biblatex.cfg file; the code worked in the TeXLive 2015, but bit us in the 2016 version.

The code in question was using \MakeSentenceCase*{} to decide whether to capitalize things like "first" in the 'edition' field of a bibliographic reference. We are not using babel or polyglossia, and as a result the variable \bbl@main@language wasn't defined. This causes \MakeSentenceCase*{} to fail; the error msg is
-------------
! Undefined control sequence.
<argument> \bbl@main@language
-------------
Since the primary language of our documents is English, and in particular since the references are in English, it looks like we can just substitute \MakeSentenceCase{} in our code and we'll be fine. (Alternatively, I guess we could define \DeclareCaseLangs{english} in our preamble.)

I wanted, though, to ask whether that's the way it's supposed to work. That is, is LaTeX (xelatex in our case) supposed to output an error message and stop if \bbl@main@language isn't defined?

I don't have a strong opinion, but the description in the manual makes it sound like in the absence of a specified language (from a langid field or from \DeclareCaseLangs{}), \MakeSentenceCase*{} should make no change to its argument string. But perhaps I'm not reading the description in the manual right.

Mike Maxwell

jon

unread,
Jun 19, 2016, 1:42:43 PM6/19/16
to
\MakeSentencecase* is the recommended command to use, but it is hard to
diagnose the problem without a minimal example for others to test.

can you reproduce the error with your biblatex.cfg and something like:---

\documentclass{article}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}% comes with biblatex
\begin{document}
\cite{<some cite key that doesn't use the langid field>}
\printbibligraphy
\end{document}

---? if not, make the minimal changes to the above .tex file required to
reproduce the problem.

cheers,
jon.

max...@umiacs.umd.edu

unread,
Jun 20, 2016, 3:57:22 PM6/20/16
to
Ok, here's an mwe. It requires three files: the .tex file, a .bib file (the provided one doesn't contain any non-integer edition fields), and a biblatex.cfg file. (We had munged the latter for our purposes, the .cfg file that I'm including here is an excerpt from that munged file.) And it requires the .cfg file to be loaded, which I did using
export TEXINPUTS=.:
It could of course instead be placed in the texmf-local path.

----------BibBug.tex------------
\documentclass{report}
\usepackage{biblatex}
\addbibresource{References.bib}
\begin{document}
\cite{Hamlet}
\printbibliography
\end{document}

----------References.bib--------
@Book{Hamlet,
editor = "Wil'yam Sheq'spir",
title = "Hamlet Prince of Denmark",
edition = "16th",
publisher = "Klingon Paramount Press",
address = "Qo'noS",
year = "2437"
}

---------biblatex.cfg--------
\DeclareFieldFormat{edition}%
{\ifinteger{#1}%
{\mkbibordedition{#1}\addthinspace{}ed.}%
{\MakeSentenceCase*{#1} ed.}}

jon

unread,
Jun 20, 2016, 6:02:30 PM6/20/16
to
before delving any deeper into this, please note that biblatex asks you
to avoid writing:

edition = {16th},

or:

edition = {Sixteenth},

and instead write:

edition = {16},

(except in cases where you need to write something like 'Third, expanded
edition'.).

cheers,
jon.

max...@umiacs.umd.edu

unread,
Jun 20, 2016, 6:37:42 PM6/20/16
to
> before delving any deeper into this, please note that biblatex asks you
> to avoid writing:
>
> edition = {16th},
>
> or:
>
> edition = {Sixteenth},
>
> and instead write:
>
> edition = {16},

Ok, I guess I can do that in my own .bib files. But we have lots of people here who don't follow the rules :-), and we import a lot of files from other places (like those commercial bibliography programs). Or sometimes we copy-paste a citation from the web (like at the bottom of this page: http://www.ethnologue.com/), and then mung into bibtex format, and it's hard to remember to always make that change.

But mostly what I was saying is that in most places of biblatex.sty, there are guards around mentions of \bbl@main@language that prevent bad things from happening if that variable isn't defined, e.g.
\ifdefstring\blx@sortlocale{auto}
{\ifdef\bbl@main@language% babel or polyglossia is loaded
but in the defn of \blx@mksc@i (used in the definition of \MakeSentenceCase*), it looks like there isn't a guard. So if someone tries to use \MakeSentenceCase* for whatever purpose, they could be tripped up.

I realize that's probably not going to happen much, but I suspect it's an easy fix (not that I'm a TeX programmer!).

Mike Maxwell


jsp...@gmail.com

unread,
Jun 22, 2016, 7:52:41 AM6/22/16
to
Most probably this bug: https://github.com/plk/biblatex/issues/393

This is supposed to be fixed in the next version of biblatex-apa.

Jürgen

jon

unread,
Jun 22, 2016, 11:11:06 PM6/22/16
to
indeed. thanks for this.

cheers,
jon.
0 new messages