使用 xsim 包的 True/False 类型问题

使用 xsim 包的 True/False 类型问题

如何在 'xsim' 包中制作判断题?在 'xsim' 手册中,我没有找到它。

\documentclass[10pt,a4paper]{article}
\usepackage[verbose,clear-aux]{xsim}
\usepackage{xsimverb,listings}
\usepackage{lipsum}
\usepackage{enumitem,amssymb,fmtcount}



\xsimsetup{
    exercise/print = true,
    solution/print = true,
    path=./exercises,
    file-extension = tex,
    exercise/template = bonus,
    grading-table/template = default*
    }

\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\title{xsim package }

\begin{document}
    \begin{exercise}
         A first true-false example for an exercise(T/F).
         \end{exercise}
     \begin{solution}
         A first example for a solution(T).
         \end{solution}
\end{document} 

答案1

所以基本上判断题就是二元选择题。因此我得出了和leandriis 在他的评论中并从手册的第 13 个示例开始(xsim.multiplechoice.tex在您的 TeX 发行版中)。

xsim 示例

% arara: pdflatex: {shell: 1}
\documentclass[10pt,a4paper]{article}
\usepackage[verbose,clear-aux]{xsim}
\usepackage{amssymb}

\DeclareExerciseEnvironmentTemplate{tf}
  {%
    \UseExerciseTemplate{begin}{default}%
  }
  {%
    \IfInsideSolutionF{%
      \par\vskip\baselineskip\noindent
      Select whether this is true or false: $\Box$ true\quad $\Box$ false}%
    \UseExerciseTemplate{end}{default}%
  }

\DeclareExerciseType{tf}{
  exercise-env = truefalse ,
  solution-env = booleansolution ,
  exercise-name = Question ,
  solution-name = Solution ,
  exercise-template = tf ,
  solution-template = tf ,
  counter = exercise
}

\xsimsetup{
  truefalse/print = true,
  booleansolution/print = true,
  path=./exercises,
  file-extension = tex,
  exercise/template = bonus,
  grading-table/template = default*
}

\begin{document}
    \begin{truefalse}
        A first true-false example for an exercise(T/F).
    \end{truefalse}
    \begin{booleansolution}
        A first example for a solution(T).
    \end{booleansolution}
\end{document} 

相关内容