Skip to content

Improve RTL language support: heading numbering order and cover page alignment - #38

Open
nakibrayane wants to merge 2 commits into
talal:mainfrom
nakibrayane:rtl-cover-page
Open

Improve RTL language support: heading numbering order and cover page alignment#38
nakibrayane wants to merge 2 commits into
talal:mainfrom
nakibrayane:rtl-cover-page

Conversation

@nakibrayane

@nakibrayane nakibrayane commented Jun 12, 2026

Copy link
Copy Markdown

Summary

This PR improves Right‑to‑Left (RTL) language support in the ilm template. It fixes two issues that affect documents using languages such as Arabic (ar), Hebrew (he), Persian (fa), and others:

  1. Heading numbering order – Nested headings (level 2 and deeper) previously displayed numbers in reverse order (e.g., 2.1 instead of 1.2).
  2. Cover page alignment – The cover page content (title, authors, abstract, date) was always left‑aligned, which feels unnatural for RTL scripts.

Both fixes are applied automatically based on the document’s active language (#set text(lang: ...)). No changes to existing documents are required.

Problem details

1. Heading numbering

With #set text(lang: "ar"), a second‑level heading under chapter 1, section 2 would incorrectly render as 2.1:

#set text(lang: "ar")
#set heading(numbering: "1.1")
= الفصل الأول
== القسم الثاني   // displays as "2.1" instead of "1.2"

@nakibrayane
nakibrayane deleted the rtl-cover-page branch June 12, 2026 17:02
@nakibrayane nakibrayane reopened this Jun 12, 2026
@nakibrayane nakibrayane changed the title Fix heading numbering order for RTL languages Improve RTL language support: heading numbering order and cover page alignment Jun 12, 2026
The cover page now respects the document's language direction.
When `#set text(lang: ...)` is an RTL language (Arabic, Hebrew,
Persian, etc.), the title block aligns to the right (`right + horizon`).
For LTR languages, it remains left-aligned.

This improves readability for RTL documents and complements the
existing heading numbering workaround.
@talal

talal commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Hi, thanks for the PR.

I'm a bit busy at the moment, I'll review and merge later when I have some free time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants