latex3 / babel

The babel system for LaTeX, LuaLaTeX and XeLaTeX
LaTeX Project Public License v1.3c
124 stars 34 forks source link

Set a maximum stretchability for kashida in Arabic #242

Closed amarakon closed 1 year ago

amarakon commented 1 year ago

I know that I can control the ratio of kashida to space justification with \directlua{Babel.arabic.justify_factor = n} where n is any number between 0 and 1. I always like to set this to 1. Full kashida justification looks good on lines that aren’t stretched too much. But on lines that are unluckily extremely stretched, it looks bad, and I would prefer to start use spacing to justify that line. In the following image, you will see that all of the lines look great, except for the second line which has too much kashida.

import-2023-05-11_20:35:30

The problem with Babel.arabic.justify_factor is that it applies globally. I propose for the ability to set the maximum amount the kashida is allowed to stretch and from then it should start using spacing to achieve justification, regardless of the justification factor.

jbezos commented 1 year ago

If I understood correctly, basically what you want is to force a maximum in the number of tatwil (for example, 4).

amarakon commented 1 year ago

I initially thought to be able to set a length of the maximum amount the tatweel can be. But I did not know that the tatweel can't be stretched arbitrarily, and that there has to be an integer number of tatweel. So to answer your question: Yes, I want to be able to force a maximum in the number of tatweel.

jbezos commented 1 year ago

There is a Unicode character for the tatweel (U+0640). babel adds it at the appropriate places as set by the active transforms, and in the appropriate number. This feature will be available in the next release (written, but not yet committed).