plk / biber

Backend processor for BibLaTeX
Artistic License 2.0
335 stars 37 forks source link

biber 1.9 breaks \circa #237

Closed keithbriggs closed 5 years ago

keithbriggs commented 5 years ago

My .bib files have lots of things like \circa{1960}, where \circa is my own macro to typeset something like c.1960. The current definition is "\newcommand{\circa}[1]{\textit{c}.#1}". These all went through biber 1.8 without problems, but with 1.9 I get output which causes a syntax error when latex is run. Possibly this only happens when the \circa is in square brackets, but I'm not sure.

Less serious problems are these: Biber warning: [6765] Utils.pm:169> WARN - month field 'October' in entry 'Hough:7880' is not an integer - this will probably not sort properly. Biber warning: [9495] Utils.pm:169> WARN - year field '1991-92' in entry 'Nomina-15-Fellows-Jensen-Place-names' is not an integer - this will probably not sort properly.

I thought textual months would be understood correctly? And how are we supposed to express date ranges if 1991-92 is not understood? I suggest that this be interpreted as 1991. Also, c2018 is a legitimate date syntax for bibliographers - it means copyright year (not circa), and it would be good if biber knew this.

plk commented 5 years ago

For quite some time now, biblatex and biber support comprehensive ETDF (now the new ISO8601 standard) dates which includes era, circa, range support etc. I would recommend you upgrade your biblatex and biber to the latest versions and see the manual for how to format your dates to get much better support for what you need that hard-coding in the .bib.

keithbriggs commented 5 years ago

That's fine for new files, but I've got legacy .bib files with 1000s of entries which need to keep working across a range of systems. It would be a massive job to recode them all (and some are generated by scripts which would also need upgrading). Is biber intended to pass macros like the following through unchanged?

title={Multilingualism in medieval Britain (\circa{1066}--1520): sources and analysis},

Keith


