

%%%  نمونه یک سمینار کارشناسی ارشد، دانشگاه تبریز،  وحید دامن ‌افشان،     vdamanafshan@yahoo.com 


% توجه داشته باشید برای دیدن خروجی کامل شامل نمایه و فهرست مطالب در ویرایشگر Texmaker، ابتدا دو بار 
% کلید F1 و بعد کلید F12 و دوباره کلید F1 و در آخر کلید F7 را فشار دهید.
% توضیحات مربوط به هر بسته یا دستور را می‌توانید در خط بالای آن ببینید.

\documentclass[14pt,a4paper]{article}
%در ورژن جدید زی‌پرشین برای تایپ متن‌های ریاضی، این سه بسته، حتماً باید فراخوانی شود
\usepackage{amsthm,amssymb,amsmath}
%بسته‌ای برای تنطیم حاشیه‌های بالا، پایین، چپ و راست صفحه
%\usepackage[top=50mm, bottom=50mm, left=50mm, right=50mm]{geometry}

\usepackage{graphicx}
% بسته‌ و دستوراتی برای ایجاد لینک‌های رنگی با امکان جهش 
\usepackage[pagebackref=true,colorlinks,linkcolor=blue,citecolor=magenta]{hyperref}
% چنانچه قصد پرینت گرفتن نوشته خود را دارید، خط بالا را غیرفعال و  از دستور زیر استفاده کنید چون در صورت استفاده از دستور زیر‌‌، 
% لینک‌ها به رنگ سیاه ظاهر خواهند شد و برای پرینت گرفتن، مناسب‌تر است
%\usepackage[pagebackref=false]{hyperref}
% بسته‌ای برای ظاهر شدن «مراجع» و« نمایه» در فهرست مطالب
\usepackage{tocbibind}
% دستورات مربوط به ایجاد نمایه
\usepackage{makeidx}
\makeindex
%%%%%%%%%%%%%%%%%%%%%%%%%%
% فراخوانی بسته زی‌پرشین و دستورات مربوط به نوع فونت‌ها
\usepackage{xepersian}
\settextfont[Scale=1.1]{XB Niloofar}
%\setlatintextfont[Scale=2]{Linux Libertine}
%\setlatintextfont[Scale=1]{Times New Roman}
% از revision 118 زی‌پرشین به بعد، وارد کردن دستور زیر لازم نیست. توجه داشته باشید که در صورت  غیرفعال کردن این دستور،
% از فونت پیش‌فرض لاتک برای کلمات انگلیسی استفاده خواهد شد.
%\setlatintextfont[ExternalLocation,BoldFont={lmroman10-bold},BoldItalicFont={lmroman10-bolditalic},ItalicFont={lmroman10-italic}]{lmroman10-regular}
% چنانچه می‌خواهید اعداد در فرمول‌ها، فارسی باشد، خط زیر را نیز فعال کنید
%\setdigitfont[Scale=1.1]{XB Zar}
%%%%%%%%%%%%%%%%%%%%%%%%%%
% تعریف قلم‌های فارسی و انگلیسی برای استفاده در بعضی از قسمت‌های متن
\defpersianfont\titr[Scale=1]{HM XZar}
\defpersianfont\nastaliq[Scale=1.5]{IranNastaliq}
%\defpersianfont\traffic[Scale=1]{B traffic}
% چنانچه فونت B Traffic را ندارید، دستور بالا را غیرفعال کرده و دستور زیر را فعال کنید
\defpersianfont\traffic[Scale=1]{HM XZar}
%تعریف و نحوه ظاهر شدن عنوان قضیه‌ها، تعریف‌ها، مثال‌ها و ...
\theoremstyle{definition}
\newtheorem{definition}{تعریف}[section]
\theoremstyle{theorem}
\newtheorem{theorem}[definition]{قضیه}
\newtheorem{lemma}[definition]{لم}
\newtheorem{proposition}[definition]{گزاره}
\newtheorem{corollary}[definition]{نتیجه}
\newtheorem{remark}[definition]{تبصره}
\newtheorem{nam}[definition]{نکته}
\newtheorem{no}[definition]{def}
\theoremstyle{definition}
\newtheorem{example}[definition]{مثال}


%%%%%%%%%%%%%%%%%%%%%%%%%%
% تعریف دستورات جدید برای خلاصه نویسی و راحتی کار در هنگام تایپ فرمول‌های ریاضی
\newcommand{\bR}{\mathbb{R}}
\newcommand{\cB}{\mathcal{B}}
\newcommand{\cO}{\mathcal{O}}
\newcommand{\cG}{\mathcal{G}}
\newcommand{\cU}{\mathcal{U}}
\newcommand{\cK}{\mathcal{K}}
\newcommand{\cS}{\mathcal{S}}
\newcommand{\rM}{\mathrm{M}}
\newcommand{\rC}{\mathrm{C}}
\newcommand{\rV}{\mathrm{V}}
\newcommand{\ls}{\mathrm{LSC}_{+}(X)}
\newcommand{\ce}{\mathrm{C}^{*}(X)}
\newcommand{\lsc}{\mathrm{LSC}}
\newcommand{\fB}{\mathfrak{B}}
\newcommand{\fM}{\mathfrak{M}}
\newcommand{\bt}{\begin{theorem}}
\newcommand{\et}{\end{theorem}}
\newcommand{\bl}{\begin{lemma}}
\newcommand{\el}{\end{lemma}}
\newcommand{\bc}{\begin{corollary}}
\newcommand{\ec}{\end{corollary}}
\newcommand{\bp}{\begin{proof}}
\newcommand{\ep}{\end{proof}}
\newcommand{\be}{\begin{example}}
\newcommand{\ee}{\end{example}}
\newcommand{\bd}{\begin{definition}}
\newcommand{\ed}{\end{definition}}
\newcommand{\bpr}{\begin{proposition}}
\newcommand{\epr}{\end{proposition}}
\newcommand{\ba}{\begin{align}}
\newcommand{\ea}{\end{align}}
\newcommand{\beq}{\begin{enumerate}}
\newcommand{\eeq}{\end{enumerate}}
\newcommand{\To}{\rightarrow}
\newcommand{\re}{\mathrm{Re}}
\newcommand{\im}{\mathrm{Im}}
\newcommand{\no}{\nonumber}
\newcommand{\br}{\begin{remark}}
\newcommand{\er}{\end{remark}}
\newcommand{\bna}{\begin{nam}}
\newcommand{\ena}{\end{nam}}

% تعریف دستورات جدید برای خلاصه نویسی و راحتی کار در هنگام تایپ فرمول‌های ریاضی
\newcommand{\bR}{\mathbb{R}}
\newcommand{\cB}{\mathcal{B}}
\newcommand{\cO}{\mathcal{O}}
\newcommand{\cG}{\mathcal{G}}
\newcommand{\cU}{\mathcal{U}}
\newcommand{\cK}{\mathcal{K}}
\newcommand{\cS}{\mathcal{S}}
\newcommand{\rM}{\mathrm{M}}
\newcommand{\rC}{\mathrm{C}}
\newcommand{\rV}{\mathrm{V}}
\newcommand{\ls}{\mathrm{LSC}_{+}(X)}
\newcommand{\ce}{\mathrm{C}^{*}(X)}
\newcommand{\lsc}{\mathrm{LSC}}
\newcommand{\fB}{\mathfrak{B}}
\newcommand{\fM}{\mathfrak{M}}
\newcommand{\bt}{\begin{theorem}}
\newcommand{\et}{\end{theorem}}
\newcommand{\bl}{\begin{lemma}}
\newcommand{\el}{\end{lemma}}
\newcommand{\bc}{\begin{corollary}}
\newcommand{\ec}{\end{corollary}}
\newcommand{\bp}{\begin{proof}}
\newcommand{\ep}{\end{proof}}
\newcommand{\be}{\begin{example}}
\newcommand{\ee}{\end{example}}
\newcommand{\bd}{\begin{definition}}
\newcommand{\ed}{\end{definition}}
\newcommand{\ba}{\begin{align}}
\newcommand{\ea}{\end{align}}



