如何输入包含多个正确选项的多项选择题

如何输入包含多个正确选项的多项选择题

我想使用练习包输入多项选择题(可能有两个或多个答案)书,例如

\begin{questions}
\question This is the first question
\choice Wrong answer
\correctchoice This is a correct answer
\correctchoice This is another answer
\choice Wrong answer

\question
....
\end{questions}

我想在书的最后输入答案,包括章节名称和练习编号或书的页码。问题中的选项必须位于一行或两行以节省空间。

在答题纸上,我喜欢对所选答案给出解释。

答案1

你的问题有点令人困惑:你指的是exercise包,但在代码片段中使用由以下定义的命令:exam类...然后你正在谈论一本有单独答案部分的书,但也说

在答题纸上,我喜欢[...]

因为我现在不知道你想使用什么包/类,而且如果你被绑定到一个特定的包,你从来没有真正回答我的评论,而且因为你也不清楚你是想设计一本书还是一份练习表/答题表的组合(或者两者兼而有之?)我将为班级exam创建表提供一个解决方案,为exsheets用于教科书的包装。

使用exam

该类exam显然不是用来创建教科书的。但可以用它创建练习/答题纸。删除或添加类选项answers以查看差异:

\documentclass[answers]{exam}
\begin{document}

\begin{questions}
 \question This is the first question.
 \ifprintanswers\emph{Info:} Correct choices are marked bold.\fi
 \begin{checkboxes}
  \choice Wrong answer
  \correctchoice This is a correct answer
  \correctchoice This is another answer
  \choice Wrong answer
 \end{checkboxes}
 \question This is the second question.
 \ifprintanswers\emph{Info:} Correct choices are marked bold.\fi
 
 \begin{oneparcheckboxes}
  \correctchoice True
  \choice False
  \correctchoice True
  \choice false
 \end{oneparcheckboxes}
\end{questions}

\end{document}

在此处输入图片描述

使用exsheets

exsheets包可用于创建考试、练习/答题纸或教科书中的练习。以下示例将展示如何添加练习和解决方案,并在单独的部分或章节中打印解决方案。

使用enumitem

\documentclass{article}
\usepackage{exsheets}
\SetupExSheets{counter-format=se.qu}

% due to a bug in versions >0.3a:
\providecommand*\checkedchoicebox{\ckeckedchoicebox}

\usepackage[inline]{enumitem}
\newlist{choices}{itemize}{1}
\newlist{choices*}{itemize*}{1}
\setlist[choices*]{itemjoin=\qquad}
\newcommand*\choice{\item[\choicebox]}
\newcommand*\correctchoice{\PrintSolutionsTF{\item[\checkedchoicebox]}{\item[\choicebox]}}

\begin{document}
\section{Exercises}
\begin{question}\label{qu:one}
 This is the first question.
 \begin{choices}
  \choice Wrong answer
  \correctchoice This is a correct answer
  \correctchoice This is another answer
  \choice Wrong answer
 \end{choices}
\end{question}
\begin{solution}
 This is the first question.
 \begin{choices}
  \choice Wrong answer
  \correctchoice This is a correct answer
  \correctchoice This is another answer
  \choice Wrong answer
 \end{choices}
 You find the question on page~\pageref{qu:one}.
\end{solution}
\begin{question}\label{qu:two}
 This is the second question.
 
 \begin{choices*}
  \correctchoice True
  \choice False
  \correctchoice True
  \choice false
 \end{choices*}
\end{question}
\begin{solution}
 This is the second question.
 
 \begin{choices*}
  \correctchoice True
  \choice False
  \correctchoice True
  \choice false
 \end{choices*}
 
 \noindent You find the question on page~\pageref{qu:two}.
\end{solution}

\section{Solutions}
\printsolutions

\end{document}

在此处输入图片描述

随着 >v0.3aexsheets

的下一次更新exsheets不仅将修复一些问题,例如,\ckeckedchoicebox而且还提供了不带的可能性enumitem。可以运行的版本点击此处下载但是,CTAN 的更新还得等几天。

\documentclass{article}
\usepackage{exsheets}
\SetupExSheets{counter-format=se.qu}

\NewTasks[style=multiplechoice]{choices}[\choice]
\newcommand*\correct{\checkedchoicebox}

\begin{document}
\section{Exercises}
\begin{question}\label{qu:one}
 This is the first question.
 \begin{choices}
  \choice Wrong answer
  \choice This is a correct answer
  \choice This is another answer
  \choice Wrong answer
 \end{choices}
\end{question}
\begin{solution}
 This is the first question.
 \begin{choices}
  \choice Wrong answer
  \choice[\correct] This is a correct answer
  \choice[\correct] This is another answer
  \choice Wrong answer
 \end{choices}
 You find the question on page~\pageref{qu:one}.
\end{solution}
\begin{question}\label{qu:two}
 This is the second question.
 \begin{choices}{4}
  \choice True
  \choice False
  \choice True
  \choice false
 \end{choices}
\end{question}
\begin{solution}
 This is the second question.
 \begin{choices}{4}
  \choice[\correct] True
  \choice False
  \choice[\correct] True
  \choice false
 \end{choices}
 \noindent You find the question on page~\pageref{qu:two}.
\end{solution}

\section{Solutions}
\printsolutions

\end{document}

相关内容