38

Which are the key questions one has to ask to decide between Polyglossia and Babel for a LuaLaTeX project in 2019?

There has been a similar, more general question in 2012, but the packages have changed a lot in the meantime. Hence I open a new, more specific question.

Can we reduce it to a check list like

Use package A, if you need

  • utf-8 characters
  • right to left support

Use package B, if you need

  • package foo, because A breaks foo
Jonas Stein
  • 8,909
  • 2
    Would you be OK with expanding the question to XeLaTeX as well, so this question is truly a more modern version of the other one or do you think it would be more useful to have a separate XeLaTeX question (I don't know if there are relevant differences between the two, but I think babel's new RTL support works better for LuaLaTeX than XeLaTeX, though I could be completely wrong.) – moewe Mar 31 '19 at 10:22
  • 1
    For packages like csquotes and biblatex, but also some others like https://ctan.org/pkg/tracklang and packages using it polyglossia has the disadvantage that it does not expose language variants in a way that can be picked up easily by those packages. That means that there are some rough edges with dialect forms (english, british, american; ngerman, german, naustrian, ...). See for example https://tex.stackexchange.com/q/432347/35864. Most of those packages won't exactly break with polyglossia, but they work better/smoother with babel. – moewe Mar 31 '19 at 10:27
  • 2
    I don't think there is any reason to use polyglossia over babel for lualatex. – David Purton Mar 31 '19 at 10:33
  • 2
    @JonasStein why would you think that? There are still many scripts that luatex does not support. – David Carlisle Mar 31 '19 at 11:35
  • I’ve frequently tried to answer questions and write MCVEs about languages that babel supports and polyglossia doesn’t. Sorry if that’s an obvious point. – Davislor Mar 31 '19 at 13:28
  • 1
    On the other hand, some language files for babel still use obsolete encodings by default in a way that requires workarounds for a LuaLaTeX source file in UTF-8, and the \babelfont mechanism is somewhat kludgy; I’ve found, for example, that it disables Ligatures=TeX. – Davislor Mar 31 '19 at 13:32
  • 2
    @Davislor It's even worse -- \defaultfontfeatures is ignored altogether. This is a bug, already fixed on the repository. I'll upload the new version to CTAN very likely tomorrow. – Javier Bezos Mar 31 '19 at 17:48
  • @JavierBezos That explains the problems I was having with Scale. – Davislor Mar 31 '19 at 18:14
  • @Davislor Yes. I commited the fix 12 days ago. See https://github.com/latex3/latex2e/commit/5c8c78416908c06dac7457ba7e324733c28c867b#diff-7f361ed9d5b1603be6a4176a34e39a08 . – Javier Bezos Mar 31 '19 at 18:28
  • 1
    @JonasStein You can find some notes on the scripts supported by luatex on https://github.com/latex3/latex2e/wiki/Babel:-Remarks-on-the-luatex-support-for-some-scripts . – Javier Bezos Mar 31 '19 at 18:33
  • 1
    @moewe Thank you for your suggestion. The situation for XeLaTeX and LuaLaTeX is not 100% the same. I have created the pendant for XeLaTeX too. So we have a more specific, less broad question and it fits better to the sx scheme. See https://tex.stackexchange.com/questions/482611/decide-between-polyglossia-and-babel-for-xelatex-in-2019 – Jonas Stein Apr 01 '19 at 16:19

3 Answers3

38

Here's some reasons why I prefer babel over polyglossia for LuaLaTeX.

  • babel's base is part of the LaTeX core packages actively developed, but polyglossia is only getting a few minor updates.
  • babel's RTL and BiDi support is really nice for LuaLaTeX now. But polyglossia only supports RTL text with XeLaTeX.
  • babel's new ini system for setting up languages is very neat and I think will improve rapidly. It also makes it easy to add new languages and update existing languages.
  • babel's font support is easier to use to set up standard families for different languages, whereas polyglossia basically just uses standard fontspec calls.
  • For standard European languages babel's support is very mature.
  • polyglossia's language variants do not work well with biblatex or csquotes.

You might choose polyglossia if you want to write a RTL only document with XeLaTeX, as the bidi package has been around for a long time. But if the main document language is LTR, I wouldn't do this now as babel and LuaLaTeX is better and involves less hacks and workarounds. You might also choose to use polyglossia with XeLaTeX if you need certain complex scripts that LuaLaTeX still does not handle well. But none of these reasons justify choosing polyglossia over babel if you have already decided to use LuaLaTeX.

