2

I am trying to write an official letter in Arabic using the package newlfm but the text is aligned from left to right instead of right to left. Here is my code:

\documentclass[11pt,stdletter,orderfromtodate,sigcenter]{newlfm}
\newlfmP{headermarginsize=20pt}
\newlfmP{addrfromskipbefore=0pt}
\newlfmP{addrtoskipbefore=-25pt}
\newlfmP{dateskipbefore=0pt}
\newlfmP{sigsize=0pt}
\newlfmP{sigskipbefore=30pt}
% 
\newlfmP{Headlinewd=0pt,Footlinewd=0pt}

\usepackage{etoolbox}

\makeatletter
\patchcmd{\@zfancyhead}{\fancy@reset}{\f@nch@reset}{}{}
\patchcmd{\@set@em@up}{\f@ncyolh}{\f@nch@olh}{}{}
\patchcmd{\@set@em@up}{\f@ncyolh}{\f@nch@olh}{}{}
\patchcmd{\@set@em@up}{\f@ncyorh}{\f@nch@orh}{}{}
\makeatother

\usepackage{graphicx}
\usepackage{fontspec}
\usepackage{setspace}
\usepackage{polyglossia}

\setmainlanguage[calendar=gregorian,hijricorrection=1,locale=morocco]{arabic}
\setotherlanguage[variant=british]{english}

\setmainfont{Amiri}

\namefrom{سعيد}
\addrfrom{%
\\193 الصويرة 44000
\\الهاتف: \LR{\textenglish{06~00~00~00~00}}
}

\addrto{%
\textbf{إلى السيد: المدير بالنيابة للمدرسة العليا للتكنولوجيا بالناظور}\\     
}

\dateset{\today}

\greetto{الموضوع: شغل منصب أستاذ التعليم العالي مساعد}

\closeline{التوقيع:}

\begin{document}

\begin{newlfm}

\end{newlfm}

\end{document}

And below is the resulting document:

enter image description here

I would appreciate it if someone can help me fix the alignment (make it right to left instead of left to right). Thanks.

1
  • The letter construction doesn't allow for this being set right-to-left. You're better of not using newlfm.
    – Werner
    Dec 29 '20 at 2:56
1

You can use the letter document class with the layout=sectioning option of babel, instead of newlfm

You might be able to adapt this template, which requires LuaLaTeX 1.12 or later. (It would work in XeLaTeX, with a few changes.)

\documentclass[11pt]{letter}
\usepackage[bidi=basic, layout=sectioning.tabular, british]{babel}
\usepackage{fontspec}

\defaultfontfeatures{ Scale=MatchLowercase,
                      Ligatures=TeX,
                      Renderer=HarfBuzz }

\babelfont{rm}
          [Scale=1.0, Ligatures=Common, Language=Default]{Libertinus Serif}
\babelfont{sf}
          [Ligatures=Common, Language=Default]{Libertinus Sans}
\babelfont{tt}
          [Language=Default]{Libertinus Mono}

\babelprovide[import=ar-MA, main]{arabic}
\babelfont[arabic]{rm}
          {Amiri}
% Set \babelfont[arabic]{sf} here if needed.
\babelfont[arabic]{tt}
          {ALM Fixed}

\babeltags{english=british}

\signature{سعيد}

\address{
  {193 الصويرة 44000}\\
  {الهاتف:}\\
  \textenglish{06~00~00~00~00}
}

\begin{document}
\begin{letter}{\textbf{إلى السيد: المدير بالنيابة للمدرسة العليا للتكنولوجيا بالناظور}}
\opening{الموضوع: شغل منصب أستاذ التعليم العالي مساعد}

\ldots

\closing{التوقيع:}
\end{letter}
\end{document}

Amiri sample

I attempted to simply copy and paste the Arabic from the question, and apologize for any errors.

1
  • Thank you for your help, I used the letter class for many letters before, but the results with the newlfm class look much better for some letters I wrote in english, and that's why I wanted to use newlfm for arabic letters. Dec 29 '20 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.