summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/xepersian/xepersian-multiplechoice.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xepersian/xepersian-multiplechoice.sty')
-rw-r--r--Master/texmf-dist/tex/xelatex/xepersian/xepersian-multiplechoice.sty166
1 files changed, 166 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xepersian/xepersian-multiplechoice.sty b/Master/texmf-dist/tex/xelatex/xepersian/xepersian-multiplechoice.sty
new file mode 100644
index 00000000000..311d670f2a4
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/xepersian/xepersian-multiplechoice.sty
@@ -0,0 +1,166 @@
+%%
+%% This is file `xepersian-multiplechoice.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% xepersian.dtx (with options: `xepersian-multiplechoice.sty')
+%%
+%% ______________________________________
+%% Copyright © 2008–2013 Persian TeX Group
+%%
+%% License information appended.
+%%
+%%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{xepersian-multiplechoice}[2010/07/25 v0.2
+ Multiple Choice Questionnaire class for Persian in XeLaTeX]
+\RequirePackage{pifont}
+\RequirePackage{fullpage}
+\RequirePackage{ifthen}
+\RequirePackage{calc}
+\RequirePackage{verbatim}
+\RequirePackage{tabularx}
+\def\@headerfont{\bfseries}
+\newcommand\headerfont[1]{\gdef\@headerfont{#1}}
+\def\@X{X}
+\newcommand\X[1]{\gdef\@X{#1}}
+\def\pbs#1{\let\tmp=\\#1\let\\=\tmp}
+\newcolumntype{D}{>{\pbs\centering}X}
+\newcolumntype{Q}{>{\@headerfont}X}
+
+\renewcommand\tabularxcolumn[1]{m{#1}}
+\newcommand\makeform@nocorrection{%
+ \addtocontents{frm}{\protect\end{tabularx}}
+ \@starttoc{frm}}
+\newcommand\makeform@correction{%
+ \addtocontents{frm}{\protect\end{tabularx}}}
+\newcommand\makemask@nocorrection{%
+ \addtocontents{msk}{\protect\end{tabularx}}
+ \@starttoc{msk}}
+\newcommand\makemask@correction{%
+ \addtocontents{msk}{\protect\end{tabularx}}}
+\newlength\questionspace
+\setlength\questionspace{0pt}
+\newcommand\answerstitle[1]{\gdef\@answerstitle{#1}}
+\def\@answerstitlefont{\bfseries}
+\newcommand\answerstitlefont[1]{\gdef\@answerstitlefont{#1}}
+\def\@answernumberfont{\bfseries}
+\newcommand\answernumberfont[1]{\gdef\@answernumberfont{#1}}
+\newcounter{question}\stepcounter{question}
+\newcounter{@choice}
+\def\@initorcheck{%
+ \xdef\@choices{\the@choice}%
+ \setcounter{@choice}{1}%
+ \gdef\@arraydesc{|Q||}%
+ \gdef\@headerline{}%
+ \whiledo{\not{\value{@choice}>\@choices}}{
+ \xdef\@arraydesc{\@arraydesc D|}
+ \def\@appendheader{\g@addto@macro\@headerline}
+ \@appendheader{&\protect\@headerfont}
+ \edef\@the@choice{{\alph{@choice}}}
+ \expandafter\@appendheader\@the@choice
+ \stepcounter{@choice}}%
+ \addtocontents{frm}{%
+ \protect\begin{tabularx}{\protect\linewidth}{\@arraydesc}
+ \protect\hline
+ \@headerline\protect\\\protect\hline\protect\hline}%
+ \addtocontents{msk}{%
+ \protect\begin{tabularx}{\protect\linewidth}{\@arraydesc}
+ \protect\hline
+ \@headerline\protect\\\protect\hline\protect\hline}%
+ \gdef\@initorcheck{%
+ \ifthenelse{\value{@choice} = \@choices}{}{%
+ \ClassError{xepersian-multiplechoice}{Question \thequestion: wrong number of choices
+ (\the@choice\space instead of \@choices)}{%
+ Questions must all have the same number of proposed answers.%
+ \MessageBreak
+ Type X <return> to quit, fix your MCQ (multiple choice question) and rerun XeLaTeX.}}}}
+\newenvironment{question}[1]{%
+ %% \begin{question}
+ \begin{minipage}{\textwidth}
+ \xdef\@formanswerline{\@questionheader}%
+ \xdef\@maskanswerline{\@questionheader}%
+ \fbox{\parbox[c]{\linewidth}{#1}}
+ \vspace\questionspace\par
+ {\@answerstitlefont\@answerstitle}
+ \begin{list}{\@answernumberfont\alph{@choice})~}{\usecounter{@choice}}}{%
+ %% \end{question}
+ \end{list}
+ \@initorcheck%
+ \addtocontents{frm}{\@formanswerline\protect\\\protect\hline}%
+ \addtocontents{msk}{\@maskanswerline\protect\\\protect\hline}%
+ \end{minipage}
+ \stepcounter{question}}
+\def\@truesymbol{\ding{52}~}
+\def\@falsesymbol{\ding{56}~}
+\newcommand\truesymbol[1]{\gdef\@truesymbol{#1}}
+\newcommand\falsesymbol[1]{\gdef\@falsesymbol{#1}}
+\def\@true@nocorrection{\item}
+\def\@false@nocorrection{\item}
+\def\@true@correction{\item[\@truesymbol\refstepcounter{@choice}]}
+\def\@false@correction{\item[\@falsesymbol\refstepcounter{@choice}]}
+\newcommand\true{%
+ \xdef\@formanswerline{\@formanswerline&}%
+ \xdef\@maskanswerline{\@maskanswerline&\@X}%
+ \@true}%
+\newcommand\false{%
+ \xdef\@formanswerline{\@formanswerline&}%
+ \xdef\@maskanswerline{\@maskanswerline&}%
+ \@false}%
+\def\@correctionstyle{\itshape}
+\newcommand\correctionstyle[1]{\gdef\@correctionstyle{#1}}
+\newenvironment{@correction}{\@correctionstyle}{}
+ \def\@questionheader{سؤال \thequestion}
+ \answerstitle{جوابهای ممکن:}
+\DeclareOption{nocorrection}{%
+ \let\@true\@true@nocorrection
+ \let\@false\@false@nocorrection
+ \let\correction\comment
+ \let\endcorrection\endcomment
+ \def\makeform{\makeform@nocorrection}
+ \def\makemask{\makemask@nocorrection}}
+\DeclareOption{correction}{%
+ \let\@true\@true@correction
+ \let\@false\@false@correction
+ \let\correction\@correction
+ \let\endcorrection\end@correction
+ \def\makeform{\makeform@correction}
+ \def\makemask{\makemask@correction}}
+\ExecuteOptions{nocorrection}
+\newcommand\questiontitle[1]{\gdef\@questiontitle{#1}}
+\def\@questiontitlefont{\bfseries}
+\newcommand\questiontitlefont[1]{\gdef\@questiontitlefont{#1}}
+\newlength\questiontitlespace
+\setlength\questiontitlespace{5pt}
+\newlength\questionsepspace
+\setlength\questionsepspace{20pt}
+\gdef\@questionsepspace{0pt}
+\let\old@question\question
+\let\old@endquestion\endquestion
+\renewenvironment{question}[1]{%
+ %% \begin{question}
+ \vspace\@questionsepspace
+ \fbox{\parbox[c]{0.25\linewidth}{\@questiontitlefont\@questiontitle}}
+ \nopagebreak\vspace\questiontitlespace\par
+ \old@question{#1}}{%
+ %% \end{question}
+ \old@endquestion
+ \gdef\@questionsepspace{\questionsepspace}}
+ \questiontitle{سؤال \thequestion:}
+\ProcessOptions
+%%
+%% Copyright © 2008–2013 Persian TeX Group <persiantexdev@gmail.com>
+%%
+%% It may be distributed and/or modified under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is “maintained” (as per LPPL maintenance status)
+%% by Persian TeX Group.
+%%
+%%
+%%
+%%
+%% End of file `xepersian-multiplechoice.sty'.