Skip to content

چگونه در زی‌پرشین سوال چندگزینه‌ای بنویسیم؟ #34

Answered by kvafa
kvafa asked this question in Q&A
Discussion options

You must be logged in to vote

انجام دادن این کار سخت نیست فقط باید کمی فکر کنید.

\documentclass{article}
\usepackage{xepersian}
\settextfont{Yas}
\makeatletter
\newcounter{multiplechoice}
\newenvironment{multiplechoice}{%
  \setcounter{multiplechoice}{0}%
  \par
  }{}
\newbox\choicebox
\newdimen\choicedim
\newcommand{\choice}[1]{%
  \stepcounter{multiplechoice}%
  \setbox\choicebox\hbox{\arabic{multiplechoice}) #1}%
  \ifdim\wd\choicebox>\choicedim
    \choicedim=\wd\choicebox
  \fi
  \ifdim\choicedim>0.2\linewidth
    \leavevmode
    \hb@xt@\linewidth{\usebox\choicebox\hfill}%
  \else
    \leavevmode
    \hb@xt@0.2\dimexpr\linewidth-\leftmargin\relax
    {\usebox\choicebox\hfill}%
  \fi%
}
\makeatother
\begin{document}

Replies: 1 comment

Comment options

kvafa
Sep 8, 2024
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by kvafa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant