Right-to-left languages in English document

15 views
Skip to first unread message

Charles M

unread,
May 12, 2026, 4:45:46 PM (14 days ago) May 12
to PreTeXt support
I am currently authoring a book on mathematics history, and I am including names, sentences, and entire paragraphs in Arabic.  When I compile for HTML output, the output is perfect.  When I compile for PDF, the correct Arabic text appears after the parentheses in which is should display.  

I tried including \usepackage{polyglossia} in <latex-preamble-elements>, but it didn't resolve the issue.  Here is a snippet from my code.

While we cannot guarantee that it is a true and correct copy of Omar Khayyam's original text, Dr T Irani published in 1936 in Tehran what purports to be a copy of Omar Khayyam's original treatise <em>A Message on the Difficulties in the Propositions of Euclid</em> (رسالة في شرح مااشكل من مصادرات كتاب اقليدس). On pages 10 and 11, we see very clearly Khayyam's discussion and depiction of what we know today as a Saccheri quadrilateral. <xref ref="Khayyam1936" />

I also noticed just now that Лобачевский (in another paragraph) did not render in the PDF output.

This is a low-priority concern for me, so please don't spend too much time on this, unless you already have a quick fix.

With much gratitude and kind regards,
Charles

Rob Beezer

unread,
May 13, 2026, 12:28:36 PM (13 days ago) May 13
to pretext...@googlegroups.com
Dear Charles,

Languages and scripts are hard. ;-) But as you have discovered, Unicode source
to HTML output works pretty well. LaTeX/PDF is a bigger battle.

About two years ago, there was interest (and help) with supporting Kurdish, and
that is the one RTL language we have. The language code is "ku-CKB" and we have
a full localization file for that. Note that locale/@direction is an
attribute taking the value "rtl".

Paragraphs or divisions in a different language are manageable. I'm not sure
what should happen with a parenthetical comment *inside* a paragraph, especially
if direction changes. But at a minimum, that comment needs some sort of PreTeXt
markup delineating it. Maybe like an HTML #span, though we will never have
anything so generic. But we do have #foreign, as in

<foreign xml:lang="fr-FR">c'est la vie</foreign>

We have nothing explicit in the LaTeX conversion. We already load "polyglossia"
and use it to set a main language (English) and any "other" languages (Arabic).
No idea how smoothly adding a language code for Arabic might go.

Maybe experiment with the Kurdish language code?

Send me a language code for Arabic (does it vary by country?). And is there a
popular LaTeX font you like for the glyphs? By popular, I mean available as an
OTF (system) font via a typical TeX installation/distribution.

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com <mailto:pretext-
> support+u...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-support/
> bb4dbc05-d68b-4640-9f8c-453fdff48ab5n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-support/bb4dbc05-
> d68b-4640-9f8c-453fdff48ab5n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Reply all
Reply to author
Forward
0 new messages