RE8: Lots of undefined control sequences when using Arabic Babel

outlook user RACP at outlook.fr
Mon May 13 09:39:27 CEST 2024


> you are still in the English language

Using the very example made to write Arabic

> If you switch languages

I get all the errors we talk about in those exchanges. Babel maintainer should do something or trigger a warning if it's intended behaviour

> `\selectlanguage{arabic}`

It's a method I was using before switching to defining in Babel because I read it's best practice and basically the same thing. It's even more logical when you use only one language document wide to not use a context switching control sequence

Comment out line 14 to see the phenomenon:

```LaTeX
\documentclass{article}

\usepackage{translations}

\DeclareTranslation{Arabic}{text}{ ﻓﺼﺤﻰ اﻟﻌﺼﺮ }

\usepackage{babel}

\usepackage[T1]{fontenc} % No effect before `babelfont`. Probably because it reconfigures things right after it

\babelfont{rm}{FreeSerif}

\usepackage
[T1] % Without it pdfLaTeX complains about OT1, with it luaLaTeX doesn't write Arabic. If commented out, Arabic prints out fine. If uncommented, no Arabic
{fontenc}

\begin{document}

\selectlanguage{arabic}

\GetTranslation{text}

\end{document}
```
________________________________________
De : Sam Carter <sam.carter8 at aol.com>
Envoyé : dimanche 12 mai 2024 21:44
À : outlook user <RACP at outlook.fr>
Cc : David Carlisle <d.p.carlisle at gmail.com>; texhax at tug.org <texhax at tug.org>
Objet : Re: RE6: Lots of undefined control sequences when using Arabic Babel
 
In your MWE, you use the translation when you are still in the English language. If you switch languages, you get your translated text:

```
% !TeX TS-program = lualatex
\documentclass{book}

\usepackage{translations}
\usepackage[english, bidi=basic]{babel}

\babelprovide[onchar=ids fonts]{arabic}
\babelfont{rm}{Crimson}
\babelfont[*arabic]{rm}{FreeSerif}

\DeclareTranslation{Arabic}{text}{ ﻓﺼﺤﻰ اﻟﻌﺼﺮ }

\begin{document}

\selectlanguage{arabic}

\GetTranslation{text}

\end{document}
```

> On 12. May 2024, at 21:26, outlook user <RACP at outlook.fr> wrote:
>
> Running that code:
>
> ```LaTeX
> \documentclass{book}
>
> \usepackage{translations}
> \usepackage[english, bidi=basic]{babel}
>
> \babelprovide[onchar=ids fonts]{arabic}
> \babelfont{rm}{Crimson}
> \babelfont[*arabic]{rm}{FreeSerif}
>
> \DeclareTranslation{Arabic}{text}{ ﻓﺼﺤﻰ اﻟﻌﺼﺮ }
>
> \begin{document}
>
> \GetTranslation{text}
>
> \end{document}
> ```
>
> Produces that: <www.overleaf.com_project_64d8d3ea4e14d9b8f46185a1.png>
> Where it should output Arabic characters
>
> > you have some other issue
>
> That problem is reproducible, you can copy-paste the MWE to see it. So it's not about me having a problem
>
> > can not read it
>
> No need for it. I literally copied the Arabic characters from the example you sent me in my own MWE. It's only about being able to output those rather than understand them
>
> >> you would have an error about missing fonts
>
> > Package fontspec Warning: Font 'Crimson' is using the default features for language 'English'. That's usually fine, because many languages require no specific features, but if the output is not as expected, consider selecting another font.
> > Package fontspec Warning: Font 'FreeSerif' is using the default features for language 'Arabic'. That's usually fine, because many languages require no specific features, but if the output is not as expected, consider selecting another font.
>
> No errors otherwise. Disappears if I delete `\babelfont{rm}{Crimson}\n\babelfont[*arabic]{rm}{FreeSerif}`
>
> But it's not about that anyway, because if it was about font problem, there won't be "text" written. The engine would try to output Arabic and would output nothing because failing to do so. Here it outputs the tag without even trying to output it in Arabic
>
>
> De : David Carlisle <d.p.carlisle at gmail.com>
> Envoyé : dimanche 12 mai 2024 20:46
> À : outlook user <RACP at outlook.fr>
> Objet : Re: RE4: Lots of undefined control sequences when using Arabic Babel
> 
>
> On Sun, 12 May 2024 at 17:12, outlook user <RACP at outlook.fr> wrote:
> That code creates the same case as
>
> > `\usepackage{babel}` with or without `\babelprovide{arabic}` doesn't output any Arabic, only latin text [...]. In fact `babelprovide` doesn't change anything to the case here
>
> Don't produce errors but no Arabic text outputed
>
> The code posted produces
>
> <image.png>If you are not seeing Arabic text you have some other issue I can't help, sorry I am no expert on Arabic, and can not read it.
> If you don't have the font installed you would have an error about missing fonts.
>
> David
>
>
> 
> ```LaTeX
> \documentclass{book}
>
> \usepackage{translations}
> \usepackage[english, bidi=basic]{babel}
>
> \babelprovide[onchar=ids fonts]{arabic}
> \babelfont{rm}{Crimson}
> \babelfont[*arabic]{rm}{FreeSerif}
>
> \DeclareTranslation{Arabic}{text}{ ﻓﺼﺤﻰ اﻟﻌﺼﺮ }
>
> \begin{document}
>
> \GetTranslation{text}
>
> \end{document}
> ```
> ________________________________________
> De : David Carlisle <d.p.carlisle at gmail.com>
> Envoyé : dimanche 12 mai 2024 17:57
> À : outlook user <RACP at outlook.fr>
> Cc : texhax at tug.org <texhax at tug.org>
> Objet : Re: RE2: Lots of undefined control sequences when using Arabic Babel
> 
>
> I do not read arabic, but see the babel manual for some arabic examples, eg the following (which requires lualatex)
>
> \documentclass{book}
> \usepackage[english, bidi=basic]{babel}
>
> \babelprovide[onchar=ids fonts]{arabic}
>
> \babelfont{rm}{Crimson}
> \babelfont[*arabic]{rm}{FreeSerif}
>
> \begin{document}
>
> Most Arabic speakers consider the two varieties to be two registers
> of one language, although the two registers can be referred to in
> Arabic as ‫\ ﻓﺼﺤﻰ اﻟﻌﺼﺮ \textit{fuṣḥā l-ʻaṣr} (MSA) and
> ‫\ ﻓﺼﺤﻰ اﻟﺘﺮاث \textit{fuṣḥā t-turāth} (CA).\end{document}




More information about the texhax mailing list.