plk / biblatex

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

Language support for ecclesiastic Latin #949

Open wehro opened 4 years ago

wehro commented 4 years ago

When I try to use a bibliography within a ecclesiastic Latin document (set by polyglossia), I get the warning

Package biblatex Warning: Language 'latin.ecclesiastic' not supported.
(biblatex)                Using fallback language 'english' on input line 29.

So I have created a file latin.ecclesiastic.lbx similiar to other language files of biblatex. I plan to contribute this file when it will be ready. At the moment, I have two questions:

  1. Is the filename which I have chosen correct?
  2. When I compile the following document with lualatex, I get the following warning. Can this be corrected on the biblatex side?
    Module polyglossia Warning: Language latin.ecclesiastic not found in language.d
    at.lua on input line 31
\begin{filecontents}{Literatur.bib}
@mvbook{LH,
title = {Liturgia horarum iuxta ritum Romanum},
volumes = 4,
edition = 2,
location = {Civitate Vaticana},
year = 2000
}
\end{filecontents}
\begin{filecontents}{latin.ecclesiastic.lbx}
\ProvidesFile{latin.ecclesiastic.lbx}
[\abx@lbxid]
\DeclareBibliographyStrings{%
  bibliography     = {{Index bibliographicus}{Index bibliographicus}},
  references       = {{Libri adhibiti}{Libri adhibiti}},
  shorthands       = {{Index siglorum}{Sigla}},
  volume           = {{volumen}{vol\adddot}},
  volumes          = {{volumina}{voll\adddot}},
  edition          = {{editio}{ed\adddot}},
}
\endinput
\end{filecontents}
\documentclass{article}
\usepackage{polyglossia}
\usepackage{biblatex}
\setmainlanguage[variant=ecclesiastic]{latin}
\addbibresource{Literatur.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
moewew commented 4 years ago
  1. Is the filename which I have chosen correct?

Dot modifiers are tricky. See also #937, #938, #935

As far as polyglossia is concerned the file name currently works because \babelname returns latin.ecclesiastic and we use that to determine which file to load.

But then we also use \babelname assuming we can do all sort of other stuff and at some point we pass latin.ecclesiastic back to polyglossia and it complains

Module polyglossia Warning: Language latin.ecclesiastic not found in language.d
at.lua on input line 34
Module polyglossia Warning: Language latin.ecclesiastic not found in language.d
at.lua on input line 34

I haven't yet tried to hunt down which biblatex operation causes this issue, but it stands to reason that this is problematic in a way that means that either \babelname should return only latin or that biblatex needs to make sure to use only latin even when latin.ecclesiastic is returned.

That nicely ties into question 2.

  1. When I compile the following document with lualatex, I get the following warning. Can this be corrected on the biblatex side?

    Module polyglossia Warning: Language latin.ecclesiastic not found in language.d
    at.lua on input line 31

I have no idea, sorry. I guess this shouldn't be happening. But I don't know enough about polyglossia to figure out how bad this warning is.

jspitz commented 4 years ago

@wehro try if adding the babel alias \setlanguagealias[variant=ecclesiastic]{latin}{latin.ecclesiastic} in gloss-latin.ldf helps. If so, we can fix this on the polyglossia side.

jspitz commented 4 years ago

Sorry, it should be \setlanguagealias*[variant=ecclesiastic]{latin}{latin.ecclesiastic} (with a star)

jspitz commented 4 years ago

Ehrm, actually I do not get the above warning with biblatex 3.14 and polyglossia master (using the MWE above)

wehro commented 4 years ago

Ehrm, actually I do not get the above warning with biblatex 3.14 and polyglossia master (using the MWE above)

You need to run lualatex two times and biber in between to see the warning.

wehro commented 4 years ago

Sorry, it should be \setlanguagealias*[variant=ecclesiastic]{latin}{latin.ecclesiastic} (with a star)

Unfortunately, this does not help.

jspitz commented 4 years ago

You need to run lualatex two times and biber in between to see the warning.

That's what I did. Still no warning (not the one in question, that is)

moewew commented 4 years ago

With release versions of all packages involved the following slightly modified MWE when compiled with LuaLaTeX, Biber, LuaLaTeX, LuaLaTeX

\listfiles
\begin{filecontents}[force]{\jobname.bib}
@mvbook{LH,
title = {Liturgia horarum iuxta ritum Romanum},
volumes = 4,
edition = 2,
location = {Civitate Vaticana},
year = 2000
}
\end{filecontents}
\begin{filecontents}[force]{latin.ecclesiastic.lbx}
\ProvidesFile{latin.ecclesiastic.lbx}
[\abx@lbxid]
\DeclareBibliographyStrings{%
  bibliography     = {{Index bibliographicus}{Index bibliographicus}},
  references       = {{Libri adhibiti}{Libri adhibiti}},
  shorthands       = {{Index siglorum}{Sigla}},
  volume           = {{volumen}{vol\adddot}},
  volumes          = {{volumina}{voll\adddot}},
  edition          = {{editio}{ed\adddot}},
}
\endinput
\end{filecontents}
\documentclass{article}
\usepackage{polyglossia}
\usepackage{biblatex}

\setmainlanguage[variant=ecclesiastic]{latin}
\addbibresource{\jobname.bib}
\begin{document}
\babelname
\nocite{*}
\printbibliography
\end{document}

complains

Module polyglossia Warning: Language latin.ecclesiastic not found in language.da
t.lua on input line 34
Module polyglossia Warning: Language latin.ecclesiastic not found in language.da
t.lua on input line 34

It does so only after a successful Biber run.

Since the warning comes from a Lua module it does not appear with XeLaTeX.

Adding

\setlanguagealias*[variant=ecclesiastic]{latin}{latin.ecclesiastic}

to the preamble of the MWE did not appear to help. Neither did adding that line to gloss-latin.ldf (I added it after the \setlanguagealias that were already present in the file).

jspitz commented 4 years ago

The warning is triggered by biblatex's \blx@ifhyphenationundef test which triggers polyglossia's \xpg@ifdefined. Since this tests for hyphenation pattern names, neither polyglossia names nor babel names/aliases are correct in this case, as the hyphenation pattern which is used here is latin (this coincides with the polyglossia language name, but for other latin variants, this is not true, e.g. latin.classic has the pattern classiclatin).

I suppose the *.lbx files need some infos about pattern names where they differ, and biblatex needs to use that name in this test. Otherwise things would go wrong later if biblatex attempts to load \l@<name> in \blx@hyphexcept#1#2

jspitz commented 4 years ago

Another option, on the polyglossia side, would probably to let gloss-latin.ldf define \adddialect\l@latin.ecclesiastic\l@latin if the variant is loaded next to doing the alias addition mentioned above.

jspitz commented 4 years ago

next to doing the alias addition mentioned above.

the latter is probably not needed

jspitz commented 4 years ago

\adddialect\l@latin.ecclesiastic\l@latin

This does not work due to the dot. So either do in biblatex as suggested above (https://github.com/plk/biblatex/issues/949#issuecomment-570062826) or change the babelname in gloss-latin.ldf to latineccelesiastic and add \adddialect\l@latinecclesiastic\l@latin

wehro commented 4 years ago

Thank you for your considerations. Please take into account that there is a hyphenation key for Latin, which allows to change the hyphenation patterns without changing the language variant. I have introduced this key after careful consideration due to the request of the developer of the liturgical hyphenation patterns liturgicallatin, which are based on the rules developed in the French abbey of Solesmes, but not used in all liturgical books. German- and Slavic-speaking users are also recommended to use the hyphenation key, because for non-Italian pronunciations of Latin, the classic patterns are more suitable than the “liturgical” or “modern” ones. Any solution that does not respect the hyphenation option does not help.

jspitz commented 4 years ago

Any solution that does not respect the hyphenation option does not help.

Then it's up to you to set up proper language aliases (via \adddialect) in these cases. E.g., if ecclesiastic latin is combined with hyphenation=classic you probably also need to set \adddialect\l@latinecclesiastic\l@classiclatin

wehro commented 4 years ago

Then it's up to you to set up proper language aliases (via \adddialect) in these cases. E.g., if ecclesiastic latin is combined with hyphenation=classic you probably also need to set \adddialect\l@latinecclesiastic\l@classiclatin

This should be no problem. As far as I can see, we need something similar for the German gloss file of polyglossia. The following example gives errors on my system:

\begin{filecontents}[force]{\jobname.bib}
@book{Duden,
title = {Duden},
subtitle = {Die deutsche Rechtschreibung},
edition = 24,
location = {Mannheim},
year = 2006
}
\end{filecontents}
\documentclass{article}
\usepackage{polyglossia}
\usepackage{biblatex}
\setmainlanguage[variant=austrian]{german}
\addbibresource{\jobname.bib}
\begin{document}
\babelname
\nocite{*}
\printbibliography
\end{document}

With lualatex:

Module polyglossia Warning: Language naustrian not found in language.dat.lua on
 input line 20

Package biblatex Warning: No hyphenation patterns for 'naustrian' on input line
 20.

With xelatex:

Package biblatex Warning: No hyphenation patterns for 'naustrian' on input line
 20.

@jspitz, if you can fix this for German, I will do the same for Latin thereafter.

jspitz commented 4 years ago

Done for German. There is some problem still with latestpatterns, but this seems to be beyond our scope.

wehro commented 4 years ago

Thanks, @jspitz. My proposal for a Latin fix is here: reutenauer/polyglossia#378 As this removes the dots from the “babel names” of polyglossia, biblatex now exspects language modules latinecclesiastic.lbx, latinclassic.lbx etc. However, using babel and its dot modifiers, biblatex requests a file latin.lbx in all cases. So we have no full compatibility. Is it possible to create a latin.lbx file with links to latinecclesiastic.lbx etc. for babel?

moewew commented 4 years ago

However, using babel and its dot modifiers, biblatex requests a file latin.lbx in all cases. So we have no full compatibility. Is it possible to create a latin.lbx file with links to latinecclesiastic.lbx etc. for babel?

We don't have a good way to deal with dot modifiers in biblatex at the moment. It was brought up the context of Serbian support in #937. #938 deals with detecting modifiers. In #939 we deal with how biblatex should handle language variations. Currently I have no idea what to do. So ideas would be appreciated.

jspitz commented 4 years ago

The hyphenation patterns are called latinecclesiastic latin with babel as well, so I'd expect that biblatex needs to use that in the context we discussed, notwithstanding the name of the (babel) lbx file.

[Edit: latinecclesiastic uses the (modern) latin patterns in babel.]

moewew commented 4 years ago

Erh. This really shouldn't have been closed by my bringing my fork of polyglossia up to date. Sorry about this. Reopened.

moewew commented 4 years ago

Yes, we need to handle hyphenation pattern names that differ from the language identifier. Thing is I don't really know how and I think this isn't really biblatex's job: We can't know what hyphenation pattern name the user has, because we don't set it. I guess I could sort of pressure you (as in "the polyglossia maintainers") to open an interface that records the hyphenation pattern name set for each language, but I'm doubtful that this works for babel since the language modules are all maintained by different people.

jspitz commented 4 years ago

I think the issue is solved on the polyglossia side, as we now define aliases (via \adddialect) for all the affected cases. The question is what to do with babel. As for ecclesiastic, the babel-latin people could introduce a portmanteau file latinecclesiastic.ldf which loads latin with the ecclesiatic modifier and defines a pattern alias \adddialect\l@latinecclesiastic\l@latin. Then biblatex would work for that case as well.

The issue with the dot modifier is that it might look elegant on the UI side, but it really is a PITA for other packages (as biblatex, tracklang etc. indicate)

moewew commented 4 years ago

I'm wondering if it wouldn't be easier if polyglossia's \babelname (and friends) would not return the dot modifiers. After all, babel's \languagename doesn't expose the dot modifiers either. Since polyglossia has an interface to query the modifiers (https://github.com/reutenauer/polyglossia/issues/364, thanks again for all the hard work!) there seems to be no need to also reproduce the modifiers in the string (which are nasty to deal with for anyone who gets them anyway).

Of course that would mean that all latin variants use the same .lbx file and that we need to deal with #939.

jspitz commented 4 years ago

Yes, as of https://github.com/reutenauer/polyglossia/commit/92deec6cce71ddd3db11f9ecea87549bce3deabd, we do not return the dot modifier any longer, but latinecclesiastic etc.1 This is not really any longer a babel name, unfortunately, but if we do not have a proper one, what are we supposed to do? So let's try and urge the babel-latin colleagues to introduce portmanteau files.

1 For the other case I am aware of, spanish.mexico, we never did it: we return spanishmx, but in that case, babel-spanish also supports such a portmanteau file.

moewew commented 4 years ago

I guess in that case I'd much rather be given babelname=latin, and be left to deal with the rest myself (sift through the options). The trouble with made up things is that no one else has a way to deal with them ready.

jspitz commented 4 years ago

In the specific case of ecclesiastic, you might have a point, as the ecclesiastic package unfortunately does not introduce \extraslatinecclesiastic and friends, but mis-uses \captionslatin for that (which I think is a bad choice). The downside is, though, that our promise with babelnames was to have one way to really distinguish all language varieties clearly. Thus I am reluctant to water down this principle just because of design flaws in babel-latin.

moewew commented 4 years ago

The whole reason why I bothered you about the babel-equivalent names was so we wouldn't have to think too hard about whether a user uses polyglossia or babel once we have the general language handling set up. If babel and poylglossia now diverge in their "babel-equivalent" interface for languages, then this whole exercise becomes a bit pointless: We are forced to treat languages differently and will need different files depending on whether or not babel or polyglossia is used.

That said, I fully understand that this whole business is messy and appreciate that you have already done a lot on the polyglossia side, so I'll probably have to accept that there are differences that we will have to live with. And as long as they only apply to latin it probably doesn't bother me too much, the number of Latin speakers who also use LaTeX would appear to be quite small.

moewew commented 4 years ago

Ah, I only saw your reply after I posted the comment above.

That would explain things: I want babelname to be a babel-equivalent, so I just have to deal with babel and get on with it, you are more interested in uniqueness...

jspitz commented 4 years ago

I think the point is that it seems impossible to properly support (babel) ecclesiastic latin from biblatex as it currently stands. The ecclesiastic package pollutes \extraslatin if ecclesiatic is loaded and cleans it up again when the language is closed (to make the parallel use of classic latin possible). AFAIU how biblatex chimes in, I think there is no way now to add things to ecclesiastic only without adding it to classic standard latin as well.

This is why I think this must be cleaned up on the babel side of the world.

jspitz commented 4 years ago

@moewew does biblatex also hook into \captions, or only into \extras? I am asking as I have just learned that babel-latin does at least use \extrasclassiclatin and \extrasmedievallatin (so we should probably use these babelnames), but all varieties write into \captionslatin :ng_man:

moewew commented 4 years ago

biblatex only uses \extras<language>, so we should be good there, but when I tested

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[latin.ecclesiastic]{babel}
\usepackage{csquotes}

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

\addbibresource{biblatex-examples.bib}

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

biblatex complains that

! Package biblatex Error: Patching 'babel' package failed.

which seems to be due to ecclesiastic.sty (the packages seems to mess with catcodes and other stuff a lot). So there seem to be bigger fish to fry before biblatex works with babel's latin.ecclesiastic at all.

I might be wrong here, but I think the "different dot variants of latin write into the same macro" is a non-issue: As far as I understand you can only set babel's dot identifiers and language attributes in the preamble and they are then fixed for the entire document. So as soon as a user has decided on their language attributes, that can become "latin" (and we only need to be able to query which attributes are set if we want to do something that is sensitive to attributes).

jspitz commented 4 years ago

I might be wrong here, but I think the "different dot variants of latin write into the same macro" is a non-issue:

But still how would you add something to \extras that is only used by ecclesiastic latin and not by standard latin? I know babel has \bbl@ifattributeset, but this does not strike me very practical. Wouldn't it be so much easier if there was \extrasecclesiasticlatin?

moewew commented 4 years ago

But still how would you add something to \extras that is only used by ecclesiastic latin and not by standard latin?

Good question, I guess I would use \bbl@ifattributeset in some way or other. (I haven't given it much thought, though.) It isn't great but it would be doable.

Wouldn't it be so much easier if there was \extrasecclesiasticlatin?

Yes, it would be, but we have to work with what we've got. It's a similar situation for Serbian and its attributes. Unless all babel modules decide to go for a unified scheme, we are better off using what we can guarantee (\bbl@ifattributeset and documented attributes/dot modifiers).

Since babel language modules are maintained outside of babel - and usually not even by the babel maintainer -, it seems unlikely we can easily effect change there. (That's the upside of keeping all language modules in the main package like polyglossia and biblatex currently do.)

jspitz commented 4 years ago

Since babel language modules are maintained outside of babel and usually not even by the babel maintainer it seems unlikely we can easily effect change there.

Frankly I was hoping that @wehro feels motivated to do that since he's involved in all sorts of Latin-related LaTeX projects already ;-)

wehro commented 4 years ago

Thank you for this interesting discussion despite the fact that Latin is of minor interest for LaTeX people and LaTeX is of minor interest for latinists.

So let's try and urge the babel-latin colleagues to introduce portmanteau files.

By the way, the “babel-latin colleague” is me, as I took over maintenance from Claudio. So far, I have not changed anything, I have not even worked in the code. I will do whatever I can to improve the situation, but I suppose it will be more difficult as with polyglossia. For me, it is especially important to support ecclesiastic Latin with LuaLaTeX (which is currently impossible with babel), as the gregoriotex package requires LuaLaTeX.

jspitz commented 4 years ago

By the way, the “babel-latin colleague” is me

Aha, I somewhat anticipated that. Excellent :-)

wehro commented 4 years ago

1 For the other case I am aware of, spanish.mexico, we never did it: we return spanishmx, but in that case, babel-spanish also supports such a portmanteau file.

To see how the problem is solved in other languages, I took a look to babel-spanish. The situation is quite confused.

It turned out, that babel-spanish does not support a dot modifier mexico. You can say \usepackage[spanish.mexico]{babel} without any error messages, but the result is the same as for \usepackage[spanish]{babel}. babel-spanish defines mexico as a package option. That means, you have to say \usepackage[spanish,mexico]{babel} (note the comma) to get Mexican localisation.

The file spanishmx.ldf is not part of babel-spanish, but of a separate package (called spanish-mx), which does not work out of the box. It is not possible to say \usepackage[spanishmx]{babel}. Even if you follow the installation instructions given by the maintainer, you have to use \usepackage[spanish]{babel} and the Mexican localisation does not work entirely as \tablename remains Cuadro instead the Mexican Tabla. I consider this package as outdated and not at all useful nowadays.

We should consider to use another babel name instead of spanishmx for Spanish with variant=mexican in polyglossia. This currently yields two error messages with biblatex and lualatex:

Package biblatex Warning: Language 'spanishmx' not supported.
(biblatex)                Using fallback language 'english' on input line 15.
Module polyglossia Warning: Language spanishmx not found in language.dat.lua on
 input line 19

These observations do not really help for Latin. I will comment on the Latin case later.

jspitz commented 4 years ago

We should consider to use another babel name instead of spanishmx for Spanish with variant=mexican in polyglossia.

I don't know a better one.

This currently yields two error messages with biblatex and lualatex:

Package biblatex Warning: Language 'spanishmx' not supported.
(biblatex)                Using fallback language 'english' on input line 15.
Module polyglossia Warning: Language spanishmx not found in language.dat.lua on
 input line 19

Sure, since there is no spanishmx.ldf in biblatex (yet).

wehro commented 4 years ago

I hesitated for a long time to continue working on this issue, because two conflicting opinions came up here, as summarized by @moewew:

That would explain things: I want babelname to be a babel-equivalent, so I just have to deal with babel and get on with it, you are more interested in uniqueness...

Obviously, both approaches have advantages and disadvantages.

As for Spanish, I still don't think it is wise to return spanishmx as “babel name”, because that means that a polyglossia user saying \setmainlanguage[variant=mexican]{spanish} cannot create a Spanish-speaking bibliography with biblatex, even if biblatex supports Spanish.

As for Latin, I tend to follow @jspitz' suggestion to create formally different babel languages for all four variants of Latin, because everything is in my hand here and I can make sure compatibility between biblatex, babel and polyglossia. This means, that the language modules classiclatin.ldf, medievallatin.ldf, latin.ldf, and ecclesiasticlatin.ldf are needed. The obvious disadvantage is, that existing packages with Latin language support will only support modern Latin after this change if they are not changed themselves. However, the only relevant package I know is blindtext, so the problem is not that big.

If no one objects, I am going to begin the revision of babel-latin now, but it may take some months.

jspitz commented 4 years ago

@wehro looks like a good plan to me.