AtruhaTeX

The AtruhaTeX guide

Write in Arabic and English

Write with a direction for each source line, then configure Arabic output separately.

About this guide

These instructions describe the desktop application and its configured services. For the hosted browser editor, start with the AtruhaTeX Web guides above. Desktop menu names and service settings may differ from Web.

Direction belongs to each source line

In Source, Arabic prose starts from the right and English prose from the left. AtruhaTeX determines each line’s direction from its text, with rules for LaTeX syntax. The active typing surface follows that direction and alignment, so changing lines can change the starting edge of the caret. Type sentence punctuation in its normal order; its position follows the line’s bidirectional context. This works in the editor before compilation and does not require switching the interface language.

Keep commands and mathematics readable

LaTeX command groups and mathematics keep their left-to-right syntax inside an Arabic line. A formatting command such as \textbf{النتائج} follows the Arabic prose direction, while a line beginning with the structural command \section{النتائج} remains left to right. English prose remains left to right on the next line. These rules preserve source order; they do not insert PDF language settings. The example below shows logical source text, not the editor’s rendered line alignment.

نكتب النتائج بالعربية، ثم نراجعها.
We report the same result in English.
توضح المعادلة $E = mc^2$ العلاقة.
\textbf{النتائج} متسقة مع القياس.
\section{النتائج}

Continue onto an empty line

An empty line inherits the previous nonempty line’s direction. After Arabic prose, the new blank line therefore keeps its right-to-left starting position. Once you type content, its direction is determined again. Empty lines at the beginning of a document default to left to right. Comments and known structural commands remain left to right, even when they contain Arabic.

Configure Arabic PDF output

Source-editor direction and PDF typesetting have separate settings. For PDF output, open File → Template Library and select Arabic report. Check dependencies before creating a new local project. This starter chooses XeLaTeX, loads fontspec and polyglossia, sets Arabic as the main language, and uses the Amiri font files provided by TeX. Its introduction is a separate chapter file.

\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{arabic}
\newfontfamily\arabicfont[
  Script=Arabic,
  BoldFont=Amiri-Bold.ttf,
  ItalicFont=Amiri-Italic.ttf,
  BoldItalicFont=Amiri-BoldItalic.ttf
]{Amiri-Regular.ttf}

Mark English passages for the PDF

In a polyglossia document, declare English as another language in the preamble. Use its language commands around an English phrase, especially where it meets Arabic punctuation or numbers. Keep mathematical notation in a math environment. The fragment below is a LaTeX authoring example; compile it with the rest of your Arabic document to check the selected fonts and direction.

% Add to the preamble:
\setotherlanguage{english}

% Add inside the document:
نقارن النتائج باستخدام \textenglish{research methods}.
\[
  E = mc^2
\]

Set the right kind of font

Settings → Editor controls the Arabic editor font and size. Settings → Appearance controls Arabic interface fonts, and Language selects the interface language. These choices change your workspace, not the fonts embedded in the compiled publication. Set publication fonts in the LaTeX preamble and make sure the compiler can find them.

Check the compiled result

Compile and inspect Arabic shaping, mixed-language phrases, punctuation, numerals, citations, and equations in the PDF. If the compiler reports that fontspec needs a different engine, choose XeLaTeX or LuaLaTeX and recheck the project’s language setup. If Amiri cannot be found, install the relevant font package or select an available Arabic font in the source.

The optional Arabic dictionary is disabled in this release. Arabic editing, fonts, and mixed-direction text remain available.