[Tex/LaTex] left and right aligned section title on one line

horizontal alignmentsectioningtitlesec

I am trying to have a simple bilingual title for a section. The English text should align to the left and the Arabic text should align to the right, both on the same line.

The following line of code almost does the job, but the Arabic text is not fully right aligned——it looks like there is an extra margin, compared to the rest of the document.

\section{English Title \hfill\textarabic{كلمة}}

I tried titlesec's block shape, but that didn't do the trick.

How can I fix it?

Best Answer

enter image description here

\newfontfamily\arabicfont[Script=Arabic,Scale=1.2]{Arabic Typesetting}    


\section{A section in English \hfill \textarabic{فصل باللغة العربية}}
\section{English Title \hfill \textarabic{عنوان بالعربي}}

You can use a minipage inside your section title to perform whatever alignment you need. Of course titlesec is essential in this situation. The block shape can be defined as this:


where we left .05\linewidth for section numbering and the remaining .95\textwidth for the bilingual title.