2

I would like to typeset an electronic form with Arabic as the main language and English as another language in the same document. I used the xetex engine without success, the layout was messy as you see in the below MWE:

MWE code

\documentclass[a4,pagesize=pdftex,DIV=16]{scrartcl}
\usepackage{xcolor}
\usepackage{graphicx}

\usepackage{hyperref}

\usepackage{polyglossia}
\setmainlanguage[locale=mashriq,numerals=mashriq,abjadjimnotail=true]{arabic}
\setotherlanguages{english}
% User-defined commands
\newcommand{\AR}{\textarabic}
\newcommand{\EN}{\textenglish}
\newfontfamily\arabicfont[Script=Arabic,Scale=1,Ligatures=TeX,Mapping=arabicdigits]{Amiri}

\begin{document}
\begin{Form}

\centering
 \LARGE\textbf{استمارة باللغة العربية}

\rule{\textwidth}{1pt}
\vskip 1cm

\TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,maxlen=30,width=0.5\textwidth]{اسم الوثيقة:} 

\TextField[mappingname=title,name=title,backgroundcolor=white,borderwidth=1,bordercolor=gray!30,width=0.5\textwidth,multiline]{تعليق:}

 \LARGE\textbf{نوع الاجراء المطلوب}

\CheckBox[backgroundcolor=white,radiosymbol=\ding{53},borderwidth=1,bordercolor=gray!30]{اصدار وثيقة}
\CheckBox[backgroundcolor=white,radiosymbol=\ding{53},borderwidth=1,bordercolor=gray!30]{تعديل وثيقة}
\CheckBox[backgroundcolor=white,radiosymbol=\ding{53},borderwidth=1,bordercolor=gray!30]{حذف وثيقة}


\end{Form}
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-engine: xetex               
%%% TeX-master: t
%%% End:

Output
output

As you can see the text boxes are not aligned well with text and actually not even placed as intended. Some text is hidden by the check-boxes, so how to get such forms right in this case? Your help would be much appreciated.

  • You need to update bidi package, but I think it remains the problem of writing arabic within Text Fields – Salim Bou Jan 1 at 15:32
  • I updated bibi pkg to v35.4, and there was an improvement in the layout but checkboxes are still hiding some of the preceding text. – doctorate Jan 1 at 16:05
  • Try to change the layout of check field with \def\LayoutCheckField#1#2{#1\hskip1.3em #2} – Salim Bou Jan 1 at 18:29
3

First you need a recent version of bidi package which adapt a lot of packages for right to left writing, package polyglossia uses implicitly bidi for languages with right to left script.

Second for CheckBox the command \LayoutCheckField can be used to change check field layout

\documentclass[a4,pagesize=pdftex,DIV=16]{scrartcl}
\usepackage{xcolor}
\usepackage{graphicx}

\usepackage{hyperref}


\usepackage{polyglossia}
\setmainlanguage[locale=mashriq,numerals=mashriq,abjadjimnotail=true]{arabic}
\setotherlanguages{english}
% User-defined commands
\newcommand{\AR}{\textarabic}
\newcommand{\EN}{\textenglish}
\newfontfamily\arabicfont[Script=Arabic,Scale=1,Ligatures=TeX,Mapping=arabicdigits]{Amiri}

\begin{document}
\begin{Form}

\centering
 \LARGE\textbf{استمارة باللغة العربية}

\rule{\textwidth}{1pt}
\vskip 1cm

\TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,maxlen=30,width=0.5\textwidth]{اسم الوثيقة:} 

\TextField[mappingname=title,name=title,backgroundcolor=white,borderwidth=1,bordercolor=gray!30,width=0.5\textwidth,multiline]{تعليق:}

 \LARGE\textbf{نوع الاجراء المطلوب}

\def\LayoutCheckField#1#2{% label, field
  #1 \hskip1.3em #2%
}


\CheckBox[backgroundcolor=white,radiosymbol=\ding{53},borderwidth=1,bordercolor=gray!30]{اصدار وثيقة}
\CheckBox[backgroundcolor=white,radiosymbol=\ding{53},borderwidth=1,bordercolor=gray!30]{تعديل وثيقة}
\CheckBox[backgroundcolor=white,radiosymbol=\ding{53},borderwidth=1,bordercolor=gray!30]{حذف وثيقة}

\end{Form}
\end{document}

enter image description here

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.