2

I'm redefining the "title" bibmacro in order to include the original title of the work. As seen here, it works sometimes and sometimes it doesn't.Failure!In case it isn't obvious, there's a lot of bonus space after the bracket in the second entry.

Here's my MWE that produced this image:

\documentclass[varwidth,border=0.2in]{standalone}

\RequireXeTeX
\usepackage{polyglossia}

\setmainlanguage{english}
\setotherlanguages{czech,spanish}

\usepackage[backend=biber,bibstyle=standard]{biblatex}

\renewbibmacro*{title}{%
  \printtext[title]{%
    \printfield[titlecase]{title}%
    \iffieldundef{subtitle}%
      {}%
      {\setunit{\addcolon\addspace}\printfield[titlecase]{subtitle}}%
    \iffieldundef{origtitle}%
      {}%
      {\setunit{\addspace}\printtext[brackets]{\printfield{origtitle}}}}%
  \newunit}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{Grusa,
  Author = {Jiří Gruša},
  Location = {New York},
  Origlanguage = {czech},
  Origtitle = {\textczech{Dotazník, aneb modlitba za jedno město a přítele}},
  Publisher = {Farrar Straus Giroux},
  Title = {The Questionnaire, or Prayer for a Town and a Friend},
  Translator = {Peter Kussi},
  Year = {1982}}

@book{Cortazar:Fires,
  Author = {Julio Cortázar},
  Location = {New York},
  Origlanguage = {spanish},
  Origtitle = {\textspanish{Todos los fuegos el fuego}},
  Publisher = {Pantheon Books},
  Title = {All Fires the Fire and Other Stories},
  Translator = {Suzanne Jill Levine},
  Year = {1973}}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography[heading = none]
\end{document}

Based on what I have here, I have no idea where the bonus space is coming from. I freely admit that I don't have any idea if this the best way to do what I want to do, so if there's a better way to do this, please let me know.

3
  • 1
    The two entries are exactly parallel, but the extra space shows up only in the Czech translation. And, looking at the width of the gap, multiple non-consecutive spaces are involved. My guess is that it is the fault of (unintended) spaces in the definition of \textczech loaded by polyglossia. There are others more capable of fixing this than I, but that's where I'd look. Jun 2, 2020 at 1:13
  • 1
    it is a bug in gloss-czech, with luatex there is one spurious space in the code, with xelatex quite a number. A simple xxx\textczech{abc}yyy demonstrates it. Open an issue at the polyglossia repo. Jun 2, 2020 at 7:55
  • 1
    This is a bug (well, a few forgotten %s) in polyglossia's Czech language module, I reported it at github.com/reutenauer/polyglossia/issues/423
    – moewe
    Jun 2, 2020 at 7:58

1 Answer 1

3

As suspected by barbara beeton and also mentioned by Ulrike Fischer, the problem comes from a few spurious spaces due to missing %s in polyglossia's Czech language module. The problem can be reproduced without biblatex

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguages{czech,spanish}

\begin{document}
A\textczech{B}C

A\textspanish{B}C
\end{document}

A     BC//ABC

Issues like this should be reported to the polyglossia maintainers. They usually take care of these things quite swiftly. I reported the issue in https://github.com/reutenauer/polyglossia/issues/423 (the issue was fixed shortly after reporting and should be in the next polyglossia release, in case it is urgent one can probably get the .ldf files from https://github.com/reutenauer/polyglossia/commit/e088311159a5db2403d2ed672eaf42c0a74a24fd and use them as drop-in replacements for the faulty files).

As a quick work-around you can set the polyglossia-czech option vlna to false. You quite probably don't want to do that in a document with significant text in Czech, but may get away with it if you only have short passages of Czech.

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage[vlna=false]{czech}
\setotherlanguage{spanish}

\begin{document}
A\textczech{B}C

A\textspanish{B}C
\end{document}

ABC//ABC


Just so this answer contains something interesting, here is a solution that automatically adds \text<language> around origtitle according to the value of origlanguage (cf. https://github.com/plk/biblatex/issues/594).

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage[vlna=false]{czech}% TEMPORARY workaround
% for https://github.com/reutenauer/polyglossia/issues/423
\setotherlanguage{spanish}

\usepackage[backend=biber]{biblatex}

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

\DeclareFieldFormat{origtitle:origlang:polyglossia}{%
  \iflistundef{origlanguage}
    {#1}
    {\ifcsundef{text\thefirstlistitem{origlanguage}}
       {\PackageWarning{biblatex}{%
          No language switching for
          \thefirstlistitem{origlanguage}}%
        #1}
       {\csuse{text\thefirstlistitem{origlanguage}}{#1}}}}

\renewbibmacro*{title}{%
  \printtext[title]{%
    \printfield[titlecase]{title}%
    \iffieldundef{subtitle}%
      {}%
      {\setunit{\subtitlepunct}%
       \printfield[titlecase]{subtitle}}%
    \iffieldundef{origtitle}%
      {}%
      {\setunit{\addspace}%
       \printtext[brackets]{\printfield[origtitle:origlang:polyglossia]{origtitle}}}}%
  \newunit}

\begin{filecontents}{\jobname.bib}
@book{Grusa,
  Author       = {Jiří Gruša},
  Location     = {New York},
  Origlanguage = {czech},
  Origtitle    = {Dotazník, aneb modlitba za jedno město a přítele},
  Publisher    = {Farrar Straus Giroux},
  Title        = {The Questionnaire, or Prayer for a Town and a Friend},
  Translator   = {Peter Kussi},
  Year         = {1982},
}
@book{Cortazar:Fires,
  Author       = {Julio Cortázar},
  Location     = {New York},
  Origlanguage = {spanish},
  Origtitle    = {Todos los fuegos el fuego},
  Publisher    = {Pantheon Books},
  Title        = {All Fires the Fire and Other Stories},
  Translator   = {Suzanne Jill Levine},
  Year         = {1973},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography[heading = none]
\end{document}

[1] Julio Cortázar. All Fires the Fire and Other Stories [Todos los fuegos el fuego]. Trans. from the Spanish by Suzanne Jill Levine. New York: Pantheon Books, 1973.//[2] Jiří Gruša. The Questionnaire, or Prayer for a Town and a Friend [Dotazník, aneb modlitba za jedno město a přítele]. Trans. from the Czech by Peter Kussi. New York: Farrar Straus Giroux, 1982.

2
  • 2
    Just as an addition: The spurious space with luatex is caused by the luavlna package. See github.com/michal-h21/luavlna/issues/5 (the xelatex issues are fixed for the next polyglossia version)
    – JSpitzm
    Jun 2, 2020 at 10:06
  • Wow. Great answer, and great bonus answer as well. Thanks!
    – Derek
    Jun 2, 2020 at 15:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .