summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/stex/problem
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-20 22:31:24 +0000
committerKarl Berry <karl@freefriends.org>2019-03-20 22:31:24 +0000
commit2b006ec0e0cafe12255f874f9c44786ab6f38901 (patch)
treec40f5796e1b34e3f051abd84d049e092e4ffd0ab /Master/texmf-dist/source/latex/stex/problem
parent8e508e8b0218f17eb318645073096f2cf645cc78 (diff)
stex (20mar19)
git-svn-id: svn://tug.org/texlive/trunk@50489 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/problem')
-rw-r--r--Master/texmf-dist/source/latex/stex/problem/problem.dtx107
1 files changed, 97 insertions, 10 deletions
diff --git a/Master/texmf-dist/source/latex/stex/problem/problem.dtx b/Master/texmf-dist/source/latex/stex/problem/problem.dtx
index 546ca44273f..d46c7d028dc 100644
--- a/Master/texmf-dist/source/latex/stex/problem/problem.dtx
+++ b/Master/texmf-dist/source/latex/stex/problem/problem.dtx
@@ -9,10 +9,11 @@
%
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-%<package>\ProvidesPackage{problem}[2016/04/07 v1.2 Semantic Markup for Problems]
+%<package>\ProvidesPackage{problem}[2019/03/20 v1.3 Semantic Markup for Problems]
%
%<*driver>
\documentclass{ltxdoc}
+\usepackage[utf8]{inputenc}
\usepackage{url,float,xspace}
\usepackage[solutions,hints,notes]{problem}
\usepackage[show]{ed}
@@ -29,8 +30,11 @@
\floatstyle{boxed}
\newfloat{exfig}{thp}{lop}
\floatname{exfig}{Example}
-\def\tracissue#1{\cite{sTeX:online}, \hyperlink{http://trac.kwarc.info/sTeX/ticket/#1}{issue #1}}
-\begin{document}\DocInput{problem.dtx}\end{document}
+\def\githubissue#1{\cite{sTeX:github:on}, \hyperlink{https://github.com/KWARC/sTeX/issues/#1}{issue #1}}
+\begin{document}
+\RecordChanges
+\DocInput{problem.dtx}
+\end{document}
%</driver>
% \fi
%
@@ -42,6 +46,7 @@
% \changes{v1.0}{2013/10/09}{adding \texttt{\textbackslash start/stopsolution}}
% \changes{v1.1}{2013/12/12}{adding MathHub support}
% \changes{v1.2}{2015/11/04}{moving MathHub support out to separate package}
+% \changes{v1.3}{2018/11/23}{Addint Multiple Choice Blocks}
%
% \GetFileInfo{problem.sty}
%
@@ -50,7 +55,7 @@
% \title{\texttt{problem.sty}: An Infrastructure for formatting Problems\thanks{Version {\fileversion} (last revised
% {\filedate})}}
% \author{Michael Kohlhase\\
-% Jacobs University, Bremen\\
+% FAU Erlangen-N\"urnberg\\
% \url{http://kwarc.info/kohlhase}}
% \maketitle
%
@@ -156,14 +161,61 @@
% in a |problem| environment to give hints and to make notes that elaborate certain aspects
% of the problem.
%
-% \subsection{Starting and Stopping Solutions}
-%
% Sometimes we would like to locally override the |solutions| option we have given to the
% package. To turn on solutions we use the
% \DescribeMacro{\startsolutions}|\startsolutions|, to turn them off,
% \DescribeMacro{\stopsolutions}|\stopsolutions|. These two can be used at any point in
% the documents.
%
+% \subsection{Multiple Choice Blocks}\label{sec:user:mcq}
+%
+% Multiple choice blocks can be formatted using the \DescribeMacro{mcb}|mcb| environment,
+% in which single choices are marked up with
+% \DescribeMacro{\mcc}|\mcc[|\meta{keyvals}|]{|\meta{text}|}| macro, which takes an
+% optional key/value argument \meta{keyvals} for choice metadata and a required argument
+% \meta{text} for the proposed answer text. The following keys are supported
+% \begin{itemize}
+% \item \DescribeMacro{T}|T| for true answers, \DescribeMacro{F}|F| for false ones,
+% \item \DescribeMacro{Ttext}|Ttext| the verdict for true answers,
+% \DescribeMacro{Ftext}|Ftext| for false ones, and
+% \item \DescribeMacro{feedback}|feedback| for a short feedback text given to the student.
+% \end{itemize}
+% See Figure~\ref{fig: mcq} for an example
+%\begin{exfig}
+% \begin{verbatim}
+% \begin{problem}[title=Functions]
+% What is the keyword to introduce a function definition in python?
+% \begin{mcb}
+% \mcc[T]{def}
+% \mcc[F,feedback=that is for C and C++]{function}
+% \mcc[F,feedback=that is for Standard ML]{fun}
+% \mcc[F,Ftext=Nooooooooo,feedback=that is for Java]{public static void}
+% \end{mcb}
+% \end{problem}
+% \end{verbatim}
+% \solutionsfalse\hrule
+% \begin{problem}[title=Functions]
+% What is the keyword to introduce a function definition in python?
+% \begin{mcb}
+% \mcc[T]{def}
+% \mcc[F,feedback=that is for C and C++]{function}
+% \mcc[F,feedback=that is for Standard ML]{fun}
+% \mcc[F,Ftext=Nooooooooo,feedback=that is for Java]{public static void}
+% \end{mcb}
+% \end{problem}
+% \solutionstrue\hrule
+% \begin{problem}[title=Functions]
+% What is the keyword to introduce a function definition in python?
+% \begin{mcb}
+% \mcc[T]{def}
+% \mcc[F,feedback=that is for C and C++]{function}
+% \mcc[F,feedback=that is for Standard ML]{fun}
+% \mcc[F,Ftext=Nooooooooo,feedback=that is for Java]{public static void}
+% \end{mcb}
+% \end{problem}
+% \caption{A Problem with a multiple choice block}\label{fig:mcq}
+% \end{exfig}
+%
% \subsection{Including Problems}\label{sec:user:includeproblem}
%
% The \DescribeMacro{\includeproblem}|\includeproblem| macro can be used to include a
@@ -192,9 +244,9 @@
% In this section we document known limitations. If you want to help alleviate them,
% please feel free to contact the package author. Some of them are currently discussed in
% the \sTeX GitHub repository~\cite{sTeX:github:on}.
-% \begin{compactenum}
+% \begin{enumerate}
% \item none reported yet
-% \end{compactenum}
+% \end{enumerate}
%
% \StopEventually{\newpage\PrintChanges}
% \newpage
@@ -241,6 +293,7 @@
% |*.ldf| files.
% \begin{macrocode}
\AfterBabelLanguage{ngerman}{\input{problem-ngerman.ldf}}
+\AfterBabelLanguage{arabic}{\input{problem-arabic.ldf}}
\def\prob@problem@kw{Problem}
\def\prob@solution@kw{Solution}
% \end{macrocode}
@@ -277,7 +330,8 @@
% \begin{macro}{\prob@number}
% We consolidate the problem number into a reusable internal macro
% \begin{macrocode}
-\def\prob@number{\ifx\inclprob@refnum\@empty%
+\newcommand\prob@number{%
+\ifx\inclprob@refnum\@empty% if there is no outside refnumb
\ifx\problem@refnum\@empty\prob@label\theproblem%
\else\prob@label\problem@refnum\fi%
\else\prob@label\inclprob@refnum\fi}
@@ -317,7 +371,7 @@
\@in@omtexttrue% we are in a statement (for inline definitions)
\stepcounter{problem}\record@problem%
\def\current@section@level{\prob@problem@kw}%
-\par\noindent\textbf\prob@heading\show@pts\show@min\rm\noindent\ignorespaces}
+\par\noindent\textbf\prob@heading\show@pts\show@min\rmfamily\noindent\ignorespaces}
{\smallskip}
\ifboxed\surroundwithmdframed{problem}\fi
% \end{macrocode}
@@ -407,6 +461,39 @@
\fi%ifhints
% \end{macrocode}
%
+% \subsection{Multiple Choice Blocks}\label{sec:impl:mcq}
+%
+% \begin{environment}{mcb}
+% \ednote{MK: maybe import something better here from a dedicated MC package}
+% \begin{macrocode}
+\newenvironment{mcb}
+{\begin{enumerate}}
+{\end{enumerate}}
+% \end{macrocode}
+% \end{environment}
+% we define the keys for the |mcc| macro
+% \begin{macrocode}
+\srefaddidkey{mcc}
+\addmetakey{mcc}{feedback}
+\addmetakey[T]{mcc}{T}
+\addmetakey[F]{mcc}{F}
+\addmetakey[Yes]{mcc}{Ttext}
+\addmetakey[No]{mcc}{Ftext}
+% \end{macrocode}
+%
+% \begin{macro}{\mcc}
+% \begin{macrocode}
+\newcommand\mcc[2][]{%
+\metasetkeys{mcc}{#1}%
+\item #2%
+\ifsolutions\\%
+\ifcsstring{mcc@T}{T}{}{\mcc@Ttext}%
+\ifcsstring{mcc@F}{F}{}{\mcc@Ftext}%
+\ifx\mcc@feedback\@empty!\else, \mcc@feedback\fi%
+\fi} %solutions
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Including Problems}\label{sec:impl:includeproblem}
%
% \begin{macro}{\includeproblem}