summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-06-25 20:23:31 +0000
committerKarl Berry <karl@freefriends.org>2022-06-25 20:23:31 +0000
commit1fe2a4db97f0240614f55ae98f15b64097dbc5c6 (patch)
tree480709540bb4b3d6be37c9e479c4c8758afec7c4
parentcf70129a8ef1242754986008823499a035937a63 (diff)
multiple-choice (25jun22)
git-svn-id: svn://tug.org/texlive/trunk@63722 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/multiple-choice/README22
-rw-r--r--Master/texmf-dist/doc/latex/multiple-choice/multiple-choice-doc.pdfbin0 -> 132611 bytes
-rw-r--r--Master/texmf-dist/doc/latex/multiple-choice/multiple-choice-doc.tex96
-rw-r--r--Master/texmf-dist/tex/latex/multiple-choice/multiple-choice.sty99
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds1
-rw-r--r--Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/multiple-choice.tlpsrc0
8 files changed, 220 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/multiple-choice/README b/Master/texmf-dist/doc/latex/multiple-choice/README
new file mode 100644
index 00000000000..76c8da72929
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/multiple-choice/README
@@ -0,0 +1,22 @@
+_____________________
+The multiple-choice package
+v0.2
+
+This package adjusts the choices of the multiple-choice question automatically.
+
+It has been wholly inspired by the work of Enrico Gregorio
+and improved by Vafa Khalighi and I've just packed and
+redistributed it under the name of the `multiple-choice` package.
+
+Current version release date: 2022/06/24
+___________________
+Seiied-Mohammad-Javad Razvian
+javadr at gmail dot com
+
+Copyright © 2022
+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 “author-maintained” (as per LPPL maintenance status)
+by Seiied-Mohammad-Javad Razavian.
diff --git a/Master/texmf-dist/doc/latex/multiple-choice/multiple-choice-doc.pdf b/Master/texmf-dist/doc/latex/multiple-choice/multiple-choice-doc.pdf
new file mode 100644
index 00000000000..8264bcecb50
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/multiple-choice/multiple-choice-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/multiple-choice/multiple-choice-doc.tex b/Master/texmf-dist/doc/latex/multiple-choice/multiple-choice-doc.tex
new file mode 100644
index 00000000000..f640cabd1a6
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/multiple-choice/multiple-choice-doc.tex
@@ -0,0 +1,96 @@
+\documentclass{ltxdoc}
+
+\usepackage{fullpage}
+\usepackage{url}
+\usepackage{holtxdoc}
+\usepackage{listings}
+\usepackage{xcolor}
+\usepackage{multicol}
+\usepackage{multiple-choice}
+
+\lstdefinestyle{BashInputStyle}{
+ basicstyle=\footnotesize\sffamily,
+ frame=tb,
+ columns=fullflexible,
+ backgroundcolor=\color{gray!10},
+}
+\lstset{basicstyle=\ttfamily}
+
+\title{The \xpackage{multiple-choice} Package}
+\author{Seiied Mohammad Javad Razavian}
+
+\date{\choicesdate,\space version \choicesversion}
+
+ \parindent=0pt
+
+\thispagestyle{empty}
+
+\begin{document}
+\maketitle{
+\centerline{\large\bfseries Abstract}
+\bigskip
+\begin{multicols}{2}
+The \xpackage{multiple-choice} package adjusts the choices of the multiple-choice question automatically.
+It has been wholly inspired by the work of Enrico Gregorio\footnote{\url{https://tex.stackexchange.com/questions/140923}}
+and improved by Vafa Khalighi. I've just packed and redistributed it. It works with \XeLaTeX, \pdfLaTeX, and \LuaLaTeX.
+Please, report any issues including bugs, typos in the documentation
+or feature requests on \url{https://github.com/javadr/multiple-choice.sty/issues}.
+\end{multicols}
+ }
+
+ \section{Loading Package}
+The package can be loaded in the ordinary way
+\cs{usepackage{multiple-choice}}.
+
+\section{Typesetting the multiple-choice question}
+ The package defines the \texttt{choices} environment with the \cs{choice} macro for the choices of the multiple-chocie question.
+
+\begin{lstlisting}[style=BashInputStyle, escapechar={|},]
+\begin{choices}
+ \choice The first choice.
+ \choice The second choice.
+ \choice The third choice.
+ \choice The fourth choice.
+\end{choices}
+\end{lstlisting}
+
+ \section{Sample}
+\begin{enumerate}
+
+\item First question?
+\begin{choices}
+ \choice The first choice.
+ \choice The second choice.
+ \choice The third choice.
+ \choice The fourth choice.
+\end{choices}
+
+\item Second question?
+\begin{choices}
+ \choice The first choice.
+ \choice The second choice.
+ \choice The third choice.
+ \choice The fourth choice.
+ \choice The fifth choice.
+ \choice The sixth choice.
+\end{choices}
+
+\item Third question?
+\begin{choices}
+ \choice The very very very first choice.
+ \choice The second choice.
+ \choice The third choice.
+ \choice The fourth choice.
+\end{choices}
+
+\item Fourth question?
+\begin{choices}
+ \choice The very very very very very very very very very first choice.
+ \choice The second choice.
+ \choice The third choice.
+ \choice The fourth choice.
+\end{choices}
+
+\end{enumerate}
+
+\end{document}
diff --git a/Master/texmf-dist/tex/latex/multiple-choice/multiple-choice.sty b/Master/texmf-dist/tex/latex/multiple-choice/multiple-choice.sty
new file mode 100644
index 00000000000..e672e5dd541
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/multiple-choice/multiple-choice.sty
@@ -0,0 +1,99 @@
+%%
+%% This is file `multiple-choice.sty'.
+%%
+%% LaTeX package for multiple-choice questions
+%%
+%% Copyright © 2022
+%% ------------------------------------------------------------------
+%% Author: Seiied-Mohammad-Javad Razavian <javadr at gmail dot com>
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the Latex Project Public License, either
+%% version 1.3 of this license or (at your option) any
+%% later version.
+%% The latest version of the license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of
+%% LaTeX version 2003/06/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%% This work is “author-maintained” (as per LPPL maintenance status).
+%% The Current Maintainer of this work is Seiied-Mohammad-Javad Razavian.
+%% ------------------------------------------------------------------
+%%
+\NeedsTeXFormat{LaTeX2e}
+\def\choicesdate{2022/06/24}
+\def\choicesversion{0.2}
+\ProvidesPackage{multiple-choice}[\choicesdate\space v\choicesversion^^JMultiple-choice question with automatic adjustment of the choices based on their widths]
+\RequirePackage{biditools}
+\newdimen\mc@ChoiceLabelWidth
+\newdimen\mc@ChoiceLabelSep
+\mc@ChoiceLabelWidth=1.5em
+\mc@ChoiceLabelSep=0.5em
+\newcounter{mc@MultChoiceCount}
+\newcommand{\mc@InitialChoice}{%
+ \ifnum\value{mc@MultChoiceCount}>\z@
+ \cr
+ \fi
+ \stepcounter{mc@MultChoiceCount}%
+ \hbox to \mc@ChoiceLabelWidth{\hss(\Alph{mc@MultChoiceCount})}%
+ \kern\mc@ChoiceLabelSep
+}%
+\newcommand{\mc@FinalChoice}{%
+ \ifnum\value{mc@MultChoiceCount}>\z@
+ \egroup
+ \egroup
+ \fi
+ \stepcounter{mc@MultChoiceCount}%
+ \hspace{0pt plus 1pt}%
+ \hbox\bgroup
+ \hbox to \mc@ChoiceLabelWidth{\hss(\Alph{mc@MultChoiceCount})}%
+ \kern\mc@ChoiceLabelSep
+ \vtop\bgroup
+ \hsize\mc@MultChoicesWidth
+ \advance\hsize-\mc@ChoiceLabelWidth
+ \advance\hsize-\mc@ChoiceLabelSep
+}%
+\newbox\mc@MultChoicesBox
+\newdimen\mc@MultChoicesWidth
+\newcommand{\mc@ComputeMultChoicesWidth}[1]{%
+ \setbox\mc@MultChoicesBox\hbox{%
+ \vbox{%
+ \halign{%
+ ##\hfil\cr
+ #1\crcr
+ }%
+ }%
+ }%
+}%
+% MultipltChoices Environment.
+\newenvironment{choices}{%
+ \setcounter{mc@MultChoiceCount}{0}%
+ \let\choice\mc@InitialChoice
+ \bidi@collect@long@body\mc@ComputeMultChoicesWidth
+}{%
+ \mc@MultChoicesWidth-\fontcharwd\font`
+ \advance\mc@MultChoicesWidth\wd\mc@MultChoicesBox
+ \ifdim\mc@MultChoicesWidth>0.5\linewidth
+ \mc@MultChoicesWidth=\linewidth
+ \else
+ \ifdim\mc@MultChoicesWidth>0.25\linewidth
+ \mc@MultChoicesWidth=0.5\linewidth
+ \else
+ \mc@MultChoicesWidth=0.25\linewidth
+ \fi
+ \fi
+ \setcounter{mc@MultChoiceCount}{0}%
+ \let\choice\mc@FinalChoice
+ \parindent\z@
+ \ifvmode
+ \else
+ \par
+ \fi
+ \the\@bidi@envbody
+ \egroup
+ \egroup
+}%
+%%
+%%
+%% End of file `multiple-choice.sty'.
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index a39f5e837bf..2ffa83a9d84 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -553,7 +553,7 @@ my @TLP_working = qw(
mucproc mugsthesis muling multenum
multiaudience multibbl multibib multibibliography
multicap multicolrule multidef multido multienv multiexpand
- multifootnote multilang multiobjective multirow munich
+ multifootnote multilang multiobjective multiple-choice multirow munich
musical musicography musikui musixguit
musixtex musixtex-fonts musixtnt musuos muthesis
mversion mwcls mwe mweights mxedruli
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index ede905bff19..e917cd8a38e 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -944,6 +944,7 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`);
'mtx', "die 'skipping, pascal musixtex binaries'",
'multibox', "die 'skipping, noinfo license, author deceased'",
'multido', "&MAKEpst",
+ 'multiple-choice', "&MAKEflatten",
'multirow', "&MAKEflatten",
'musictex', "die 'skipping, superseded by musixtex'",
'musixtnt', "&MAKEflatten",
diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
index 9406b8e1c2a..3e9ae071461 100644
--- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
@@ -888,6 +888,7 @@ depend multienv
depend multiexpand
depend multifootnote
depend multilang
+depend multiple-choice
depend multirow
depend mversion
depend mwe
diff --git a/Master/tlpkg/tlpsrc/multiple-choice.tlpsrc b/Master/tlpkg/tlpsrc/multiple-choice.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/multiple-choice.tlpsrc