From: plk notifications@github.com Sent: 03 October 2018 15:35 To: plk/biber Cc: Briggs,KM,Keith,TUD2 R; Author Subject: Re: [plk/biber] biber 1.9 breaks \circa (#237)

For quite some time now, biblatex and biber support comprehensive ETDF (now the new ISO8601 standard) dates which includes era, circa, range support etc. I would recommend you upgrade your biblatex and biber to the latest versions and see the manual for how to format your dates to get much better support for what you need that hard-coding in the .bib.

- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/plk/biber/issues/237#issuecomment-426661096, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE6IEQoAIlg1a7YmDyoXo0HntYWrHAX_ks5uhMtKgaJpZM4XGI7S.

keithbriggs commented 5 years ago

Sorry, I should have said 2.9 in the subject.


From: plk notifications@github.com Sent: 03 October 2018 15:35 To: plk/biber Cc: Briggs,KM,Keith,TUD2 R; Author Subject: Re: [plk/biber] biber 1.9 breaks \circa (#237)

For quite some time now, biblatex and biber support comprehensive ETDF (now the new ISO8601 standard) dates which includes era, circa, range support etc. I would recommend you upgrade your biblatex and biber to the latest versions and see the manual for how to format your dates to get much better support for what you need that hard-coding in the .bib.

- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/plk/biber/issues/237#issuecomment-426661096, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE6IEQoAIlg1a7YmDyoXo0HntYWrHAX_ks5uhMtKgaJpZM4XGI7S.

moewew commented 5 years ago

@keithbriggs I can not reproduce an issue with your \circa macro with a current installation (biblatex 3.11/Biber 2.11). It should most certainly work and if it does not work that would probably be considered a bug in Biber or biblatex.

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

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

\newcommand{\circa}[1]{\textit{c}.#1}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{appleby,
  author  = {Humphrey Appleby},
  title   = {Multilingualism in medieval Britain (\circa{1066}--1520): sources and analysis},
  date    = {1980},
}
\end{filecontents}

\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
\cite{sigfridsson,appleby}
\printbibliography
\end{document}

For example compiles and displays just fine. If you are having problems with a particular entry, please show us a complete, yet minimal example document that reproduces the exact issue you are having in your big document. See https://tex.meta.stackexchange.com/q/228/35864 and https://tex.meta.stackexchange.com/q/4407/35864 on TeX.SX for help with that.

I know that it is painful when legacy documents do not work in new versions any more, but unfortunately sometimes breaking changes are inevitable. Especially with the date changes many things did not really work as intended before and the new behaviour actually fixes issues or just warns you more vocally than before that things will probably not work as expected.

In particular

Biber warning: [6765] Utils.pm:169> WARN - month field 'October' in entry 'Hough:7880' is not an integer - this will probably not sort properly.

Comes from something like month={October}, which was never the preferred input for BibTeX, where you should have used the three-letter abbreviation strings provided by the style without braces/quotation marks (month = oct,), and was actively discouraged in biblatex from the start, the documentation of version 0.8e dated July 2009 says The month in which the work was published or the month in a date specification. This must be an integer, not an ordinal or a string. Don’t say month={January} but month={1}. The bibliography style converts this to a language-dependent string or ordinal where required.

I did not check all biblatex documentations since then, but a quick look suggests that that passage has been in the documentation ever since.

So even if this worked before, that was only accidental and against documented behaviour; you could and should not rely on that. As far as I can see month = {October}, still works and sorts as intended with Biber, but issues a warning that the format is not considered correct. This is more than I dared hope for. But again you can not rely on that.

I could also not find evidence in the documentation of v0.8e that 1991-92 is intended input for the year field. This is not guaranteed to sort correctly (and never was). The output will always have been subpar, but maybe you only get a warning about that with newer versions of Biber. You can suppress the warning and force a proper sorting by using the sortyear field (in light of https://github.com/plk/biber/issues/228, please use sortyear only with integer input). Date ranges should be input in ISO/EDTF format into the date field, so you would say

date = {1991/1992}

and it is entirely up to your style (and ultimately you) how that would be printed in the output.

keithbriggs commented 5 years ago

Thanks for this very useful reply!

I only get a problem if I put

year={\circa{1980}},

I realize this is not a valid date format and biber 2.9 correctly puts this line in the .bbl file:

\warn{\item Entry 'appleby' (try_circa.bib): Invalid format '\circa{1980}' of date field 'date' - ignoring}

However, this causes LaTeX to give up like this, so it doesn't seem quite true that the field has been ignored:

Runaway definition? ->Biber reported the following issues\MessageBreak with 'appleby':\MessageBreak \ETC. ! File ended while scanning definition of \blx@tempa.

} l.43 ...ca{1980}' of date field 'date' - ignoring}

Keith


From: moewew notifications@github.com Sent: 04 October 2018 09:46 To: plk/biber Cc: Briggs,KM,Keith,TUD2 R; Mention Subject: Re: [plk/biber] biber 1.9 breaks \circa (#237)

@keithbriggshttps://github.com/keithbriggs I can not reproduce an issue with your \circa macro with a current installation (biblatex 3.11/Biber 2.11). It should most certainly work and if it does not work that would probably be considered a bug in Biber or biblatex.

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

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

\newcommand{\circa}[1]{\textit{c}.#1}

\usepackage{filecontents} \begin{filecontents}{\jobname.bib} @book{appleby, author = {Humphrey Appleby}, title = {Multilingualism in medieval Britain (\circa{1066}--1520): sources and analysis}, date = {1980}, } \end{filecontents}

\addbibresource{\jobname.bib} \addbibresource{biblatex-examples.bib}

\begin{document} \cite{sigfridsson,appleby} \printbibliography \end{document}

works just fine. If you are having problems with a particular entry, please show us a complete, yet minimal example document that reproduces the exact issue you are having in your big document. See https://tex.meta.stackexchange.com/q/228/35864 and https://tex.meta.stackexchange.com/q/4407/35864 on TeX.SX for help with that.

I know that it is painful if legacy documents do not work in new versions any more, unfortunately sometimes breaking changes are inevitable. Especially with the date changes many things did not actually work as intended before and the new behaviour actually fixes issues or is just warns you more vocally than before that things will probably not work as expected.

In particular

Biber warning: [6765] Utils.pm:169> WARN - month field 'October' in entry 'Hough:7880' is not an integer - this will probably not sort properly.

Comes from something like month={October}, which was never the preferred input for BibTeX, where you should have used the three-letter abbreviation strings provided by the style without braces/quotation marks (month = oct,), and actively discouraged in biblatex from the start, the documentation of version 0.8e dated July 2009 says

The month in which the work was published or the month in a date specification. This must be an integer, not an ordinal or a string. Don’t say month={January} but month={1}. The bibliography style converts this to a language-dependent string or ordinal where required.

I did not check all biblatex documentations since then, but a quick look suggests that that passage has been in the documentation ever since.

So even if this worked before, that was only accidentally against documented behaviour and you could not rely on that. As far as I can see month = {October}, still works and sorts as intended with Biber, but does issue a warning that the format is not considered correct. This is more than I dared to hope for. But again you can not rely on that.

I could also not find evidence in the documentation of v0.8e that 1991-92 is intended input for the year field. This should never have sorted correctly and the output will always have been subpar, but maybe you only get a warning about that with newer versions of Biber. You can suppress the warning and force a proper sorting by using the sortyear field (in light of #228https://github.com/plk/biber/issues/228, please use sortyear only with integer input). Date ranges should be input in ISO/EDTF format into the date field, so you would say

date = {1991/1992}

and it is entirely up to your style (and ultimately) you how that would be printed in the output.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/plk/biber/issues/237#issuecomment-426935990, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE6IEZL5d6dxkttCVBG4hQHfJzuj618iks5uhcrWgaJpZM4XGI7S.

moewew commented 5 years ago

Aha! Well, that is different. For a surprise redefine \circa to be \newcommand{\circa}[1]{c.#1} and compile your document again.

This issue is specific to the year field. The year is not simply printed as is in the bibliography, it has to be passed through many macros to allow for all sorts of date formatting options. One of the macros (\IfInteger) needs the field to be fully expandable, but \textit is not expandable and so things fall apart.

I would argue that the input is wrong and should not be used. I will have a look at \IfInteger and will try to see if we can get rid of it (that also came up in https://github.com/plk/biblatex/issues/768), but I'm not very confident that I can find an acceptable solution (since it would have to be backwards compatible).

In the meantime the MWE below contains a workaround for \circa in year fields that disables the interfering \IfInteger (and thus disables the datezeros feature for years) and shows how you could use the EDTF/ISO date format to properly mark up a circa date in the .bib file

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

\usepackage[style=authoryear, backend=biber, datecirca=true]{biblatex}

\newcommand{\circa}[1]{\textit{c}.#1}

% disable datezeros and friends, but allow \circa to work in year fields (appleby)
\makeatletter
\protected\def\blx@imc@forcezerosy#1{#1}
\let\blx@imc@mkyearzeros\blx@imc@forcezerosy
\makeatother

% use EDTF (elk)
\DefineBibliographyStrings{english}{circa = {\mkbibemph{c}\adddot}}
\DeclareDelimFormat{datecircadelim}{}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{appleby,
  author  = {Humphrey Appleby},
  title   = {On the Importance of the Civil Service},
  year    = {\circa{1980}},
}
@book{elk,
  author  = {Humphrey Appleby},
  title   = {A Theory on Brontosauruses},
  date    = {1970~},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\cite{elk,appleby}
\printbibliography
\end{document}
moewew commented 5 years ago

BTW: Is https://tex.stackexchange.com/q/453625/35864 you?

I should also note that the ignored in the log probably just refers to sorting, not to outputting information into the .bbl. But PLK would have to confirm that. I think it makes sense to allow that field to land in the .bbl even though it is malformed according to the sorting specs and general data model assumptions.

keithbriggs commented 5 years ago

Yes, that was me.

Thanks for the previous answer. I can do a workaround using those ideas.

K


From: moewew notifications@github.com Sent: 04 October 2018 11:37 To: plk/biber Cc: Briggs,KM,Keith,TUD2 R; Mention Subject: Re: [plk/biber] biber 1.9 breaks \circa (#237)

BTW: Is https://tex.stackexchange.com/q/453625/35864 you?

I should also note that the ignored in the log probably just refers to sorting, not to outputting information into the .bbl. But PLK would have to confirm that. I think it makes sense to allow that field to land in the .bbl even though it is malformed according to the sorting specs and general data model assumptions.

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/plk/biber/issues/237#issuecomment-426969476, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE6IEXgSR74qV1CmauEB6oYd-FCbhYieks5uheTTgaJpZM4XGI7S.

plk commented 5 years ago

Since we have such a full-featured date system now, the type checking of dates in the default data model is more strict that it used to be and so those "ignored" messages really do mean ignored ...