plk / biblatex

biblatex is a sophisticated bibliography system for LaTeX users. It has considerably more features than traditional bibtex and supports UTF-8
512 stars 118 forks source link

Bug when title ends with an uppercase letter #1271

Closed daniporr closed 1 year ago

daniporr commented 1 year ago

If the title of the paper ends with an upper case letter, then In is written as in.

This does not happen when the title ends with a lower case letter.

moewew commented 1 year ago

Can you please provide a minimal example document that shows your style setup along with an example .bib entry that reproduces the problem?

The following works fine for me

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

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

\begin{filecontents}{\jobname.bib}
@article{sigfridsson,
  author       = {Sigfridsson, Emma and Ryde, Ulf},
  title        = {Comparison of methods for deriving atomic charges from the
                  electrostatic potential and moments A},
  journaltitle = {Journal of Computational Chemistry},
  date         = 1998,
  volume       = 19,
  number       = 4,
  pages        = {377-395},
  doi          = {10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
Lorem \autocite{sigfridsson}

\printbibliography
\end{document}

Sigfridsson, Emma and Ulf Ryde (1998). ‘Comparison of methods for deriving atomic charges from the electrostatic potential and moments A’. In: Journal of Computational Chemistry 19.4, pp. 377–395.

moewew commented 1 year ago

Thinking about this again, the only explanation for the effect described in the report that I can come up with is https://github.com/plk/biblatex/issues/1071.

@daniporr If you could verify that is indeed the case, we can close this report as a duplicate.

daniporr commented 1 year ago

Thank you @moewew for your quick and precise reply. I apologise for not being able to respond as promptly.

I have tried to analyse what was different in my case, and find a minimal example to demonstrate this issue.

If you add the following command to your example:

\renewcommand{\bibsetup}{\vspace*{-\baselineskip}}

You can see the behaviour I described in my first message.


I think this problem is different from the one you reported in https://github.com/plk/biblatex/issues/1271#issuecomment-1469477454, but I am not sure about that.

moewew commented 1 year ago

The original definition of \bibsetup can be found in biblatex.def

https://github.com/plk/biblatex/blob/c3a329c190ed6858780c5e5fc4ffeccb5841bea9/tex/latex/biblatex/biblatex.def#L210-L258

as such the redefinition \renewcommand{\bibsetup}{\vspace*{-\baselineskip}} is rather radical as it removes all of that. I also have the feeling that \vspace*{-\baselineskip} is not what \bibsetup is intended for. \bibsetup should hold font setup instructions, but \vspace*{-\baselineskip} is a typesetting instruction.

You can reproduce the example in the following MWE

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

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

%\renewcommand{\bibsetup}{}% causes the problem
%\renewcommand{\bibsetup}{\frenchspacing}% no issue

\begin{filecontents}{\jobname.bib}
@article{sigfridsson,
  author       = {Sigfridsson, Emma and Ryde, Ulf},
  title        = {Comparison of methods for deriving atomic charges from the
                  electrostatic potential and moments A},
  journaltitle = {Journal of Computational Chemistry},
  date         = 1998,
  volume       = 19,
  number       = 4,
  pages        = {377-395},
  doi          = {10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
Lorem \autocite{sigfridsson}

\printbibliography
\end{document}

For punctuation detection biblatex largely relies on the \frenchspacing setup. I'm not sure if we can replicate all of that also in \nonfrenchspacing mode. (This might be interesting to investigate, but probably requires more time than I can spare at the moment. I might come back to it later, though.)

Just like in standard LaTeX you will probably have to tell TeX to ignore the A for punctuation purposes with \@ (https://tex.stackexchange.com/q/22561/35864)

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

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

\renewcommand{\bibsetup}{}% causes the problem

\begin{filecontents}{\jobname.bib}
@article{sigfridsson,
  author       = {Sigfridsson, Emma and Ryde, Ulf},
  title        = {Comparison of methods for deriving atomic charges from the
                  electrostatic potential and moments A\@},
  journaltitle = {Journal of Computational Chemistry},
  date         = 1998,
  volume       = 19,
  number       = 4,
  pages        = {377-395},
  doi          = {10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
Lorem \autocite{sigfridsson}

\printbibliography
\end{document}
daniporr commented 1 year ago

Thank you for your quick and very detailed answer (apologies, I somehow missed it).

Your point makes total sense to me. That statement was in a template I was using and that I trusted, so I haven't double checked it.

Removing that statement solves the problem (and it does not really change the output).

Thank you very much for your help.