I'm using pandoc to generate PDF files and I've installed MiKTeX for latex libraries.
I have a .tex file contains Arabic and English charachters.
when I compile the file it generates a PDF file without arabic charachters.
here's the command I execute:
pandoc --latex-engine=xelatex khaled.tex -o khaled.pdf
and here's the tex file content:
\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Junicode}
\newfontfamily\arabicfont
[Script=Arabic, % to get correct arabic shaping
Scale=1.2] % make the arabic font bigger, a matter of taste
{Scheherazade} % whatever Arabic font you like
\newcommand{\textarabic}[1] % Arabic inside LTR
{\bgroup\luatextextdir TRT\arabicfont #1\egroup}
\newcommand{\n} [1] % for digits inside Arabic text
{\bgroup\luatextextdir TLT #1\egroup}
\newcommand{\afootnote} [1] % Arabic footnotes
{\footnote{\textarabic{#1}}}
\newenvironment{Arabic} % Arabic paragraph
{\luatextextdir TRT\luatexpardir TRT\arabicfont}{}
\begin{document}
English text ``\textarabic{جملة عربية وسط جملة إنجليزية}'' with Arabic in
between. English paragraph left aligned English paragraph left aligned English
paragraph left aligned English paragraph left aligned English paragraph left
aligned English paragraph left aligned English paragraph left aligned English
paragraph left aligned English paragraph left aligned English paragraph left
aligned English paragraph left aligned.
\begin{Arabic}
فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين \n{١٢٣٤٥} فقرة عربية
محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين
فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
اليمين\afootnote{حاشية عربية.} فقرة عربية محاذاة إلى اليمين.
\end{Arabic}
\end{document}
\luatextextdir
which is a LuaTeX command. I would recommend compiling with XeLaTeX and usingpolyglossia
(which loads thebidi
package) to deal with the language commands instead of using your own commands..log
file? Also, can you remove any previously generated PDF and try again, to make sure that a PDF is even generated in the first place? Your file doesn't compile for me because\luatextextdir
and\luatexpardir
are undefined… but maybe they are for you? See what the errors say.{١} ف
displays in my browser with two opening braces{
and{
, even though it contains one opening{
and one closing}
.Amiri
but I've encountered an error too.khaled.tex 21 Undefined control sequence. \textarabic #1->\bgroup \luatextextdir TRT\arabicfont #1\egroup l.21 ...عربية وسط جملة إنجليزية}
How could I configure \luatextextdir and \luatexpardir? I'm totally novice at this topic :(