Fonte árabe para documentclass {exam}
Meu código
\documentclass{exam}
\pagestyle{headandfoot}
\firstpageheader{\bfseries\large رياضيات\\مأمون }{\includegraphics{example-image}}{\bfseries\large الإمتحان الأول }
\begin{document}
مرحبا كيف حالكم, جزاكم الله كل خير
\begin{table}
\begin{tabular}{lllll}
الوحدة & فصول الوحدة & عدد الحصص & الفترة الزمنية & الوسائل المقترحة\\
\end{tabular}
\end{table}
\end{document}
Todos esses códigos não funcionaram.
\usepackage{polyglossia}
\setmainlanguage[numerals=maghrib]{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.1,AutoFakeSlant=-0.03]{Amiri}
\setsansfont[Script=Arabic,Scale=1.1]{Amiri}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script = Arabic]{Simplified Arabic}
\usepackage{sexam} % wexam & sexam package
%\setdefaultlanguage[calendar=gregorian,,locale=algeria]{arabic} % on sexam.sty
%\newfontfamily\arabicfont[Script=Arabic,Scale=1.1]{Amiri}% on sexam.sty
%\newfontfamily\arabicfontsf[Script=Arabic,Scale=1.2]{Aljazeera}% on sexam.sty
%\newfontfamily\arabicfonttt[Script=Arabic,Scale=1.1]{Simplified Arabic} % on sexam.sty
Respostas
LuaLaTeX requer o renderizador HarfBuzz para mostrar scripts complexos com combinação de caracteres, mas seleciona o renderizador antigo por padrão. Isso pareceu funcionar para mim (embora eu não saiba árabe e peço desculpas se o texto estiver errado)
\documentclass{exam}
\usepackage{polyglossia}
\setmainlanguage[numerals=maghrib]{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont{Amiri}[
Script=Arabic,
Scale=MatchLowercase,
AutoFakeSlant=-0.03, % Are you sure?
Renderer=HarfBuzz ]
\pagestyle{headandfoot}
\firstpageheader{\bfseries\large رياضيات\\مأمون }{}{\bfseries\large الإمتحان الأول }
\begin{document}
مرحبا كيف حالكم, جزاكم الله كل خير
\end{document}
Também seria possível usar babel. Este MWE carrega as fontes Libertinus de Khaled Hosny, incluindo Libertinus Math, como companheiros para sua fonte Amiri.
\documentclass{exam}
\usepackage[bidi=basic,layout=sectioning.tabular,english]{babel}
\usepackage{unicode-math}
\babelprovide[import,main]{arabic} % You might select a variant here.
\defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX, Renderer=Harfbuzz }
\babelfont{rm}
[Scale=1.0, Ligatures={Common,Discretionary}]{Libertinus Serif}
\babelfont[arabic]{rm}
{Amiri} % Might want to load a stylistic set or activate font features.
\babelfont{sf}
[Ligatures={Common,Discretionary}]{Libertinus Sans}
% Load a sans-serif Arabic font here if needed, for example Noto Sans Arabic.
\babelfont{tt}
{Libertinus Mono}
\babelfont[arabic]{tt}
{ALM Fixed}
\setmathfont{Libertinus Math}
\babeltags{Arabic=arabic} % Enable \Arabic, \textArabic, etc.
\babeltags{english=english}
\pagestyle{headandfoot}
\firstpageheader{\bfseries\large رياضيات\\مأمون }{}{\bfseries\large الإمتحان الأول }
\begin{document}
\begin{tabular}{lllll}
الوحدة & فصول الوحدة & عدد الحصص & الفترة الزمنية & الوسائل المقترحة
\end{tabular}
\end{document}
Se você usar o inglês apenas para frases curtas em um documento árabe, poderá remover a englishopção de babele adicionar \babelprovide[onchar=ids fonts]{english}para detectar automaticamente o idioma que está sendo usado e alternar as fontes automaticamente.
Uma maneira de fazer isso seria usar fontspec e polyglossia como você fez em alguns de seus trechos de código. (Uma vez que você já experimentou aqueles, suponho que esteja criando o documento com LuaLaTeX, não pdfLaTeX.)
Se você quiser saber em detalhes como usar a poliglossia para ativar vários idiomas e alternar entre eles, recomendo que você dê uma olhada no manual da poliglossia. Aqui está um exemplo (acabei de usar Amiri como uma fonte árabe porque já tinha instalado):
\documentclass{exam}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{arabic}
\newfontfamily\arabicfont{Amiri}
\usepackage{graphicx}
\pagestyle{headandfoot}
\firstpageheader{\bfseries\large \textarabic{رياضيات\\مأمون}}{\includegraphics{example-image}}{\bfseries\large \textarabic{الإمتحان الأول}}
\begin{document}
\textarabic{مرحبا كيف حالكم, جزاكم الله كل خير }
\end{document}
O que dá esta saída:
Se você deseja usar principalmente o árabe em seu documento, provavelmente deve usar \setdefaultlanguage{arabic}. Então você não precisa colocar \textarabic{...}todos os textos em árabe.