# True/False type Questions with xsim package

How to make true/false type questions in 'xsim' package? In the manual of 'xsim', I could not find it.

\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,
}

\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}

• Maybe you could use something like the multiple choice question shown in example 13 of the xsim manual. – leandriis Apr 14 at 8:38

So basically a true/false question is a multiple choice question with binary choices. Therefore I came to the same conclusion as leandriis in his comment and started with example 13 of the manual (xsim.multiplechoice.tex in your TeX distribution).

% 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,
}

\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}

• It is giving error: Undefined control sequence. \begin{truefalse} – cosmicraga Apr 15 at 12:47
• @cosmicraga Did you copy my code as is? The \begin{truefalse} is defined in the exercise type. It compiles fine here (TL2019/pretest on Linux). – TeXnician Apr 15 at 12:49
• Yes. I had to delete all the previously existing .aux and other files from the folder. Then it worked correctly. Thank you. – cosmicraga Apr 15 at 12:52
• It will be great if the format is like following: – cosmicraga Apr 15 at 13:02
• @cosmicraga It would be better to ask a new question with that exact requirement. – TeXnician Apr 15 at 13:35