0

With reference to the following answer

https://tex.stackexchange.com/questions/484753/true-false-type-questions-with-xsim-package/484760?noredirect=1#[True False question with xsim][1]

How to print like following : The question should look like below:

The earth is the fourth planet from the sun. (True/False).

The answer should look like :

The earth is the fourth planet from the sun. (True/False).

The normal hide or show answer should also work.

1

This is just to get you started: The format of true/false has been adjusted, especially that it also repeats the question. For an answer you need to add the respective "True" or "False" in an environment on its own (I do not think you can avoid it easily given how xsim handles solutions, so I cannot even prepare a thin wrapper for you).

What I did not include at this point is the exact answer formatting. First of all, you would need to retrieve the solution body and then you would have to make comparisons to check whether true or false should be bold. The current implementation just outputs the correct answer.

Please note that setting the appropriate keys (truefalse, booleansolution) with their show/hide options will work independently from the normal exercise/solution pair.

xsim

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

\DeclareExerciseEnvironmentTemplate{tf}
  {%
    \UseExerciseTemplate{begin}{default}%
    \IfInsideSolutionT{\GetExerciseBody{exercise}\bfseries}%
  }
  {%
    \IfInsideSolutionF{(True/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}
        The earth is the fourth planet from the sun.
    \end{truefalse}
    \begin{booleansolution}
      True.
    \end{booleansolution}
\end{document} 
  • Thank you so much. – cosmicraga Apr 15 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.