% Needs debian/ubuntu packages :
%
% texlive-lang-arabic (for fmultico.sty)
% ttf-arabeyes (for arabic fonts)

\documentclass[a5paper,landscape]{article}
\usepackage{varwidth}
\usepackage{xltxtra}
\usepackage{tabularx}
\usepackage{fmultico}
\usepackage{etex}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{shadows}
\usepackage[postcorrect,noshuffle,insidebox]{automultiplechoice}
\usepackage{amsmath}\usepackage{xltxtra}\usepackage{arabxetex}
\newfontfamily{\arabicfont}[Script=Arabic,Scale=0.9]{Rasheeq}
\newcommand{\mybox}{\fcolorbox{white!100}{white!100}}

\usepackage{geometry}
\geometry{hmargin=1.0cm,headheight=2cm,headsep=.1cm,footskip=1cm,top=1.8cm,bottom=1.8cm}
\begin{document}
\def\AMCchoiceLabel#1{\textLR{\Alph{#1}}}

\def\AMCbeginQuestion#1#2{%
\par\noindent\hfill
{%
{#1}:} }
\def\AMCbeginAnswer{}
\def\AMCendAnswer{}
\def\AMCanswer#1#2{#1 \hspace{2.5pt}\vspace{.3pt}}

\setlength{\parskip}{0pt}

\newcommand{\Status}{
{\def\AMCbeginQuestion##1##2{}\def\AMCanswer##1##2{##1 ##2 \hspace{1em}}% 
\begin{question}{status}\QuestionIndicative%
  \scoring{auto=0,v=-1,e=-2}%
  \begin{choicescustom}
    \wrongchoice[ ]{غائب}
    \wrongchoice[ ]{غاش}
  \end{choicescustom}
\end{question}
}
}

\newcommand{\Stage}{
{\def\AMCbeginQuestion##1##2{}\def\AMCanswer##1##2{##1 ##2 \hspace{1em}}%
\begin{question}{stage}\QuestionIndicative%
  \scoring{auto=0,v=-1,e=-2}%
المرحلة:   
  \begin{choicescustom}
    \wrongchoice[ ]{ابتدائية}
    \wrongchoice[ ]{متوسطة}
    \wrongchoice[ ]{ثانوية}
  \end{choicescustom}
\end{question}
}
}

\newcommand{\Type}{
{\def\AMCbeginQuestion##1##2{}\def\AMCanswer##1##2{##1 ##2 \hspace{1em}}%
\begin{question}{type}\QuestionIndicative%
  \scoring{auto=0,v=-1,e=-2}%
النوع:
  \begin{choicescustom}
    \wrongchoice[ ]{صباحي}
    \wrongchoice[ ]{مسائي}
    \wrongchoice[ ]{منازل}
  \end{choicescustom}
\end{question}
}
}

\newcommand{\Sector}{
{\def\AMCbeginQuestion##1##2{}\def\AMCanswer##1##2{##1 ##2 \hspace{1em}}%
\begin{question}{sector}\QuestionIndicative%
  \scoring{auto=0,v=-1,e=-2}%
 النظام:   
  \begin{choicescustom}
    \wrongchoice[ ]{حكومي}
    \wrongchoice[ ]{خاص}
    \wrongchoice[ ]{دولي}
  \end{choicescustom}
\end{question}
}
}

\newcommand{\Term}{
{\def\AMCbeginQuestion##1##2{}\def\AMCanswer##1##2{##1 ##2 \hspace{1em}}%
\begin{question}{term}\QuestionIndicative%
  \scoring{auto=0,v=-1,e=-2}%
الفصل الدراسي: 
  \begin{choicescustom}
    \wrongchoice[ ]{اول}
    \wrongchoice[ ]{ثاني}
    \wrongchoice[ ]{دور 2}
  \end{choicescustom}
\end{question}
}
}

\onecopy{1}{    
%\AMCboxColor{red}
%%% beginning of the test sheet header:    
\begin{center}
\fbox{%
    \begin{varwidth}{1.000\textwidth}%
\begin{center}
\begin{arab}
\begin{tabular}{|r|r|r|}
\hline
\textarab{رقم الطالب}
&اللجنة&المادة\\
\hline
 & & \\
\hline
 \hbox{\vbox{\vspace*{1ex}\hbox{
 \LR{\AMCcodeHspace=0.32em\AMCcodeVspace=0.32em\AMCcode{StudentNum}{10}}}}}&
 \LR{\AMCcodeHspace=0.32em\AMCcodeVspace=0.32em\AMCcode{subject}{3}}&
 \LR{\AMCcodeHspace=0.32em\AMCcodeVspace=0.32em\AMCcode{room}{3}}
\\
\hline
\end{tabular}
\begin{tabular}{|r|r|r|}
\hline
\multicolumn{3}{|l|}{
\begin{minipage}{.44\linewidth}
\begin{arab}
ارشادات
\end{arab}\end{minipage}
}\\
\hline
\multicolumn{3}{|l|}{
\begin{minipage}{.44\linewidth}
        \begin{arab}
  		     \vspace{1.8mm}
	$-$ ‫فضلا قم بتظليل المربع الصحيح بالمرسام .‬
	    	
            $\longrightarrow{}$ ‫فضلا اكتب رقم جلوسك عن طريق تظليل المربعات هنا.‬ 
  		    	    	
  		    $-$ ‫فضلا لا تكتب أي نص على الورقة عدا عن بياناتك داخل
  		     المستطيل في الأسفل.‬ 
  		     
  		     $-$ قال صلى الله عليه وسلم (اللهم لا سهل إلا ما جعلته سهلا وأنت تجعل الحزن إذا شئت سهلا).  		     
  		     \vspace{4.4mm}
  		   \end{arab}\end{minipage}}
\\
\hline
\hline

\includegraphics[height=2.8cm,width=2cm,keepaspectratio]{bw.png}&
\includegraphics[height=2.8cm,width=2.8cm,keepaspectratio]{logo.png}&
\begin{minipage}{.15\linewidth}
  \vspace{-2.05cm}
المملكة العربية السعودية 
  \vspace{3pt}
  
وزارة التربية والتعليم  
  \vspace{5pt}
  
 إدارة التربية والتعليم:\hrulefill‬  
  \vspace{5pt}
  
   مدرسة:\hrulefill‬  
  \vspace{11pt}
\end{minipage}
\\
\hline
\end{tabular}
\end{arab}

\begin{center}
\vspace{-0.3cm}
\champnom{\centering\fbox{\begin{arab}    
    \begin{minipage}{0.937\linewidth}
         \vspace{0.03cm}
اسم الطالب: \hrulefill    \hfill   المادة: \hrulefill    \hfill   الزمن: \hrulefill

     \vspace{-0.05cm}
    \end{minipage}
    \end{arab}
  }}
\end{center}
\begin{arab}
\begin{center}
\vspace{-0.1cm}
\AMCnumero{1}
\AMCboxDimensions{shape=oval,size=2.3ex,down=1ex}
\begin{center}
\vspace{-0.5cm}

\begin{tabular}{r}
إجابات أسئلة الأختيار من متعدد
\\
\begin{varwidth}{0.72\textwidth}%
\columnseprule=.4pt \begin{multicols}{4}\normalsize
\framebox(85,15){
\begin{question}{001}
\begin{choicescustom}
\wrongchoice[أ]{}%
\wrongchoice[ب]{}%
\wrongchoice[ج]{}%
\wrongchoice[د]{}%
\end{choicescustom}
\end{question}
\vspace{-0.05cm}
}%\vspace{-0.13cm}

\framebox(85,15){
\begin{question}{002}
\begin{choicescustom}
\wrongchoice[أ]{}%
\wrongchoice[ب]{}%
\wrongchoice[ج]{}%
\wrongchoice[د]{}%
\end{choicescustom}
\end{question}
\vspace{-0.05cm}
}%\vspace{-0.13cm}

\framebox(85,15){
\begin{question}{003}
\begin{choicescustom}
\wrongchoice[أ]{}%
\wrongchoice[ب]{}%
\wrongchoice[ج]{}%
\wrongchoice[د]{}%
\end{choicescustom}
\end{question}
\vspace{-0.05cm}
}%\vspace{-0.13cm}

 \framebox(85,15){
\begin{question}{004}
\begin{choicescustom}
\wrongchoice[أ]{}%
\wrongchoice[ب]{}%
\wrongchoice[ج]{}%
\wrongchoice[د]{}%
\end{choicescustom}
\end{question}
\vspace{-0.05cm}
}%\vspace{-0.13cm}

\framebox(85,15){
\begin{question}{005}
\begin{choicescustom}
\wrongchoice[أ]{}%
\wrongchoice[ب]{}%
\wrongchoice[ج]{}%
\wrongchoice[د]{}%
\end{choicescustom}
\end{question}
\vspace{-0.05cm}
}%\vspace{-0.13cm}

\framebox(85,15){
\begin{question}{006}
\begin{choicescustom}
\wrongchoice[أ]{}%
\wrongchoice[ب]{}%
\wrongchoice[ج]{}%
\wrongchoice[د]{}%
\end{choicescustom}
\end{question}
\vspace{-0.05cm}
}%\vspace{-0.13cm}

\framebox(85,15){
\begin{question}{007}
\begin{choicescustom}
\wrongchoice[أ]{}%
\wrongchoice[ب]{}%
\wrongchoice[ج]{}%
\wrongchoice[د]{}%
\end{choicescustom}
\end{question}
\vspace{-0.05cm}
}%\vspace{-0.13cm}

\framebox(85,15){
\begin{question}{008}
\begin{choicescustom}
\wrongchoice[أ]{}%
\wrongchoice[ب]{}%
\wrongchoice[ج]{}%
\wrongchoice[د]{}%
\end{choicescustom}
\end{question}
\vspace{-0.05cm}
}%\vspace{-0.13cm}

\framebox(85,15){
\begin{question}{009}
\begin{choicescustom}
\wrongchoice[أ]{}%
\wrongchoice[ب]{}%
\wrongchoice[ج]{}%
\wrongchoice[د]{}%
\end{choicescustom}
\end{question}
\vspace{-0.05cm}
}%\vspace{-0.13cm}

\framebox(85,15){
\begin{question}{010}
\begin{choicescustom}
\wrongchoice[أ]{}%
\wrongchoice[ب]{}%
\wrongchoice[ج]{}%
\wrongchoice[د]{}%
\end{choicescustom}
\end{question}
\vspace{-0.05cm}
}%\vspace{-0.13cm}

\framebox(85,15){
\begin{question}{011}
\begin{choicescustom}
\wrongchoice[أ]{}%
\wrongchoice[ب]{}%
\wrongchoice[ج]{}%
\wrongchoice[د]{}%
\end{choicescustom}
\end{question}
\vspace{-0.05cm}
}%\vspace{-0.13cm}

\framebox(85,15){
\begin{question}{012}
\begin{choicescustom}
\wrongchoice[أ]{}%
\wrongchoice[ب]{}%
\wrongchoice[ج]{}%
\wrongchoice[د]{}%
\end{choicescustom}
\end{question}\vspace{-0.05cm}}
\end{multicols}
\end{varwidth}%
\vspace{0.02cm}
\\
\end{tabular}
\begin{tabular}{r}
اجابات اسئلة صح/خطأ
\\
\AMCnumero{1}
%\begin{varwidth}{0.258\textwidth}%
\begin{varwidth}{0.228\textwidth}%
\begin{multicols}{2}\small

 \framebox(53,15){
\begin{question}{201}
\begin{choicescustom}
\wrongchoice[ص]{}%
\wrongchoice[خ]{}%
\end{choicescustom}
\end{question}
\vspace{-0.03cm}
}%\vspace{-0.13cm}

\framebox(53,15){
\begin{question}{202}
\begin{choicescustom}
\wrongchoice[ص]{}%
\wrongchoice[خ]{}%
\end{choicescustom}
\end{question}
\vspace{-0.03cm}
}%\vspace{-0.13cm}

\framebox(53,15){
\begin{question}{203}
\begin{choicescustom}
\wrongchoice[ص]{}%
\wrongchoice[خ]{}%
\end{choicescustom}
\end{question}
\vspace{-0.03cm}
}%\vspace{-0.13cm}

\framebox(53,15){
\begin{question}{204}
\begin{choicescustom}
\wrongchoice[ص]{}%
\wrongchoice[خ]{}%
\end{choicescustom}
\end{question}
\vspace{-0.03cm}
}%\vspace{-0.13cm}

\framebox(53,15){
\begin{question}{205}
\begin{choicescustom}
\wrongchoice[ص]{}%
\wrongchoice[خ]{}%
\end{choicescustom}
\end{question}
\vspace{-0.03cm}
}%\vspace{-0.13cm}

\framebox(53,15){
\begin{question}{206}
\begin{choicescustom}
\wrongchoice[ص]{}%
\wrongchoice[خ]{}%
\end{choicescustom}
\end{question}\vspace{-0.03cm}}
\end{multicols}
\end{varwidth}\vspace{0.02cm}\\%
\end{tabular}
\end{center}
\end{center}
\vspace{-0.55cm}
\begin{center}\begin{arab} تنبيه هذا الجزء خاص بالمدرسين فقط \end{arab}\end{center}
\vspace{-0.35cm}

\begin{tabular}{|r|r|}
\hline
درجة التقويم المستمر / العملي / المقالي
&
توقيع المعلم
\\
\hline
\AMCnumero{1}
\AMCboxDimensions{shape=oval,size=2.3ex,down=1ex}
\begin{varwidth}{0.785\textwidth}%
\columnseprule=.4pt \begin{multicols}{3}%\normalsize
\framebox(115,16){
\begin{question}{401}
\begin{choicescustom}[o]\scoring{auto=0}%
\wrongchoice[0]{0}%
\wrongchoice[1]{1}%
\wrongchoice[2]{2}%
\wrongchoice[3]{3}%
\wrongchoice[4]{4}%
\wrongchoice[5]{5}%
\end{choicescustom}%
\end{question}
\vspace{-0.05cm}
}%\vspace{-0.13cm}

\framebox(115,16){
\begin{question}{402}
\begin{choicescustom}[o]\scoring{auto=0}%
\wrongchoice[0]{0}%
\wrongchoice[1]{1}%
\wrongchoice[2]{2}%
\wrongchoice[3]{3}%
\wrongchoice[4]{4}%
\wrongchoice[5]{5}%
\end{choicescustom}%
\end{question}
\vspace{-0.05cm}
}%\vspace{-0.13cm}

\framebox(115,16){
\begin{question}{403}
\begin{choicescustom}[o]\scoring{auto=0}%
\wrongchoice[0]{0}%
\wrongchoice[1]{1}%
\wrongchoice[2]{2}%
\wrongchoice[3]{3}%
\wrongchoice[4]{4}%
\wrongchoice[5]{5}%
\end{choicescustom}%
\end{question}
\vspace{-0.05cm}}
\end{multicols}
\end{varwidth}&%
    \begin{varwidth}{0.545\textwidth}%
        \vspace{-0.42cm}
\AMCboxDimensions{size=1.7ex,down=.5ex}
\begin{minipage}{.28\linewidth}\begin{arab}
  \vspace{2.5mm}
\begin{center}\textarab{ }\end{center}
  \vspace{-1pt}
\end{arab}\end{minipage}
\end{varwidth}%
\\
\hline
\end{tabular}
\end{arab}
\end{center}
\end{varwidth}%
}
\end{center}
}

\end{document}