David Purton
  • 25,884
  • 9
    Just for the records, most of the issues here are no longer true: polyglossia is actively developed again; polyglossia does support RTL with LuaTeX; the only remaining LuaTeX issues are due to LuaTeX restrictions wrt font rendering; polyglossia has easy support to setup fonts for different languages/script; as of 1.45, polyglossia has an extended language interface that lets other packages access variants in all detail (will be used by biblatex 3.14 and csquotes 5.2f). – JSpitzm Nov 12 '19 at 03:56
  • I doubt there are less hacks in babel since polyglossia is the newer code and it claims to be more modern. – tanGIS Jun 13 '20 at 19:11
  • @tanGIS, I'm referring to the bidi package. TeX does not do RTL well. Babel uses Lua code for RTL things. – David Purton Jun 14 '20 at 10:06
  • 1
    @DavidPurton you should rewrite your answer. It's not clear that you refer to bidi regarding hacks. Besides there is luabidi which makes it possible to use RTL with polyglossia also under LuaHBTeX or LuaLaTeX. I do find it unfair to claim polyglossia is not actively developed when there are several updates a year. – tanGIS Jun 14 '20 at 22:08
  • 4
    @tanGIS, at the time this answer was written there were no updates to polyglossia and luabidi was next to useless. LuaHBTex was not released. JSpittzm has already noted in the comments that most of these objections are no longer true. Since I have not had time to carefully investigate things now for myself I have not updated the answer. Perhaps the best option is for you to add a new answer that better reflects the current state of things. – David Purton Jun 14 '20 at 23:08
24

There are 79 language definition files (gloss-XX) in the polyglossia folder. For a thorough comparison you would have to compare for every language how good the gloss-file is, if it works with lualatex, if babel provides definitions for this language too and how good it works with lualatex. And naturally you also need to check if babel knows a language which polyglossia doesn't have. That's a lot of work which I won't do (but it is known that the French module is clearly better in babel).

For all languages relevant to me I prefer today babel over polyglossia. Even more so if I use lualatex as babel has more lualatex specific code (polyglossia) has been developed with xelatex in mind).

babel is better maintained and its interface for other packages which need language support (biblatex) is better.

Ingmar
  • 6,690
  • 5
  • 26
  • 47
Ulrike Fischer
  • 327,261
2

Unfortunately I am not able to provide a holistic answer to the question. But I know polyglossia does the job for me. Since end of 2019 it is also quite active again. There is one point where polyglossia beats babel:

  1. polyglossia provides long-s (ſ) captions with the option blackletter.

Edit: There used to be a second point about language metadata which is resolved as of hyperxmp 5.4. Thumbs up for Scott and Javier for resolving this quickly.

tanGIS
  • 1,645
  • 15
  • 32
  • Thanks for adding this! – David Purton Jun 15 '20 at 11:31
  • 1
    babel does provide BCP 47 tags (about 250): https://github.com/latex3/babel/wiki/What's-new-in-babel-3.43 . And long-s is certainly possible with babel. – Javier Bezos Jun 15 '20 at 11:47
  • @JavierBezos the BCP47 codes cannot be used by hyperxmp today and there is no blackletter option in babel, isn't it? – tanGIS Jun 15 '20 at 16:28
  • There in no option, indeed, but as to hyperxmp what you are saying now (after an edit) is not what you said originally in the post. babel does provide BCP 47 tags to other packages. If other packages are not using that information is not a limitation in babel. – Javier Bezos Jun 15 '20 at 16:47
  • From my point of view I did not change the meaning with my edit but we are both no native English speakers. I am willing to learn: How does babel return the BCP47 code if I chose the language with \usepackage[german]{babel}? – tanGIS Jun 15 '20 at 16:56
  • 1
    \documentclass{article} \usepackage[german]{babel} \BabelEnsureInfo \begin{document} \localeinfo{tag.bcp47} \end{document}. See page 34 in the manual for other keys (which have been in the ini files bundled with babel for several years). – Javier Bezos Jun 15 '20 at 17:04
  • 1
    Thanks! I sent a link to this question to Scott Pakin from hyperxmp. I am positive he will implement support for babel as well if feasible. – tanGIS Jun 15 '20 at 17:07
  • 2
    I willing to help Scott, if he wants. – Javier Bezos Jun 15 '20 at 17:11