0

I'm currently working on a book and I need to add Arabic words in the document within an English sentence. Example: "The word (arabic word) is the definition of....". I tried using LR{} and {\afont "arabicword"} but none of them work.

\documentclass[12pt]{book}
\usepackage[arabic,main=english]{babel}

\usepackage[sc,compact,explicit]{titlesec} % Titlesec for configuring the header

\usepackage{auto-pst-pdf} % Vectorian Ornaments XeTeX auxiliary (from: https://tex.stackexchange.com/questions/253477/how-to-use-psvectorian-with-pdflatex) \usepackage{psvectorian} % Vectorian Ornaments

\let\clipbox\relax % PSTricks (used by PSVectorian) already defines a \clipbox, so we need this workaround \usepackage{adjustbox} % Adjustbox to rescale the ornaments (scalebox breaks titlesec for some reason...)

\newcommand{\otherfancydraw}{% Defining a command to shorten things \begin{adjustbox}{max height=0.5\baselineskip}% Rescaling to have height of 0.5\baselineskip \raisebox{-0.25\baselineskip}{ \rotatebox[origin=c]{45}{% And rotating 90 degrees \psvectorian{7}% Ornament n° 26 (http://melusine.eu.org/syracuse/pstricks/vectorian/psvectorian.pdf) }}% \end{adjustbox}% }

% A command to create a rule centered vertically on the text (from: https://tex.stackexchange.com/questions/15119/draw-horizontal-line-left-and-right-of- some-text-a-single-line/15122#15122) \newcommand\ruleline[1]{\par\noindent\raisebox{.8ex}{\makebox[\linewidth]. {\hrulefill\hspace{1ex}\raisebox{-.8ex}{#1}\hspace{1ex}\hrulefill}}} \usepackage{fontspec} \titleformat% Formatting the header {\chapter} % command [block] % shape - Only managed to get it working with block {\normalfont\bfseries\sc\huge} % format - Change here as needed {\centering Chapter \thechapter\} % The Chapter N° label {0pt} % sep {\centering \ruleline{\otherfancydraw}\ % The horizontal rule \centering #1} % And the actual title \usepackage{lmodern} % monospace font \usepackage[T1]{fontenc} \renewcommand{\ttdefault}{lmtt} % MONO Latin Modern Font % T1 encoding of cmtt font s\renewcommand{\rmdefault}{lmr} % SERIF Latin Modern Font % T1 encoding of cmr font st\renewcommand{\sfdefault}{lmss} % SANS Latin Modern F \newcommand{\q}[1]{>>\textit{#1}<<} \newcommand{\prefacename}{Preface} \newenvironment{preface}{ \vspace{\stretch{2}} {\noindent \bfseries \Huge \prefacename} \begin{center} % \phantomsection \addcontentsline{toc}{chapter}{\prefacename} % enable this if you want to put the preface in the table of contents \thispagestyle{plain} \end{center}% } {\vspace*{\stretch{5}}}

\usepackage{arabxetex}

\begin{document} Test \LR{arabic word here} test test \end{document}

However, this doesn't seem to work, the English word is loaded when I compile but the Arabic word is not there.

JamesT
  • 3,169
user8700908
  • 111
  • 2

1 Answers1

2

For short Arabic texts, all you need is:

\documentclass[12pt]{book}

\usepackage[bidi=default, english]{babel} \babelfont[arabic]{rm}{FreeSerif}

\begin{document} One two \foreignlanguage{arabic}{لاثة أربعة} five six. \end{document}

enter image description here

Also:

• Don’t load fontenc, which is for pdflatex, not xelatex.

arabxetex is not necessary.

Javier Bezos
  • 10,003