\usepackage{multicol,color}
\setlength{\textwidth}{16cm}
\definecolor{mycolor}{rgb}{0,0,0}
\newcounter{question}
\newcommand{\question}[1]{\noindent\stepcounter{question}\textcolor{mycolor}{\thequestion.} #1}
\newsavebox{\answera}
\newsavebox{\answerb}
\newsavebox{\answerc}
\newsavebox{\answerd}
\newcommand{\answer}[4]{%
\sbox\answera{#1}%
\sbox\answerb{#2}%
\sbox\answerc{#3}%
\sbox\answerd{#4}%
\ifdim\wd\answera<0.165\textwidth%
\ifdim\wd\answerb<0.165\textwidth%
\ifdim\wd\answerc<0.165\textwidth%
\ifdim\wd\answerd<0.165\textwidth%
\begin{multicols}{4}
\begin{itemize}
\item[\textcolor{mycolor}{1)}] \usebox{\answera}
\item[\textcolor{mycolor}{2)}] \usebox{\answerb}
\item[\textcolor{mycolor}{3)}] \usebox{\answerc}
\item[\textcolor{mycolor}{4)}] \usebox{\answerd}
\end{itemize}
\end{multicols}
\else%
\ifdim\wd\answera<0.4\textwidth%
\ifdim\wd\answerb<0.4\textwidth%
\ifdim\wd\answerc<0.4\textwidth%
\ifdim\wd\answerd<0.4\textwidth%
\begin{multicols}{2}
\begin{itemize}
\item[\textcolor{mycolor}{1)}] \usebox{\answera}
\item[\textcolor{mycolor}{3)}] \usebox{\answerc}
\item[\textcolor{mycolor}{2)}] \usebox{\answerb}
\item[\textcolor{mycolor}{4)}] \usebox{\answerd}
\end{itemize}
\end{multicols}
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi\fi
\else
\ifdim\wd\answera<0.4\textwidth%
\ifdim\wd\answerb<0.4\textwidth%
\ifdim\wd\answerc<0.4\textwidth%
\ifdim\wd\answerd<0.4\textwidth%
\begin{multicols}{2}
\begin{itemize}
\item[\textcolor{mycolor}{1)}] \usebox{\answera}
\item[\textcolor{mycolor}{3)}] \usebox{\answerc}
\item[\textcolor{mycolor}{2)}] \usebox{\answerb}
\item[\textcolor{mycolor}{4)}] \usebox{\answerd}
\end{itemize}
\end{multicols}
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi\fi
\else
\ifdim\wd\answera<0.4\textwidth%
\ifdim\wd\answerb<0.4\textwidth%
\ifdim\wd\answerc<0.4\textwidth%
\ifdim\wd\answerd<0.4\textwidth%
\begin{multicols}{2}
\begin{itemize}
\item[\textcolor{mycolor}{1)}] \usebox{\answera}
\item[\textcolor{mycolor}{3)}] \usebox{\answerc}
\item[\textcolor{mycolor}{2)}] \usebox{\answerb}
\item[\textcolor{mycolor}{4)}] \usebox{\answerd}
\end{itemize}
\end{multicols}
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi\fi
\else
\ifdim\wd\answera<0.4\textwidth%
\ifdim\wd\answerb<0.4\textwidth%
\ifdim\wd\answerc<0.4\textwidth%
\ifdim\wd\answerd<0.4\textwidth%
\begin{multicols}{2}
\begin{itemize}
\item[\textcolor{mycolor}{1)}] \usebox{\answera}
\item[\textcolor{mycolor}{3)}] \usebox{\answerc}
\item[\textcolor{mycolor}{2)}] \usebox{\answerb}
\item[\textcolor{mycolor}{4)}] \usebox{\answerd}
\end{itemize}
\end{multicols}
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi\fi
}
%%%%%%%%%%%%%%%%%%%%%%%%%%
% تغییر نام کلمه «اثبات» به «برهان»
\renewcommand\proofname{\textbf{پاسخ}}
%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}


\chapter{فصل اول}
\newpage
\question{%
این آزمایشی است.}
\answer{$1$}{$11$}{$A+B$}{$1A+B$}
\question{%
این آزمایشی است.}
\answer{$1$}{$11$}{$A+B$}{$1A+B$}\question{%
این آزمایشی است.}
\answer{$1$}{$11$}{$A+B$}{$1A+B$}\question{%
این آزمایشی است.}
\answer{$1$}{$11$}{$A+B$}{$1A+B$}\question{%
این آزمایشی است.}
\answer{$1$}{$11$}{$A+B$}{$1A+B$}\question{%
این آزمایشی است.}
\answer{$1$}{$11$}{$A+B$}{$1A+B$}\question{%
این آزمایشی است.}
\answer{$1$}{$11$}{$A+B$}{$1A+B$}\question{%
این آزمایشی است.}
\answer{$1$}{$11$}{$A+B$}{$1A+B$}\question{%
این آزمایشی است.}
\answer{$1$}{$11$}{$A+B$}{$1A+B$}\question{%
این آزمایشی است.}
\answer{$1$}{$11$}{$A+B$}{$1A+B$}
\chapter{فصل دوم}
\newpage\question{%
این آزمایشی است.}
\answer{$1$}{$11$}{$A+B$}{$1A+B$}

می خوام بجای یازده باز بشه یک
\end{document}